新币+dapp app 前端
dengchaochao
2024-05-09 8b77b71e449f578c4154d5b62365a0dbbf123418
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
  <div class="lang">
    <assets-head :title="$t('语言设置')" />
    <div
      v-for="(item, index) in lang"
      :key="index"
      class="lang-padding"
      @click="handleSetLang(item.key)"
    >
      <div class="lang-title flex items-center font-26 textColor">
        <img class="w-75 h-50 mr-24" :src="item.image" alt="" />
        {{ item.title }}
      </div>
      <div class="lang-flex"></div>
      <img
        v-if="item.key == $i18n.locale"
        src="../../assets/image/public/checked.png"
        style="width: 20px; height: 20px"
      />
    </div>
  </div>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import assetsHead from "@/components/assets-head";
import { setStorage } from "@/utils/utis";
export default {
  data() {
    return {
      lang: [
        {
          title: "繁體中文",
          key: "CN",
          image: require("../../assets/image/lang/hongkong.jpg"),
        },
        {
          title: "简体中文",
          key: "zh-CN",
          image: require("../../assets/image/lang/zh-CN.png"),
        },
        {
          title: "English",
          key: "en",
          image: require("../../assets/image/lang/en-US.png"),
        }, //英语
        {
          title: "한국인",
          key: "Korean",
          image: require("../../assets/image/lang/Korean.png"),
        }, //韩语
        {
          title: "Deutsch",
          key: "de",
          image: require("../../assets/image/lang/de.png"),
        }, //德语
        {
          title: "Français",
          key: "fr",
          image: require("../../assets/image/lang/French.png"),
        }, //法语
        {
          title: "やまと",
          key: "Japanese",
          image: require("../../assets/image/lang/Japanese.png"),
        }, //日语
        {
          title: "ไทย",
          key: "th",
          image: require("../../assets/image/lang/Thai.png"),
        }, //泰语
        // { title: 'español', key: 'es', image: require('../../assets/image/lang/Spanish.png') }, //西班牙
        // { title: 'عرب', key: 'ar', image: require('../../assets/image/lang/alb.png') }, //阿拉伯语
        {
          title: "Tiếng Việt",
          key: "vi",
          image: require("../../assets/image/lang/vi.png"),
        }, //越南语
        {
          title: "Italiano",
          key: "Italy",
          image: require("../../assets/image/lang/Italy.png"),
        }, //意大利语
      ],
    };
  },
  components: {
    assetsHead,
  },
  computed: {
    ...mapGetters({
      activeLang: "language",
    }),
  },
  methods: {
    ...mapMutations("language", ["setLanguage"]),
    handleSetLang(lang) {
      // 设置i18n.locale 组件库会按照上面的配置使用对应的文案文件
      this.$i18n.locale = lang;
      // 提交mutations
      this.setLanguage(lang);
      setStorage("popNotice", false);
    },
    onClickLeft() {
      this.$router.push("/");
      console.log(this.$i18n.locale);
    },
  },
};
</script>
<style lang="scss" scoped>
.lang {
  width: 100%;
  box-sizing: border-box;
}
 
.CommonProblem-padding {
  padding-left: 50px;
  padding-right: 50px;
}
 
.lang-padding {
  padding: 43px 35px 43px 35px;
  box-sizing: border-box;
 
  @include themify() {
    border-bottom: 1px solid themed("line_color");
  }
 
  font-weight: 400;
  font-size: 35px;
  color: #000000;
  display: flex;
}
 
.lang-flex {
  flex: 1;
}
</style>