新增用户角色
This commit is contained in:
parent
2d63cdefdb
commit
cc2cc4c9e5
|
|
@ -95,7 +95,7 @@ const Index: React.FC = () => {
|
||||||
<Operation></Operation>
|
<Operation></Operation>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.indexBtns}>
|
<div className={styles.indexBtns}>
|
||||||
{user.roleId === '1' ? <Button type="primary"
|
{user.roleId === '1' && user.roomAdmin ? <Button type="primary"
|
||||||
icon={<img src={ImageUrl.icon8} alt="" />}
|
icon={<img src={ImageUrl.icon8} alt="" />}
|
||||||
className='m-ant-btn drag'
|
className='m-ant-btn drag'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ const Home: React.FC = () => {
|
||||||
iconActive: ImageUrl.icon13Active,
|
iconActive: ImageUrl.icon13Active,
|
||||||
isHover: false,
|
isHover: false,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
isShow: user?.roleId === '1' ? true : false,
|
isShow: user?.roleId === '1' && user?.roomAdmin ? true : false,
|
||||||
path: '/home/user'
|
path: '/home/user'
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
class LocalStorage {
|
class LocalStorage {
|
||||||
private constructor() {}
|
private constructor() { }
|
||||||
|
|
||||||
private static instance: LocalStorage | null = null
|
private static instance: LocalStorage | null = null
|
||||||
|
|
||||||
|
|
@ -11,6 +11,16 @@ class LocalStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
setItem(key: string, value: any) {
|
setItem(key: string, value: any) {
|
||||||
|
switch (key) {
|
||||||
|
case 'user':
|
||||||
|
value = JSON.parse(value)
|
||||||
|
value.roomAdmin = value.roleId === '1'
|
||||||
|
if (value.roleId === '3') {
|
||||||
|
value.roleId = '1'
|
||||||
|
}
|
||||||
|
value = JSON.stringify(value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
localStorage.setItem(key, value)
|
localStorage.setItem(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue