|
@@ -15,7 +15,7 @@ import { OAUTH2_THIRD_LOGIN_TENANT_ID } from '/@/enums/cacheEnum';
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
import { useGlobSetting } from '/@/hooks/setting';
|
|
|
|
|
|
import _ from 'lodash';
|
|
import _ from 'lodash';
|
|
-import { AUTO_LOGIN_URL_QUERY, SKIP_SSO_URL_QUERY } from '../constant';
|
|
|
|
|
|
+import { MOCK_LOGIN_URL_QUERY, SKIP_SSO_URL_QUERY } from '../constant';
|
|
import { useSso } from '/@/hooks/web/useSso';
|
|
import { useSso } from '/@/hooks/web/useSso';
|
|
import { useAutoLogin } from '/@/hooks/vent/useAutoLogin';
|
|
import { useAutoLogin } from '/@/hooks/vent/useAutoLogin';
|
|
|
|
|
|
@@ -67,6 +67,12 @@ export function createPermissionGuard(router: Router) {
|
|
// 自动登录后会动态添加路由,此处应当重定向到fullPath,否则会加载404页面内容
|
|
// 自动登录后会动态添加路由,此处应当重定向到fullPath,否则会加载404页面内容
|
|
return next({ path: to.fullPath, replace: true, query: to.query });
|
|
return next({ path: to.fullPath, replace: true, query: to.query });
|
|
}
|
|
}
|
|
|
|
+ // 如果指定了需要模拟登录则执行模拟登录,覆盖原有的登录信息
|
|
|
|
+ if (to.query[MOCK_LOGIN_URL_QUERY.key] === MOCK_LOGIN_URL_QUERY.val) {
|
|
|
|
+ await userStore.mockLogin({ goHome: false });
|
|
|
|
+ delete to.query[MOCK_LOGIN_URL_QUERY.key];
|
|
|
|
+ return next({ path: to.fullPath, replace: true, query: to.query });
|
|
|
|
+ }
|
|
|
|
|
|
const token = userStore.getToken;
|
|
const token = userStore.getToken;
|
|
|
|
|