فهرست منبع

企业相关路由都需要登录

lifanagju_citu 11 ماه پیش
والد
کامیت
5966b18288
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      src/permission.js

+ 2 - 2
src/permission.js

@@ -22,7 +22,7 @@ const { start, done } = useNProgress()
 
 // loginType:1.enterprise: 企业路由
 //            2.personal: 个人路由
-//            3.noLogin: 无需登录也能访问的页面(personal里面的一种特殊类型,企业都需要登录)
+//            3.noLogin: 无需登录也能访问的页面(personal里面的一种特殊类型,企业相关路由都需要登录)
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
   start()
@@ -34,7 +34,7 @@ router.beforeEach(async (to, from, next) => {
       const type = localStorage.getItem('loginType')
       // 判断企业路由和个人路由,防止互串
       if (!type) { removeToken(); next(`/login?redirect=${to.fullPath}`) }
-      else if (type === 'personal' && to.meta?.loginType === 'noLogin') next()
+      else if (type === 'enterprise' && to.meta?.loginType === 'noLogin') next({ path: `/${type}` })
       else if (to.meta?.loginType === type) next()
       else next({ path: `/${type}` })
       // next()