|
@@ -9,20 +9,6 @@ import { LoadingInstance } from 'element-plus/es/components/loading/src/loading'
|
|
|
import FileSaver from 'file-saver';
|
|
import FileSaver from 'file-saver';
|
|
|
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
|
|
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
|
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt';
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt';
|
|
|
-import { onPath, DOMAIN_MAP } from '@/utils/siteConfig';
|
|
|
|
|
-import router from '@/router';
|
|
|
|
|
-
|
|
|
|
|
-// 获取主站完整 URL(用于跨域跳转)
|
|
|
|
|
-function getMainSiteUrl(path: string) {
|
|
|
|
|
- const mainDomain = DOMAIN_MAP.www;
|
|
|
|
|
- if (import.meta.env.PROD) {
|
|
|
|
|
- return `https://${mainDomain}${path}`;
|
|
|
|
|
- } else {
|
|
|
|
|
- // 本地开发:指向主站域名加上当前运行的端口
|
|
|
|
|
- const devPort = window.location.port || import.meta.env.VITE_APP_PORT;
|
|
|
|
|
- return `https://${mainDomain}:${devPort}${path}`;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
const encryptHeader = 'encrypt-key';
|
|
const encryptHeader = 'encrypt-key';
|
|
|
let downloadLoadingInstance: LoadingInstance;
|
|
let downloadLoadingInstance: LoadingInstance;
|
|
@@ -150,11 +136,15 @@ service.interceptors.response.use(
|
|
|
useUserStore()
|
|
useUserStore()
|
|
|
.logout()
|
|
.logout()
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- if (import.meta.env.VITE_DOMAIN_NAME == 'true') {
|
|
|
|
|
- window.location.href = getMainSiteUrl('/login');
|
|
|
|
|
|
|
+ let url = `https://${import.meta.env.VITE_DOMAIN_PASSPORT}`;
|
|
|
|
|
+
|
|
|
|
|
+ if (import.meta.env.PROD) {
|
|
|
|
|
+ url = `${url}/login`;
|
|
|
} else {
|
|
} else {
|
|
|
- router.push('/login');
|
|
|
|
|
|
|
+ const devPort = window.location.port || import.meta.env.VITE_APP_PORT;
|
|
|
|
|
+ url = `${url}:${devPort}/login`;
|
|
|
}
|
|
}
|
|
|
|
|
+ window.location.href = url;
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
.catch(() => {
|
|
.catch(() => {
|
|
@@ -162,41 +152,6 @@ service.interceptors.response.use(
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
|
|
-
|
|
|
|
|
- // prettier-ignore
|
|
|
|
|
- // if (!isRelogin.show) {
|
|
|
|
|
- // isRelogin.show = true;
|
|
|
|
|
- // useUserStore().logout().then(() => {
|
|
|
|
|
- // window.location.href = getMainSiteUrl('/index');
|
|
|
|
|
- // });
|
|
|
|
|
-
|
|
|
|
|
- // ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
|
|
|
|
- // confirmButtonText: '重新登录',
|
|
|
|
|
- // cancelButtonText: '取消',
|
|
|
|
|
- // type: 'warning'
|
|
|
|
|
- // }).then(() => {
|
|
|
|
|
- // isRelogin.show = false;
|
|
|
|
|
- // useUserStore().logout().then(() => {
|
|
|
|
|
- // router.replace({
|
|
|
|
|
- // path: '/login',
|
|
|
|
|
- // query: {
|
|
|
|
|
- // redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
- // });
|
|
|
|
|
- // }).catch(() => {
|
|
|
|
|
- // isRelogin.show = false;
|
|
|
|
|
- // });
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- // useUserStore().logout().then(() => {
|
|
|
|
|
- // if (import.meta.env.VITE_DOMAIN_NAME == 'true') {
|
|
|
|
|
- // window.location.href = getMainSiteUrl('/login');
|
|
|
|
|
- // }else{
|
|
|
|
|
- // router.push('/login');
|
|
|
|
|
- // }
|
|
|
|
|
- // });
|
|
|
|
|
- // return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
|
|
|
|
|
} else if (code === HttpStatus.SERVER_ERROR) {
|
|
} else if (code === HttpStatus.SERVER_ERROR) {
|
|
|
ElMessage({ message: msg, type: 'error' });
|
|
ElMessage({ message: msg, type: 'error' });
|
|
|
// return Promise.reject(new Error(msg));
|
|
// return Promise.reject(new Error(msg));
|