Browse Source

区分个人登录和企业登录

lifanagju_citu 10 tháng trước cách đây
mục cha
commit
9a8c43ae11
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      src/permission.js

+ 3 - 2
src/permission.js

@@ -1,7 +1,7 @@
 import router from './router'
 import { useNProgress } from '@/hooks/web/useNProgress'
 import { useTitle } from '@/hooks/web/useTitle'
-import { getToken, removeToken } from '@/utils/auth'
+import { getToken, getEnterpriseToken, removeToken } from '@/utils/auth'
 
 const { start, done } = useNProgress()
 // 路由不重定向白名单
@@ -29,7 +29,8 @@ router.beforeEach(async (to, from, next) => {
   // loadStart()
   if (getToken()) {
     if (to.path === '/login') {
-      next({ path: '/' })
+      if (getEnterpriseToken()) next({ path: '/enterprise' }) // 已登录企业
+      else next({ path: '/' }) // 已登录个人账号
     } else {
       const type = localStorage.getItem('loginType')
       // 判断企业路由和个人路由,防止互串