|
|
@@ -1,16 +1,16 @@
|
|
|
import router from './router'
|
|
|
import type { RouteRecordRaw } from 'vue-router'
|
|
|
import { isRelogin } from '@/config/axios/service'
|
|
|
-import {getAccessToken} from '@/utils/auth'
|
|
|
+import { getAccessToken } from '@/utils/auth'
|
|
|
import { useTitle } from '@/hooks/web/useTitle'
|
|
|
import { useNProgress } from '@/hooks/web/useNProgress'
|
|
|
import { usePageLoading } from '@/hooks/web/usePageLoading'
|
|
|
import { useDictStoreWithOut } from '@/store/modules/dict'
|
|
|
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 * as LoginApi from '@/api/login'
|
|
|
+import * as authUtil from '@/utils/auth'
|
|
|
+import { he } from 'element-plus/es/locale'
|
|
|
|
|
|
const { start, done } = useNProgress()
|
|
|
|
|
|
@@ -116,16 +116,24 @@ router.beforeEach(async (to, from, next) => {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (whiteList.indexOf(to.path) !== -1) {
|
|
|
- const code = to.query.code;
|
|
|
+ if (to.fullPath.includes('sso') && to.fullPath.includes('username')) {
|
|
|
+ const res = await LoginApi.portalLogin({
|
|
|
+ username: to.query.username
|
|
|
+ })
|
|
|
+
|
|
|
+ authUtil.setToken(res)
|
|
|
+ await getTenantId()
|
|
|
+ next({ path: 'index' })
|
|
|
+ } else if (whiteList.indexOf(to.path) !== -1) {
|
|
|
+ const code = to.query.code
|
|
|
if (code) {
|
|
|
debugger
|
|
|
await getTenantId()
|
|
|
- const res = await LoginApi.socialLogin('20', typeof code === "string" ? code :"", '22')
|
|
|
+ const res = await LoginApi.socialLogin('20', typeof code === 'string' ? code : '', '22')
|
|
|
authUtil.setToken(res)
|
|
|
- next({ path: 'index' });
|
|
|
+ next({ path: 'index' })
|
|
|
} else {
|
|
|
- next(); // 正常导航
|
|
|
+ next() // 正常导航
|
|
|
}
|
|
|
// next()
|
|
|
} else {
|