Przeglądaj źródła

路由规则说明

lifanagju_citu 9 miesięcy temu
rodzic
commit
08c58325e4

+ 4 - 4
src/permission.js

@@ -23,7 +23,7 @@ const { start, done } = useNProgress()
 
 // loginType:1.enterprise: 企业路由
 //            2.personal: 个人路由
-//            3.noLogin: 无需登录也能访问的页面
+//            3.personalCommon: 无需登录也能访问的页面,但登录企业不能访问
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
   start()
@@ -41,14 +41,14 @@ router.beforeEach(async (to, from, next) => {
       // 判断企业路由和个人路由,防止互串
       if (!type) { removeToken(); next(`/login?redirect=${to.fullPath}`) }
       else if (to.meta?.loginType === 'common') next()
-      else if (type === 'enterprise' && to.meta?.loginType === 'noLogin') next({ path: `/${type}` }) // 企业端不能访问个人端路由
-      else if (type === 'personal' && to.meta?.loginType === 'noLogin') next()
+      else if (type === 'enterprise' && to.meta?.loginType === 'personalCommon') next({ path: `/${type}` }) // 企业端不能访问个人端路由
+      else if (type === 'personal' && to.meta?.loginType === 'personalCommon') next()
       else if (to.meta?.loginType === type) next()
       else next({ path: `/${type}` })
       // next()
     }
   } else {
-    if (to.meta?.loginType === 'noLogin' || to.meta?.loginType === 'common') { // 页面不需要登录
+    if (to.meta?.loginType === 'personalCommon' || to.meta?.loginType === 'common') { // 页面不需要登录
       next()
     } else {
       next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页

+ 1 - 1
src/router/modules/recruit.js

@@ -81,7 +81,7 @@ const recruit = [
   }
 ]
 
-setLoginType(recruit, 'noLogin'),
+setLoginType(recruit, 'personalCommon'),
 setLoginType(enterprise, 'enterprise'),
 setLoginType(personal, 'personal')
 

+ 2 - 2
src/router/modules/remaining.js

@@ -43,8 +43,8 @@ const remainingRouter = [
     ]
   },
 ]
-setLoginType(remainingRouter, 'noLogin') // 登录企业端不能noLogin路由
-setLoginType(common, 'common')
+setLoginType(remainingRouter, 'personalCommon') // 暂定:登录企业端不能访问personalCommon路由
+setLoginType(common, 'common') // common 没有身份,任何情况都能访问
 const routeArray = [
   ...remainingRouter,
   ...recruit,