实现系统管理后台 V1
This commit is contained in:
@@ -98,6 +98,69 @@ export const router = createRouter({
|
||||
permission: 'SYSTEM_DEBUG_EML_RUN',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/system',
|
||||
component: () => import('@/views/system/SystemAdminLayoutView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemSettings',
|
||||
permission: 'SYSTEM_ADMIN_CONSOLE_ACCESS',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'users',
|
||||
name: 'system-users',
|
||||
component: () => import('@/views/system/SystemUsersView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemUsers',
|
||||
permission: 'SYSTEM_USER_MANAGE',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'roles',
|
||||
name: 'system-roles',
|
||||
component: () => import('@/views/system/SystemRolesView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemRoles',
|
||||
permission: 'SYSTEM_ROLE_MANAGE',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'menus',
|
||||
name: 'system-menus',
|
||||
component: () => import('@/views/system/SystemMenusView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemMenus',
|
||||
permission: 'SYSTEM_MENU_MANAGE',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'hotels',
|
||||
name: 'system-hotels',
|
||||
component: () => import('@/views/system/SystemHotelsView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemHotels',
|
||||
permission: 'HOTEL_MANAGE',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'audits',
|
||||
name: 'system-audits',
|
||||
component: () => import('@/views/system/SystemAuditsView.vue'),
|
||||
meta: {
|
||||
titleKey: 'nav.systemAudits',
|
||||
permission: 'SYSTEM_ADMIN_CONSOLE_ACCESS',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'not-found',
|
||||
component: () => import('@/views/system/RouteNotFoundView.vue'),
|
||||
meta: {
|
||||
titleKey: 'notFound.title',
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -138,6 +201,26 @@ export function createAuthGuard(resolveAuthStore: () => AuthStore = () => useAut
|
||||
}
|
||||
}
|
||||
|
||||
if (to.path === '/system') {
|
||||
return resolveSystemAdminEntryPath(authStore)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
function resolveSystemAdminEntryPath(authStore: AuthStore): string {
|
||||
if (authStore.hasPermission('SYSTEM_USER_MANAGE')) {
|
||||
return '/system/users'
|
||||
}
|
||||
if (authStore.hasPermission('SYSTEM_ROLE_MANAGE')) {
|
||||
return '/system/roles'
|
||||
}
|
||||
if (authStore.hasPermission('SYSTEM_MENU_MANAGE')) {
|
||||
return '/system/menus'
|
||||
}
|
||||
if (authStore.hasPermission('HOTEL_MANAGE')) {
|
||||
return '/system/hotels'
|
||||
}
|
||||
return '/system/audits'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user