20260819173221
This commit is contained in:
1 parent
1ffc8e1ac9
commit
a0a4273f4c
326 files changed
+301646
-2314
No files matched your search
@@ -106,14 +106,14 @@ router.beforeEach(async (to) => {
|
||||
return { path: '/login', query: { redirect: to.fullPath } }
|
||||
}
|
||||
|
||||
// 统一在路由守卫加载权限:首屏(/dashboard)与业务页都在挂载前 await 完成,
|
||||
// 菜单一次性到位、不会“跳出”;load 内部按主体去重,重复进入同一主体不重复请求
|
||||
const permissionStore = usePermissionStore()
|
||||
await permissionStore.load().catch(() => {})
|
||||
|
||||
const moduleId = to.meta.moduleId
|
||||
if (moduleId) {
|
||||
const permissionStore = usePermissionStore()
|
||||
// 权限接口失败时静默降级:canAccess 返回 false,与"菜单退化为仅工作台"策略一致
|
||||
await permissionStore.load().catch(() => {})
|
||||
if (!permissionStore.canAccess(moduleId)) {
|
||||
return '/dashboard'
|
||||
}
|
||||
if (moduleId && !permissionStore.canAccess(moduleId)) {
|
||||
return '/dashboard'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user