|
|
@@ -49,16 +49,16 @@ const checkAccountList = (res) => {
|
|
|
okText: '确定',
|
|
|
onOk: () => {
|
|
|
sessionStorage.setItem('openPasDialog', '1');
|
|
|
- router.replace({ name: 'landing'});
|
|
|
+ router.replace({ name: 'landing' });
|
|
|
}
|
|
|
});
|
|
|
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
|
}, 1000);
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
- router.replace({ name: 'landing'});
|
|
|
+ router.replace({ name: 'landing' });
|
|
|
setTimeout(() => {
|
|
|
loading.value = false;
|
|
|
}, 1000);
|
|
|
@@ -72,24 +72,44 @@ const checkAccountList = (res) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const isTestEnv = () => {
|
|
|
+ const host = window.location.hostname;
|
|
|
+ const port = window.location.port;
|
|
|
+ return host === '61.164.207.46' && (port === '8300' || port === '8900');
|
|
|
+};
|
|
|
+
|
|
|
const getRouteParams = () => {
|
|
|
const cur = router.currentRoute.value || {};
|
|
|
const query = cur.query || {};
|
|
|
let accesstoken = query.accesstoken || '';
|
|
|
let username = query.username || '';
|
|
|
+ let source = query.source || ''; // 新增
|
|
|
|
|
|
if (!accesstoken || !username) {
|
|
|
const hash = window.location.hash || '';
|
|
|
const qIndex = hash.indexOf('?');
|
|
|
if (qIndex !== -1) {
|
|
|
const queryString = hash.slice(qIndex + 1);
|
|
|
- // 规范化:将额外的 '?' 替换为 '&',以兼容错误格式
|
|
|
const normalized = queryString.replace(/\?/g, '&');
|
|
|
const params = new URLSearchParams(normalized);
|
|
|
accesstoken = accesstoken || params.get('accesstoken') || '';
|
|
|
username = username || params.get('username') || '';
|
|
|
+ source = source || params.get('source') || ''; // 新增
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理源头:若存在source则存储,否则根据环境设置默认值
|
|
|
+ if (source) {
|
|
|
+ // 测试环境不允许源头为1,强制转为2
|
|
|
+ if (isTestEnv() && source === '1') {
|
|
|
+ source = '2';
|
|
|
}
|
|
|
+ localStorage.setItem('login_source', source);
|
|
|
+ } else {
|
|
|
+ // 无source时,如果是系统2直接登录,默认源头为2;系统3应重定向到系统2,此处暂不处理(可在路由守卫中补充)
|
|
|
+ // 建议系统3在无token且无source时跳转系统2登录页
|
|
|
}
|
|
|
+
|
|
|
return { accesstoken, username };
|
|
|
};
|
|
|
|
|
|
@@ -128,7 +148,6 @@ const getSourceUrl = () => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
ssoLogin()
|
|
|
- sessionStorage.setItem('sourceUrl', getSourceUrl());
|
|
|
});
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
@@ -140,11 +159,13 @@ onBeforeUnmount(() => {
|
|
|
position: relative;
|
|
|
min-height: 100vh;
|
|
|
}
|
|
|
+
|
|
|
.page-content {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
-/* From Uiverse.io by Praashoo7 */
|
|
|
+
|
|
|
+/* From Uiverse.io by Praashoo7 */
|
|
|
.loader {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
@@ -157,13 +178,15 @@ onBeforeUnmount(() => {
|
|
|
letter-spacing: 0.2em;
|
|
|
margin-bottom: 1em;
|
|
|
}
|
|
|
-.loading-overlay{
|
|
|
- height:100vh;
|
|
|
- width:100vw;
|
|
|
+
|
|
|
+.loading-overlay {
|
|
|
+ height: 100vh;
|
|
|
+ width: 100vw;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
+
|
|
|
.loading {
|
|
|
display: flex;
|
|
|
width: 5em;
|