李凌
2025-09-10 a7d3bc2d58b63c0b0d117aeca38e1e3d3c3d5e38
src/views/my/index.vue
@@ -1,12 +1,20 @@
<template>
  <section class="my-index" >
    <fx-header :title="$t('my')">
      <template v-slot:right>
    <fx-header  :title="$t('my')">
     <!-- <template v-slot:right>
        <van-icon name="service-o" size="24" @click="$router.push('/customerService')"></van-icon>
      </template>
      </template> -->
    </fx-header>
   <!-- <div>
      <assets-head title="">
            <template v-slot:right>
              <van-icon name="service-o" size="24" @click="$router.push('/customerService')"></van-icon>
            </template>
      </assets-head>
   </div> -->
    <div class="px-8 mt-4">
      <h1 class="text-2xl font-bold title" v-if="!(userStore.userInfo && userStore.userInfo.token)">{{
        $t('welcome')
        }}&nbsp;{{ $title }}!
@@ -35,7 +43,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 +58,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 +116,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 +129,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 +154,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 +223,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