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