Browse Source

国际化切换

wangxl@jiinfo.cn 4 weeks ago
parent
commit
d478978207
2 changed files with 13 additions and 15 deletions
  1. 5 5
      src/components/header.vue
  2. 8 10
      src/components/userInfo.vue

+ 5 - 5
src/components/header.vue

@@ -115,20 +115,20 @@ export default {
       mycartShow: localStorage.getItem("cartTap") === "1",
       info: "",
       // locale: this.$util.localeStorage() ? 'English': 'Chinese',
-      locale: this.$util.localeStorage() ? "英文" : "中文",
+      locale: this.$i18n.locale,
       tokenShow: !!localStorage.getItem("token"),
       list: [
         {
           id: 1,
           value: "en",
           // name: 'English'
-          name: "英文"
+          name: "EN"
         },
         {
           id: 2,
           value: "cn",
           // name: 'Chinese'
-          name: "中文"
+          name: "CN"
         }
       ],
       num: JSON.parse(localStorage.getItem("shoppingNum")) // 购物车数量
@@ -163,9 +163,9 @@ export default {
       sessionStorage.removeItem("tdk");
       localStorage.removeItem("token");
       if (e === "en") {
-        window.location.href = "https://crs.sanyoubio.com";
+        window.location.href = "https://bsab.sanyoubio.com";
       } else {
-        window.location.href = "https://crs.sanyoubio.com.cn";
+        window.location.href = "https://bsab.sanyoubio.com.cn";
       }
     },
     signOut() {

+ 8 - 10
src/components/userInfo.vue

@@ -11,7 +11,7 @@
               >{{ $t("homePage.us") }}</router-link
             >
           </p>
-          <!-- <el-row class="block-col-2">
+          <el-row class="block-col-2">
             <el-col>
               <el-select v-model="locale" placeholder="" @change="changeLocale">
                 <el-option
@@ -23,7 +23,7 @@
                 </el-option>
               </el-select>
             </el-col>
-          </el-row> -->
+          </el-row>
         </div>
         <div class="center_landingr">
           <el-row class="block-col-2" v-if="tokenShow">
@@ -107,22 +107,20 @@ export default {
       mycartShow: localStorage.getItem("cartTap") === "1",
       info: "",
       // locale: this.$util.localeStorage() ? 'English': 'Chinese',
-      locale: this.$util.localeStorage()
-        ? this.$t("homePage.English")
-        : this.$t("homePage.Chinese"),
+      locale: this.$i18n.locale,
       tokenShow: !!localStorage.getItem("token"),
       list: [
         {
           id: 1,
           value: "en",
           // name: 'English'
-          name: this.$t("homePage.English")
+          name: "EN"
         },
         {
           id: 2,
           value: "cn",
           // name: 'Chinese'
-          name: this.$t("homePage.Chinese")
+          name: "CN"
         }
       ],
       num: JSON.parse(localStorage.getItem("shoppingNum")) // 购物车数量
@@ -179,10 +177,10 @@ export default {
     changeLocale(e) {
       sessionStorage.removeItem("tdk");
       localStorage.removeItem("token");
-      if (e == "en") {
-        window.location.href = "https://crs.sanyoubio.com";
+      if (e === "en") {
+        window.location.href = "https://bsab.sanyoubio.com";
       } else {
-        window.location.href = "https://crs.sanyoubio.com.cn";
+        window.location.href = "https://bsab.sanyoubio.com.cn";
       }
     },
     signOut() {