权限的管理和校验修改

This commit is contained in:
xiaowang
2026-02-26 22:51:56 +08:00
parent 65388cb7f9
commit 4b28baa80f
7 changed files with 143 additions and 70 deletions
+1 -9
View File
@@ -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)
})
})