1
jhzh
2025-08-18 401c2caeedb8952ca5f792381fff9fc9b83f663d
src/views/my/index.vue
@@ -1,11 +1,17 @@
<template>
  <section class="my-index" >
    <fx-header :title="$t('my')">
    <!-- <fx-header :back="false" :title="$t('my')">
      <template v-slot:right>
        <van-icon name="service-o" size="24" @click="$router.push('/customerService')"></van-icon>
      </template>
    </fx-header>
    </fx-header> -->
   <assets-head title="">
      <!-- <img src="../../../assets/image/assets-center/exchange.png" alt="exchange-img" class="w-44 h-38"
         @click="goRouter('/customerService')" /> -->
         <template v-slot:right>
           <van-icon name="service-o" size="24" @click="$router.push('/customerService')"></van-icon>
         </template>
   </assets-head>
    <div class="px-8 mt-4">
      <h1 class="text-2xl font-bold title" v-if="!(userStore.userInfo && userStore.userInfo.token)">{{
        $t('welcome')
@@ -35,7 +41,7 @@
            <div class="label pl-2 pr-2 ml-3" :class="{ 'green': kycHighStatus == 2 }">
              {{ kycHighStatus == 2 ? $t('高级用户') : $t('普通用户') }}
            </div>
         <div class="pl-2 pr-2 ml-3" style="font-size: 12px;">{{$t('信用分')}} : {{userStore.userInfo.creditScore}}</div>
         <div class="pl-2 pr-2 ml-3" style="font-size: 12px;">{{$t('信用分')}} : {{userdata.creditScore}}</div>
          </div>
        </div>
      </div>
@@ -50,10 +56,10 @@
            <img src="@/assets/imgs/my/安全.png" alt="">
            <div>{{ t('安全') }}</div>
          </div>
          <div class="label_item flex flex-col items-center justify-center mt-8" @click="onRoute('/changePassword')">
<!--          <div class="label_item flex flex-col items-center justify-center mt-8" @click="onRoute('/changePassword')">
            <img src="@/assets/imgs/my/密码.png" alt="">
            <div>{{ t('修改密码') }}</div>
          </div>
          </div> -->
          <div class="label_item flex flex-col items-center justify-center mt-8"
            @click="onRoute('/cryptos/accountChange')">
            <img src="@/assets/imgs/my/记录.png" alt="">
@@ -108,7 +114,7 @@
<script setup>
import { reactive, onMounted, ref, computed } from 'vue';
import { useRouter } from 'vue-router';
import { _getIdentify, _getKycHighLevel, _logOut } from "@/service/user.api.js";
import { _getIdentify, _getKycHighLevel, _logOut,_info ,_customer } from "@/service/user.api.js";
import { useUserStore } from '@/store/user';
import { useI18n } from "vue-i18n";
import useClipboard from "vue-clipboard3";
@@ -121,8 +127,10 @@
const router = useRouter()
const userStore = useUserStore()
const customer_service_url = ref(null)
const status = ref(null)
const kycHighStatus = ref(null)
const userdata = ref({})
const state = reactive({
  cellList: [
    {
@@ -144,19 +152,22 @@
  ]
})
const onRoute = (path) => {
  console.log(path)
  // if(path=='/login'){
    //  console.log(status.value);
    //  // router.$refs.app.loginButton();
  // }else{
    //  router.push(path)
  // }
  router.push(path)
  if(path=='/customerService'){
     if(customer_service_url.value){
        window.location.href = customer_service_url.value;
     }else{
        router.push(path)
     }
  }else{
     router.push(path)
  }
}
onMounted(() => {
  if (userStore.userInfo && userStore.userInfo.token) {
    getIdentify()
    getKycHighLevel()
   getinfo()
   getcustomer()
  }
})
const cellList = computed(() => {
@@ -210,6 +221,21 @@
    store.state.user.userInfo = {}
  })
}
const getcustomer = () => {
  _customer().then((data) => {
   customer_service_url.value = data.customer_service_url
   console.log(customer_service_url);
  }).catch(error => {
    console.error('Error fetching data:', error);
  });
};
const getinfo = () => {
  _info().then((data) => {
    userdata.value = data;  // 确保 userdata 被正确声明
  }).catch(error => {
    console.error('Error fetching data:', error);
  });
};
const getIdentify = () => {
  _getIdentify().then(data => {
    status.value = data.status