fix: 新增个人中心

This commit is contained in:
xieyonghong 2023-03-31 18:02:09 +08:00
parent b01cc1bb17
commit e9f255ca3c
5 changed files with 83 additions and 3 deletions

View File

@ -47,3 +47,5 @@ export const SystemConst = {
VERSION_CODE: 'version_code', VERSION_CODE: 'version_code',
AMAP_KEY : 'amap_key', AMAP_KEY : 'amap_key',
} }
export const USER_CENTER_MENU_CODE = 'account-center'

View File

@ -1,3 +1,4 @@
import USER_CENTER_MENU_DATA from './baseMenu'
/** /**
* *
*/ */
@ -9,6 +10,33 @@ export enum ROLEKEYS {
export type roleKeysType = keyof typeof ROLEKEYS; export type roleKeysType = keyof typeof ROLEKEYS;
export const ROLE_USER_CENTER = {
...USER_CENTER_MENU_DATA,
buttons: [
{
id: 'passwd-update',
name: '密码修改',
enabled: true,
granted: true
},
{
id: 'info-update',
name: '基本信息修改',
enabled: true,
granted: true
},
{
id: 'message',
name: '消息订阅',
enabled: true,
granted: true
}
],
assetAccesses: [],
granted: true,
owner: 'iot'
}
export const RoleData = { export const RoleData = {
[ROLEKEYS.device]: { [ROLEKEYS.device]: {
name: '设备接入岗', name: '设备接入岗',
@ -217,6 +245,7 @@ export default {
createTime: 1659344075524, createTime: 1659344075524,
granted: true, granted: true,
}, },
ROLE_USER_CENTER
], ],
[ROLEKEYS.link]: [ [ROLEKEYS.link]: [
{ {
@ -958,5 +987,6 @@ export default {
accessDescription: '此菜单不支持数据权限控制', accessDescription: '此菜单不支持数据权限控制',
granted: true, granted: true,
}, },
ROLE_USER_CENTER
], ],
}; };

View File

@ -1,3 +1,44 @@
import { USER_CENTER_MENU_CODE } from '@/utils/consts'
export const USER_CENTER_MENU_DATA = {
id: '19a1f2c763e1231f1e1',
accessSupport: { value: 'unsupported', label: '不支持'},
supportDataAccess: false,
code: USER_CENTER_MENU_CODE,
buttons: [
{
id: 'passwd-update',
name: '密码修改',
permissions: [
{
permission: 'user',
action: ['update-self-pwd']
}
]
},
{
id: 'info-update',
name: '基本信息修改',
permissions: [
{
permission: 'user',
action: ['update-self-info']
}
]
},
{
id: 'message',
name: '消息订阅',
permissions: [
{
permission: 'alarm-config',
action: ['query']
}
]
}
]
}
export default [ export default [
// 物联网 // 物联网
{ {
@ -4015,6 +4056,10 @@ export default [
permission: 'network-card', permission: 'network-card',
actions: ['save'], actions: ['save'],
}, },
{
permission: 'device-instance',
actions: ['query'],
},
], ],
}, },
{ {
@ -4219,4 +4264,6 @@ export default [
}, },
], ],
}, },
// 用户中心
USER_CENTER_MENU_DATA
]; ];

View File

@ -73,6 +73,7 @@ import BaseMenu from '@/views/init-home/data/baseMenu';
import type { AntTreeNodeDropEvent } from 'ant-design-vue/es/tree'; import type { AntTreeNodeDropEvent } from 'ant-design-vue/es/tree';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { onlyMessage } from '@/utils/comm'; import { onlyMessage } from '@/utils/comm';
import { USER_CENTER_MENU_CODE } from '@/utils/consts'
const selectedKeys: any = ref([]); const selectedKeys: any = ref([]);
const treeData = ref<any>([]); const treeData = ref<any>([]);
@ -185,7 +186,7 @@ onMounted(() => {
); );
getMenuTree_api(params).then((resp: any) => { getMenuTree_api(params).then((resp: any) => {
if (resp.status == 200) { if (resp.status == 200) {
systemMenu.value = resp.result; systemMenu.value = resp.result?.filter((item: { code: string }) => item.code !== USER_CENTER_MENU_CODE);
// //
const baseMenuData = developArrToMap(baseMenu.value); const baseMenuData = developArrToMap(baseMenu.value);
const systemMenuData = developArrToMap(systemMenu.value, true); const systemMenuData = developArrToMap(systemMenu.value, true);

View File

@ -84,7 +84,7 @@ import { getMenuTree_api, delMenuInfo_api } from '@/api/system/menu';
import { message } from 'jetlinks-ui-components'; import { message } from 'jetlinks-ui-components';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { useUserInfo } from '@/store/userInfo'; import { useUserInfo } from '@/store/userInfo';
import { USER_CENTER_MENU_CODE } from '@/utils/consts'
const admin = useUserInfo().userInfos?.type.id === 'admin'; const admin = useUserInfo().userInfos?.type.id === 'admin';
const permission = 'system/Menu'; const permission = 'system/Menu';
@ -206,7 +206,7 @@ const table = reactive({
return { return {
code: resp.message, code: resp.message,
result: { result: {
data: resp.result, data: resp.result?.filter((item: { code: string }) => item.code !== USER_CENTER_MENU_CODE),
pageIndex: resp.pageIndex, pageIndex: resp.pageIndex,
pageSize: resp.pageSize, pageSize: resp.pageSize,
total: resp.total, total: resp.total,