权限的管理和校验修改
This commit is contained in:
@@ -148,20 +148,12 @@ const selectedKeys = ref<string[]>([route.path])
|
||||
const filteredMenuItems = computed(() => {
|
||||
// 访问 userPermissions 以建立依赖关系
|
||||
userPermissions.value
|
||||
// 管理员用户(type === 4)拥有所有权限
|
||||
if (userInfo.value?.type === 4) {
|
||||
return menuItems
|
||||
}
|
||||
// 其他用户类型根据实际权限过滤菜单
|
||||
// 所有用户类型都根据实际权限过滤菜单
|
||||
return menuItems.filter(item => {
|
||||
// 空权限码的菜单项(如首页)总是可见
|
||||
if (!item.permissionCode) {
|
||||
return true
|
||||
}
|
||||
// 美甲师用户(type === 3)不显示仪表盘
|
||||
if (userInfo.value?.type === 3 && item.key === '/admin/dashboard') {
|
||||
return false
|
||||
}
|
||||
return hasPermission(item.permissionCode)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user