pull/385/merge
Alliot 2024-04-30 14:40:11 +08:00 committed by GitHub
commit b44d7d63f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -271,18 +271,18 @@ const router = createRouter({
routes,
});
router.beforeEach((to, from, next) => {
router.beforeEach((to) => {
NProgress.start();
const role = localStorage.getItem('vuems_name');
const permiss = usePermissStore();
if (!role && to.meta.noAuth !== true) {
next('/login');
return '/login';
} else if (typeof to.meta.permiss == 'string' && !permiss.key.includes(to.meta.permiss)) {
// 如果没有权限则进入403
next('/403');
return '/403';
} else {
next();
return;
}
});