增加权限系统
This commit is contained in:
@@ -84,6 +84,13 @@ router.beforeEach(async (to) => {
|
||||
if (!adminSession.token) {
|
||||
return '/admin/login'
|
||||
}
|
||||
if (adminSession.permissions.length === 0) {
|
||||
try {
|
||||
await adminSession.loadMe()
|
||||
} catch {
|
||||
// 权限加载失败,仍然允许访问(降级为无权限状态)
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user