|
@@ -15,7 +15,8 @@ import { OAUTH2_THIRD_LOGIN_TENANT_ID } from '/@/enums/cacheEnum';
|
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
|
|
|
|
import _ from 'lodash';
|
|
|
-import { AUTO_LOGIN_URL_QUERY } from '../constant';
|
|
|
+import { AUTO_LOGIN_URL_QUERY, SKIP_SSO_URL_QUERY } from '../constant';
|
|
|
+import { useSso } from '/@/hooks/web/useSso';
|
|
|
|
|
|
const LOGIN_PATH = PageEnum.BASE_LOGIN;
|
|
|
//auth2登录路由
|
|
@@ -82,17 +83,19 @@ export function createPermissionGuard(router: Router) {
|
|
|
//退出登录进入此逻辑
|
|
|
//如果进入的页面是login页面并且当前是OAuth2app环境,并且token为空,就进入OAuth2登录页面
|
|
|
//update-begin---author:wangshuai ---date:20230224 for:[QQYUN-3440]新建企业微信和钉钉配置表,通过租户模式隔离------------
|
|
|
- if (to.query.tenantId) {
|
|
|
- setAuthCache(OAUTH2_THIRD_LOGIN_TENANT_ID, to.query.tenantId);
|
|
|
- }
|
|
|
+ // if (to.query.tenantId) {
|
|
|
+ // setAuthCache(OAUTH2_THIRD_LOGIN_TENANT_ID, to.query.tenantId);
|
|
|
+ // }
|
|
|
next({ path: OAUTH2_LOGIN_PAGE_PATH });
|
|
|
document.title = '登录';
|
|
|
+ ///
|
|
|
+
|
|
|
//update-end---author:wangshuai ---date:20230224 for:[QQYUN-3440]新建企业微信和钉钉配置表,通过租户模式隔离------------
|
|
|
return;
|
|
|
//update-end---author:wangshuai ---date:20220629 for:[issues/I5BG1I]vue3不支持auth2登录------------
|
|
|
}
|
|
|
- // mountMicroApp(to.path);
|
|
|
next();
|
|
|
+
|
|
|
document.title = to.meta.title;
|
|
|
return;
|
|
|
}
|
|
@@ -101,12 +104,17 @@ export function createPermissionGuard(router: Router) {
|
|
|
if (!token) {
|
|
|
// You can access without permission. You need to set the routing meta.ignoreAuth to true
|
|
|
if (to.meta.ignoreAuth) {
|
|
|
- // mountMicroApp(to.path);
|
|
|
next();
|
|
|
document.title = to.meta.title;
|
|
|
return;
|
|
|
}
|
|
|
- // query中要求自动登录的执行登录逻辑
|
|
|
+ // query如果没有明确要求跳过sso则执行sso登录
|
|
|
+ if (to.query[SKIP_SSO_URL_QUERY.key] !== SKIP_SSO_URL_QUERY.val) {
|
|
|
+ const redirectSso = await useSso().ssoLogin();
|
|
|
+ // 如果需要重定向到sso页面则取消路由导航
|
|
|
+ if (redirectSso) return;
|
|
|
+ }
|
|
|
+ // query中要求自动登录的执行自动登录
|
|
|
if (to.query[AUTO_LOGIN_URL_QUERY.key] === AUTO_LOGIN_URL_QUERY.val) {
|
|
|
const userStore = useUserStoreWithOut();
|
|
|
await userStore.autoLogin({
|