fix 修改国际化文件名称不规范问题,增加reqeust 国际化配置
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
// translate router.meta.title, be used in breadcrumb sidebar tagsview
|
||||
import i18n from '@/lang/index';
|
||||
|
||||
export const translateRouteTitleI18n = (title: string): string => {
|
||||
// 判断是否存在国际化配置,如果没有原生返回
|
||||
/**
|
||||
* 获取国际化路由,如果不存在则原生返回
|
||||
* @param title 路由名称
|
||||
* @returns {string}
|
||||
*/
|
||||
export const translateRouteTitle = (title: string): string => {
|
||||
const hasKey = i18n.global.te('route.' + title);
|
||||
if (hasKey) {
|
||||
const translatedTitle = i18n.global.t('route.' + title);
|
||||
|
@ -7,14 +7,13 @@ import { HttpStatus } from '@/enums/RespEnum';
|
||||
import { errorCode } from '@/utils/errorCode';
|
||||
import { LoadingInstance } from 'element-plus/es/components/loading/src/loading';
|
||||
import FileSaver from 'file-saver';
|
||||
import { getLanguage } from '@/lang';
|
||||
|
||||
let downloadLoadingInstance: LoadingInstance;
|
||||
// 是否显示重新登录
|
||||
export const isRelogin = { show: false };
|
||||
|
||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||
// 对应国际化资源文件后缀
|
||||
axios.defaults.headers['Content-Language'] = 'zh_CN';
|
||||
// 创建 axios 实例
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
@ -24,6 +23,9 @@ const service = axios.create({
|
||||
// 请求拦截器
|
||||
service.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
// 对应国际化资源文件后缀
|
||||
config.headers['Content-Language'] = getLanguage();
|
||||
|
||||
const isToken = (config.headers || {}).isToken === false;
|
||||
// 是否需要防止数据重复提交
|
||||
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false;
|
||||
|
Reference in New Issue
Block a user