zzzz
2024-04-18 90dcbbc06eb2dce7d6fd6a7923f149f1f35c9361
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
<template>
  <div class="exchangeRate">
    <assets-head :title="$t('汇率设置')" />
    <div v-for="(item, index) in exchangeratelist_get_data" :key="index"
      class="flex justify-between items-center lang-padding font-35 box-border h-127 px-35 " @click="handleSetLang(item)">
      <div class="lang-title flex items-center font-26 textColor">
        <img class="w-55 h-55 mr-24" :src="item.image" alt="">
        {{ item.currency }}
      </div>
 
      <img class="w-40 h-40 lh-40" v-if="item.currency == show_ex" src="../../assets/image/public/checked.png" />
    </div>
  </div>
</template>
<script>
import AxiosexchangeRate from "@/API/exchangeRate";
import assetsHead from "@/components/assets-head";
import { mapActions } from "vuex";
import { SET_CURRENCY } from "@/store/const.store";
 
export default {
  data() {
    return {
      show_ex: {},
      list: [
        { title: 'USD', key: 'USD' },
        { title: 'CNY', key: 'CNY' },
        { title: 'ERU', key: 'ERU' },
        { title: 'JPY', key: 'JPY' }
      ],
      exchangeratelist_get_data: []
    }
  },
  components: {
    assetsHead
  },
  mounted() {
    this.init()
  },
  methods: {
    ...mapActions('home', [SET_CURRENCY]),
    init() {
      this.show_ex = this.$store.state.home.currency.currency
      this.exchangeratelist_get()
    },
    exchangeratelist_get() {
      const t = this
      AxiosexchangeRate.exchangeratelist({}).then((res) => {
        console.log(res.data)
        t.exchangeratelist_get_data = res.data
        t.exchangeratelist_get_data.forEach((item) => {
          item.image = require('../../assets/image/exchange-rate/' + item.currency + '.png')
        })
      })
    },
    handleSetLang(e) {
      // console.log(t.$store.state.exchangeRate.exchangeRate)
      const t = this
      AxiosexchangeRate.exchangerateuserconfig({ rateId: e.id }).then((res) => {
        if (res.code == 0) {
          // t.$store.commit('setExchangeRate',e)
          this.SET_CURRENCY()
          t.show_ex = e.currency
        }
 
      })
 
    },
    onClickLeft() {
      this.$router.go(-1)
      console.log(this.$i18n.locale)
    },
  }
}
</script>
<style lang="scss" scoped>
.exchangeRate {
  width: 100%;
  box-sizing: border-box;
}
 
.lang-padding {
  @include themify() {
    border-bottom: 1px solid themed("line_color");
  }
 
  font-weight: 400;
  color: #000000;
}
</style>