3
李凌
2025-09-08 6cbea7c462cd659a8a3b2c8363def687a740ac19
src/views/my/index.vue
@@ -1,11 +1,17 @@
<template>
  <section class="my-index">
    <fx-header :title="$t('my')">
  <section class="my-index" >
    <!-- <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')
@@ -21,7 +27,7 @@
      <div class="mt-4 flex items-start" v-else>
        <img class="w-24 h-24" src="@/assets/image/avatar.png" alt="avatar" />
        <div class="ml-5 pt-1 flex flex-col justify-center">
          <div class="font-bold text-lg name">{{ userStore.userInfo && userStore.userInfo.username }}</div>
          <div class="font-bold text-lg name" style="width: 200px;overflow-wrap: break-word;">{{ userStore.userInfo && userStore.userInfo.username }}</div>
          <div class="text-sm text-gray-400 mt-5 flex items-center id-text">
            ID:{{ userStore.userInfo && userStore.userInfo.usercode }}<img class="w-8 h-8 ml-4"
              src="@/assets/image/idcopy.png" alt="id" @click="copy" /></div>
@@ -35,6 +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('信用分')}} : {{userdata.creditScore}}</div>
          </div>
        </div>
      </div>
@@ -49,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="">
@@ -107,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";
@@ -120,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: [
    {
@@ -143,13 +152,22 @@
  ]
})
const onRoute = (path) => {
  console.log(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(() => {
@@ -203,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
@@ -285,9 +318,11 @@
  }
  .label_item {
    width: 25%;
    font-size: 14px;
    width: 33%;
    font-size: 12px;
   div{
      text-align: center;
   }
    img {
      width: 32%;
      margin-bottom: 3px;