1.优化后台页面样式
2.优化统一订单中红利的状态和失败原因 3.移除项目中冗余代码和字段
This commit is contained in:
@@ -12,6 +12,26 @@ import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
|
||||
import { useUserInfo } from '/@/stores/userInfo'
|
||||
import { isAdminApp } from '/@/utils/common'
|
||||
|
||||
/** 与后台 LoadLangPack 一致:优先与当前 i18n 语言对齐,再回落到 config */
|
||||
function resolveAdminThinkLang(): string {
|
||||
const cfg = useConfig()
|
||||
try {
|
||||
const loc = i18n?.global?.locale?.value
|
||||
if (loc !== undefined && loc !== null && loc !== '') {
|
||||
const v = String(loc).toLowerCase().replace('_', '-')
|
||||
if (v === 'zh-cn' || v === 'zh') {
|
||||
return 'zh-cn'
|
||||
}
|
||||
if (v === 'en') {
|
||||
return 'en'
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// i18n 未就绪时忽略
|
||||
}
|
||||
return cfg.lang.defaultLang
|
||||
}
|
||||
|
||||
window.requests = []
|
||||
window.tokenRefreshing = false
|
||||
const pendingMap = new Map()
|
||||
@@ -50,7 +70,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
baseURL: getUrl(),
|
||||
timeout: 1000 * 10,
|
||||
headers: {
|
||||
'think-lang': config.lang.defaultLang,
|
||||
'think-lang': resolveAdminThinkLang(),
|
||||
},
|
||||
responseType: 'json',
|
||||
})
|
||||
@@ -93,7 +113,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
if (token) (config.headers as anyObj).batoken = token
|
||||
const userToken = options.anotherToken || userInfo.getToken()
|
||||
if (userToken) (config.headers as anyObj)['ba-user-token'] = userToken
|
||||
;(config.headers as anyObj)['think-lang'] = useConfig().lang.defaultLang
|
||||
;(config.headers as anyObj)['think-lang'] = resolveAdminThinkLang()
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user