Selaa lähdekoodia

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 9 kuukautta sitten
vanhempi
commit
f4f86c3ffe
2 muutettua tiedostoa jossa 10 lisäystä ja 3 poistoa
  1. 2 2
      src/permission.js
  2. 8 1
      src/utils/auth.js

+ 2 - 2
src/permission.js

@@ -12,14 +12,14 @@ const { start, done } = useNProgress()
 //            3.personalCommon: 无需登录也能访问的页面
 // 路由守卫
 router.beforeEach(async (to, from, next) => {
+  localStorage.setItem('routerTest', to.path) // 本地环境保存代码热更新会导致路径缺失问题
   start()
   // loadStart()
   if (to.path === '/enterpriseVerification') {
     // 校验企业必填信息
     useUserStore().checkEnterpriseBaseInfo()
     next()
-  }
-  if (getToken(to?.meta?.loginType === 'enterprise' ? 1 : 0)) {
+  } else if (getToken()) {
     if (to.path === '/login') {
       next({ path: '/recruitHome' })
     } else {

+ 8 - 1
src/utils/auth.js

@@ -2,8 +2,15 @@ import router from '@/router'
 
 const isEnterprise = () => {
   const currentRoute = router.currentRoute.value
-  let bool = currentRoute?.meta?.loginType === 'enterprise'
+  const substr = '/recruit/enterprise'
+
+  // 判断是否是企业路由
+  let bool = currentRoute?.path?.includes(substr)
   if (currentRoute?.path === '/enterpriseVerification') bool = true
+
+  // 本地环境保存代码热更新会导致路径缺失问题
+  const testUsePath = localStorage.getItem('routerTest')
+  if (currentRoute?.path === '/' && testUsePath?.includes(substr)) bool = true
   return bool
 }