仓库模块完了
This commit is contained in:
@@ -77,14 +77,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
title: '用户管理'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'api-keys',
|
||||
name: 'AdminApiKeys',
|
||||
component: () => import('../views/admin/AdminApiKeysView.vue'),
|
||||
meta: {
|
||||
title: 'API密钥管理'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
path: 'api',
|
||||
name: 'AdminApiManagement',
|
||||
@@ -157,7 +150,9 @@ router.beforeEach((to, _from, next) => {
|
||||
if (to.meta.requiresAdmin) {
|
||||
try {
|
||||
const userObj = JSON.parse(user)
|
||||
if (userObj.role !== 'admin') {
|
||||
// 检查用户是否为管理员,支持多种格式
|
||||
const isAdmin = userObj.role?.name === 'admin' || userObj.role_name === 'admin'
|
||||
if (!isAdmin) {
|
||||
next({ name: 'Home' })
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user