From f15ad3456b47e43646234b9c91c3ddd77ab2cd02 Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Wed, 05 Jun 2024 10:05:13 +0800
Subject: [PATCH] 123

---
 src/page/newUser/setting.vue |   66 ++++-----------------------------
 1 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/src/page/newUser/setting.vue b/src/page/newUser/setting.vue
index 3d72f89..47fe543 100644
--- a/src/page/newUser/setting.vue
+++ b/src/page/newUser/setting.vue
@@ -65,25 +65,8 @@
         <div style="margin-right: 10px">{{ language }}</div>
       </div>
     </div>
-    <van-popup
-      v-model="settingDialog"
-      position="bottom"
-      :style="{ height: '35%' }"
-      @close="popClose"
-    >
-      <div
-        class="lang_box"
-        v-for="(item, index) in actions"
-        :key="index"
-        @click="qkclick(item)"
-      >
-        <div
-          :class="$i18n.locale == item.lang ? 'lang_box_txt' : 'lang_box_txta'"
-        >
-          {{ item.text }}
-        </div>
-      </div>
-    </van-popup>
+    <Language ref="language" @onChange="onChange" />
+
     <van-popup v-model="pswDialog" position="bottom" :style="{ height: '40%' }">
       <div class="setting_content">
         <div class="old_password">
@@ -129,6 +112,7 @@
 import { isNull, pwdReg } from "@/utils/utils";
 import { mapMutations } from "vuex";
 import { Notify } from "vant";
+import Language from "@/components/Language/index.vue";
 
 export default {
   name: "newUser",
@@ -144,53 +128,19 @@
       userInfo: [],
       onlineService: "",
       language: "",
-      actions: [
-        {
-          text: "English",
-          icon: require("@/assets/ico/english.png"),
-          lang: "en",
-        },
-        {
-          text: "繁体中文",
-          icon: require("@/assets/ico/tw.png"),
-          lang: "zh-TW",
-        },
-        { text: "हिंदी", icon: require("@/assets/ico/india.png"), lang: "hi" },
-        { text: "한국인", icon: require("@/assets/ico/india.png"), lang: "ko" },
-        {
-          text: "ภาษาไทย",
-          icon: require("@/assets/ico/india.png"),
-          lang: "th",
-        },
-        {
-          text: "日本語にほんご",
-          icon: require("@/assets/ico/india.png"),
-          lang: "ja",
-        },
-      ],
     };
   },
-  components: {},
+  components: { Language },
   created() {
     this.getUserInfo();
-    this.language = window.localStorage.getItem("language") || "zh-CN";
-    let arr = this.actions.filter((item) => item.lang === this.language);
-    this.language = arr[0].text;
   },
   methods: {
     ...mapMutations(["undataToken"]),
-
-    popClose() {
-      this.settingDialog = false;
-    },
-    qkclick(e) {
-      this.settingDialog = false;
-      window.localStorage.setItem("language", e.lang);
-      this.$i18n.locale = e.lang;
-      this.language = e.text;
+    onChange(e) {
+      this.language = e;
     },
     clicklang() {
-      this.settingDialog = true;
+      this.$refs.language.settingDialog = true;
     },
     yebclick() {
       this.$router.push("/yeb");
@@ -235,7 +185,7 @@
       if (data.status === 0) {
         this.onlineService = data.data.onlineService;
       } else {
-        Toast(data.msg);
+        // Toast(data.msg);
       }
     },
     goWall() {

--
Gitblit v1.9.3