|
|
@@ -10,7 +10,8 @@ import { useUserStoreWithOut } from '@/store/modules/user'
|
|
|
import { usePermissionStoreWithOut } from '@/store/modules/permission'
|
|
|
import * as LoginApi from '@/api/login'
|
|
|
import * as authUtil from '@/utils/auth'
|
|
|
-import { he } from 'element-plus/es/locale'
|
|
|
+import { CACHE_KEY, useCache, deleteUserCache } from '@/hooks/web/useCache'
|
|
|
+import { de } from 'element-plus/es/locale'
|
|
|
|
|
|
const { start, done } = useNProgress()
|
|
|
|
|
|
@@ -87,6 +88,18 @@ router.beforeEach(async (to, from, next) => {
|
|
|
if (getAccessToken()) {
|
|
|
if (to.path === '/login') {
|
|
|
next({ path: '/' })
|
|
|
+ } else if (to.fullPath.includes('portalLogin')) {
|
|
|
+ // authUtil.removeToken()
|
|
|
+ // deleteUserCache()
|
|
|
+ const userStore = useUserStoreWithOut()
|
|
|
+ await userStore.loginOut()
|
|
|
+ await getTenantId()
|
|
|
+ const res = await LoginApi.portalLogin({
|
|
|
+ username: to.query.username
|
|
|
+ })
|
|
|
+
|
|
|
+ authUtil.setToken(res)
|
|
|
+ next({ path: '/' })
|
|
|
} else {
|
|
|
// 获取所有字典
|
|
|
const dictStore = useDictStoreWithOut()
|
|
|
@@ -124,7 +137,7 @@ router.beforeEach(async (to, from, next) => {
|
|
|
|
|
|
authUtil.setToken(res)
|
|
|
|
|
|
- next({ path: '/' })
|
|
|
+ next({ path: '/index' })
|
|
|
} else if (whiteList.indexOf(to.path) !== -1) {
|
|
|
const code = to.query.code
|
|
|
if (code) {
|