mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
fix(系统设置): i18n
--bug=1017678 --user=李玉号 【登录】密码输入错误,提示信息没有汉化 https://www.tapd.cn/55049933/s/1259187
This commit is contained in:
parent
57da59fafa
commit
2989f6edf0
@ -66,6 +66,7 @@ import {useUserStore} from "@/store"
|
||||
import {checkMicroMode, operationConfirm} from "../../utils";
|
||||
import {getModuleList} from "../../api/module";
|
||||
import {getLicense} from "../../api/license";
|
||||
import {setLanguage} from "../../i18n";
|
||||
|
||||
const checkLicense = () => {
|
||||
return getLicense()
|
||||
@ -180,9 +181,9 @@ export default {
|
||||
.catch(data => {
|
||||
// 保存公钥
|
||||
localStorage.setItem("publicKey", data.message);
|
||||
let lang = localStorage.getItem(CURRENT_LANGUAGE);
|
||||
let lang = localStorage.getItem("language");
|
||||
if (lang) {
|
||||
this.$setLang(lang);
|
||||
setLanguage(lang);
|
||||
this.rules = this.getDefaultRules();
|
||||
}
|
||||
});
|
||||
|
@ -18,6 +18,7 @@ import {DEFAULT_LANGUAGE} from '../../utils/constants';
|
||||
import {getCurrentUser} from "../../utils/token";
|
||||
import {useUserStore} from "@/store";
|
||||
import {fullScreenLoading, stopFullScreenLoading} from "../../utils";
|
||||
import {setLanguage} from "../../i18n";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@ -45,7 +46,7 @@ export default {
|
||||
methods: {
|
||||
checkLanguage(lang) {
|
||||
if (!lang) return;
|
||||
this.$setLang(lang);
|
||||
setLanguage(lang);
|
||||
this.language = this.languageMap[lang];
|
||||
},
|
||||
currentUser: () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import VueI18n from "vue-i18n";
|
||||
|
||||
import {request} from "../plugins/request";
|
||||
Vue.use(VueI18n);
|
||||
|
||||
// 直接加载翻译的语言文件
|
||||
@ -43,6 +43,7 @@ const importLanguage = lang => {
|
||||
const setLang = lang => {
|
||||
localStorage.setItem('language', lang)
|
||||
i18n.locale = lang;
|
||||
request.defaults.headers.common['Accept-Language'] = lang.replace("_", "-");
|
||||
}
|
||||
|
||||
export const setLanguage = lang => {
|
||||
@ -51,6 +52,8 @@ export const setLanguage = lang => {
|
||||
}
|
||||
if (i18n.locale !== lang) {
|
||||
importLanguage(lang).then(setLang);
|
||||
} else {
|
||||
setLang(lang);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user