|
|
|
@ -9,7 +9,12 @@ import useUserStore from '@/store/modules/user'
|
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
|
import en from "element-plus/lib/locale/lang/en";
|
|
|
|
|
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
|
|
|
|
|
|
|
|
|
let lang = Cookies.get('language') === 'en' ? 'en' : 'zhCn'
|
|
|
|
|
if(lang === 'en'){
|
|
|
|
|
lang = 'en_us'
|
|
|
|
|
}else {
|
|
|
|
|
lang = 'zh_cn'
|
|
|
|
|
}
|
|
|
|
|
let downloadLoadingInstance;
|
|
|
|
|
// 是否显示重新登录
|
|
|
|
|
export let isRelogin = {show: false};
|
|
|
|
@ -36,7 +41,7 @@ service.interceptors.request.use(config => {
|
|
|
|
|
if (config.method === 'get' && (config.params || {})) {
|
|
|
|
|
let url = config.url + '?' + tansParams({
|
|
|
|
|
...(config.params || {}),
|
|
|
|
|
lang: Cookies.get('language') === 'en' ? 'en' : 'zhCn'
|
|
|
|
|
lang
|
|
|
|
|
});
|
|
|
|
|
url = url.slice(0, -1);
|
|
|
|
|
config.params = {};
|
|
|
|
@ -47,10 +52,10 @@ service.interceptors.request.use(config => {
|
|
|
|
|
url: config.url,
|
|
|
|
|
data: typeof config.data === 'object' ? JSON.stringify({
|
|
|
|
|
...config.data,
|
|
|
|
|
lang: Cookies.get('language') === 'en' ? 'en' : 'zhCn'
|
|
|
|
|
lang
|
|
|
|
|
}) : JSON.stringify({
|
|
|
|
|
...JSON.parse(config.data || '{}'),
|
|
|
|
|
lang: Cookies.get('language') === 'en' ? 'en' : 'zhCn'
|
|
|
|
|
lang
|
|
|
|
|
}),
|
|
|
|
|
time: new Date().getTime()
|
|
|
|
|
}
|
|
|
|
|