重构Salon后台单管理员与经营驾驶舱
This commit is contained in:
@@ -8,9 +8,10 @@ import {
|
||||
} from '@/utils/admin-auth-bootstrap'
|
||||
|
||||
const pageNames = [
|
||||
['', 'HomeView', 'admin', undefined],
|
||||
['users', 'UsersView', 'admin-users', 'user:view'], ['registrations', 'WorkbenchRegistrationView', 'admin-registrations', 'user:view'], ['privacy', 'PrivacyComplianceView', 'admin-privacy', 'legal_agreement:manage'], ['shops', 'ShopsView', 'admin-shops', 'shop:view'],
|
||||
['profile', 'ProfileView', 'admin-profile', undefined], ['settings', 'SystemSettingsView', 'admin-settings', 'messagehub:config:manage']
|
||||
['', 'SalonDashboardView', 'admin'],
|
||||
['users', 'UsersView', 'admin-users'], ['registrations', 'WorkbenchRegistrationView', 'admin-registrations'], ['privacy', 'PrivacyComplianceView', 'admin-privacy'], ['shops', 'ShopsView', 'admin-shops'],
|
||||
['profile', 'ProfileView', 'admin-profile'], ['settings', 'SystemSettingsView', 'admin-settings'],
|
||||
['orders', 'OrdersView', 'admin-orders'], ['after-sales', 'AfterSalesView', 'admin-after-sales'], ['inventory', 'InventoryView', 'admin-inventory']
|
||||
] as const
|
||||
|
||||
const routes = [
|
||||
@@ -18,8 +19,8 @@ const routes = [
|
||||
{ path: '/admin/login', name: 'admin-login', component: () => import('../views/admin/AdminLoginView.vue'), meta: { requiresAuth: false, isAdmin: true, hideNav: true } },
|
||||
{
|
||||
path: '/admin', component: () => import('../views/admin/AdminLayout.vue'), meta: { requiresAuth: true, isAdmin: true, hideNav: true },
|
||||
children: pageNames.map(([path, view, name, permissionCode]) => ({
|
||||
path, name, component: () => import(`../views/admin/${view}.vue`), meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode }
|
||||
children: pageNames.map(([path, view, name]) => ({
|
||||
path, name, component: () => import(`../views/admin/${view}.vue`), meta: { requiresAuth: true, isAdmin: true, hideNav: true }
|
||||
}))
|
||||
},
|
||||
{ path: '/:pathMatch(.*)*', name: 'not-found', component: () => import('../views/NotFoundView.vue'), meta: { requiresAuth: false, isAdmin: false, hideNav: true } }
|
||||
@@ -43,7 +44,7 @@ router.beforeEach(async to => {
|
||||
return '/admin/login'
|
||||
}
|
||||
if (await ensureAdminAuthBootstrap() !== 'ready') return '/admin/login'
|
||||
return canAccessAdminRoute(to.path, to.meta.permissionCode as string | undefined) ? true : resolveAdminLandingPath()
|
||||
return canAccessAdminRoute(to.path) ? true : resolveAdminLandingPath()
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user