|
|
@@ -133,9 +133,6 @@
|
|
|
<script>
|
|
|
import md5 from "js-md5";
|
|
|
import Vue from "vue";
|
|
|
-import zhLocale from "element-ui/lib/locale/lang/zh-CN";
|
|
|
-import enLocale from "element-ui/lib/locale/lang/en";
|
|
|
-import ruLocale from "element-ui/lib/locale/lang/ru-RU";
|
|
|
import store from "@/store";
|
|
|
|
|
|
export default {
|
|
|
@@ -165,6 +162,7 @@ export default {
|
|
|
count: 0,
|
|
|
langusge: [],
|
|
|
nowType: "ZH",
|
|
|
+ languagename: "简体中文",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -340,47 +338,22 @@ export default {
|
|
|
id: 10026401,
|
|
|
});
|
|
|
this.langusge = res.data;
|
|
|
- this.nowType = sessionStorage.getItem("lang") && sessionStorage.getItem("lang") !== null
|
|
|
- ? sessionStorage.getItem("lang")
|
|
|
- : "ZH";
|
|
|
- sessionStorage.setItem('lang',this.nowType)
|
|
|
- this.qusetLanguage()
|
|
|
+ console.log("langusge", this.langusge);
|
|
|
+ this.nowType =
|
|
|
+ localStorage.getItem("lang") && localStorage.getItem("lang") !== null
|
|
|
+ ? localStorage.getItem("lang")
|
|
|
+ : "ZH";
|
|
|
+ this.languagename =
|
|
|
+ this.langusge.find((v) => v.languagecode == this.nowType)
|
|
|
+ .languagename || "简体中文";
|
|
|
},
|
|
|
async i18nChangeLanguage(type) {
|
|
|
- console.log(type, "type翻译");
|
|
|
- sessionStorage.setItem("lang", type);
|
|
|
- location.reload();
|
|
|
- /* await this.basicData.query_userauth()
|
|
|
- this.$router.go(0)*/
|
|
|
- },
|
|
|
-
|
|
|
- async qusetLanguage() {
|
|
|
- this.nowType = sessionStorage.getItem("lang");
|
|
|
- const res = await this.$api.requested({
|
|
|
- id: 2024062809072801,
|
|
|
- content: {
|
|
|
- languagecode: this.nowType,
|
|
|
- },
|
|
|
+ this.nowType = type;
|
|
|
+ localStorage.setItem("lang", type);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$i18n.locale = type;
|
|
|
+ location.reload();
|
|
|
});
|
|
|
- switch (this.nowType) {
|
|
|
- case "EN":
|
|
|
- Vue.config.lang = "en";
|
|
|
- Vue.locale("en", Object.assign(enLocale, res.data.EN));
|
|
|
- break;
|
|
|
- case "RU":
|
|
|
- Vue.config.lang = "ru-RU";
|
|
|
- Vue.locale("ru-RU", Object.assign(ruLocale, res.data.RU));
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- Vue.config.lang = "zh-cn";
|
|
|
- Vue.locale("zh-cn", Object.assign(zhLocale));
|
|
|
- break;
|
|
|
- }
|
|
|
- this.languagename = this.langusge.filter(
|
|
|
- (e) => e.languagecode == this.nowType
|
|
|
- )[0].languagename;
|
|
|
- this.setRules();
|
|
|
},
|
|
|
},
|
|
|
};
|