|
@@ -5,22 +5,6 @@ import { getToken, getEnterpriseToken, removeToken } from '@/utils/auth'
|
|
|
import { useDictStore } from '@/store/dict'
|
|
|
|
|
|
const { start, done } = useNProgress()
|
|
|
-// 路由不重定向白名单
|
|
|
-// const whiteList = [
|
|
|
-// '/',
|
|
|
-// '/home',
|
|
|
-// '/login',
|
|
|
-// '/social-login',
|
|
|
-// '/auth-redirect',
|
|
|
-// '/bind',
|
|
|
-// '/register',
|
|
|
-// '/privacyPolicy',
|
|
|
-// '/userAgreement',
|
|
|
-// '/recruit/company',
|
|
|
-// '/recruit/personal/position',
|
|
|
-// '/recruit/personal/position/details',
|
|
|
-// ]
|
|
|
-
|
|
|
// loginType:1.enterprise: 企业路由
|
|
|
// 2.personal: 个人路由
|
|
|
// 3.personalCommon: 无需登录也能访问的页面,但登录企业不能访问
|
|
@@ -41,14 +25,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 === 'personalCommon') next({ path: `/${type}` }) // 企业端不能访问个人端路由
|
|
|
+ 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 === 'personalCommon' || to.meta?.loginType === 'common') { // 页面不需要登录
|
|
|
+ if (to.meta?.loginType === 'personalCommon' || to.meta?.loginType === 'common') { // 路由不重定向
|
|
|
next()
|
|
|
} else {
|
|
|
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|