diff --git a/src/router/adminGuard.ts b/src/router/adminGuard.ts index 33909b5..83d1331 100644 --- a/src/router/adminGuard.ts +++ b/src/router/adminGuard.ts @@ -7,15 +7,15 @@ export async function abilityAndNavUpdate(to: any, from: any, next: any) { const ability = useAbilityStore(); const navigation = useNavigationStore(); + let admin = to.meta.admin || false; let type = to.meta.type; let section = to.meta.section; let module = to.meta.module; - navigation.activeNavigation = to.name.split("-")[1]; - navigation.activeLink = to.name.split("-")[2]; - - if (ability.can(type, section, module)) { + if ((admin && ability.isAdmin()) || ability.can(type, section, module)) { NProgress.done(); + navigation.activeNavigation = to.name.split("-")[1]; + navigation.activeLink = to.name.split("-")[2]; next(); } else { NProgress.done(); diff --git a/src/router/index.ts b/src/router/index.ts index b9ac0fd..2dafa06 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -665,6 +665,8 @@ const router = createRouter({ path: "version", name: "admin-user-version", component: () => import("@/views/admin/management/version/VersionDisplay.vue"), + meta: { admin: true }, + beforeEnter: [abilityAndNavUpdate], }, ], },