From c6ccd498aa419327de7c64e03f989964eeb5d278 Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 16 Jul 2025 16:26:11 +0800
Subject: [PATCH] 退出二次确认

---
 src/views/my/newindex.vue |  112 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 65 insertions(+), 47 deletions(-)

diff --git a/src/views/my/newindex.vue b/src/views/my/newindex.vue
index 3f3dbe9..bdadfab 100644
--- a/src/views/my/newindex.vue
+++ b/src/views/my/newindex.vue
@@ -2,31 +2,30 @@
   <div class="pb-30">
     <!-- 顶部用户信息卡片 -->
     <div class="mt-20 mx-17 pt-24 px-14 flex h-120 box-border bgimg">
-      <div class="w-65 h-65 rounded-full"></div>
+      <div class="w-50 h-50 rounded-full">
+        <van-icon name="contact" size="50" color="#fff" />
+        <!-- <img :src="userStore.userInfo.avatar" alt=""> -->
+      </div>
       <div class="text-white flex-1 ml-9">
-        <div class="text-19 font-bold">{{userStore.userInfo.username}}</div>
+        <div class="text-24 font-bold">{{ userStore.userInfo.username }}</div>
         <div class="flex">
-          <div class="text-10">ID: {{userStore.userInfo.usercode}}</div>
+          <div class="text-14">ID: {{ userStore.userInfo.usercode }}</div>
         </div>
-        <div class="text-10 block">信用分: 100</div>
+        <!-- <div class="text-10 block">信用分: 100</div> -->
       </div>
     </div>
 
     <!-- 账户详情部分 -->
     <div class="mt-20 px-17">
-      <div class="text-22 font-medium">帳戶詳情</div>
+      <div class="text-22 font-medium">{{ t('账号') }} {{ t('详情') }}</div>
       <div class="mt-15 p-15 rounded-15 bg-#f5f7f9">
-        <div 
-          v-for="(item, index) in accountItems" 
-          :key="index"
-          class="flex items-center justify-between"
-          :class="{'mt-15': index > 0}"
-        >
-          <div class="flex items-center" @click="onRoute(item.path)">
-            <img :src="`/static/img/${item.icon}`" class="w-20 h-20">
+        <div v-for="(item, index) in accountItems" :key="index" class="flex items-center justify-between text-16"
+          :class="{ 'mt-15': index > 0 }" @click="onRoute(item.path)">
+          <div class="flex items-center">
+            <img :src="`${item.icon}`" class="w-20 h-20">
             <div class="ml-10">{{ item.title }}</div>
           </div>
-          <div v-if="item.status" class="text-gray-400 text-12 py-5">
+          <div v-if="item.status" class="text-gray-400 text-14 py-5">
             {{ item.status }}
           </div>
           <div v-else class="i-material-symbols:arrow-right-rounded text-20 text-gray-400">
@@ -36,28 +35,24 @@
       </div>
     </div>
 
-     <!-- 帮助和支持部分 -->
-     <div class="mt-20 px-17">
-      <div class="text-22 font-medium">幫助和支持</div>
+    <!-- 帮助和支持部分 -->
+    <div class="mt-20 px-17">
+      <div class="text-22 font-medium">{{ t('帮助') }}</div>
       <div class="mt-15 p-15 rounded-15 bg-#f5f7f9">
-        <div 
-          v-for="(item, index) in helpItems" 
-          :key="index"
-          class="flex items-center justify-between"
-          :class="{'mt-15': index > 0}"
-        >
-          <div v-if="item.button" class="flex items-center" @click="loginOut">
-            <img :src="`/static/img/${item.icon}`" class="w-20 h-20">
+        <div v-for="(item, index) in helpItems" :key="index" class="flex items-center justify-between text-16"
+          :class="{ 'mt-15': index > 0 }" @click="onRoute(item.path)">
+          <div v-if="item.button" class="flex items-center" @click.stop="loginOut">
+            <img :src="`${item.icon}`" class="w-20 h-20">
             <div class="ml-10">{{ item.title }}</div>
           </div>
-          <div v-else class="flex items-center" @click="onRoute(item.path)">
-            <img :src="`/static/img/${item.icon}`" class="w-20 h-20">
+          <div v-else class="flex items-center">
+            <img :src="`${item.icon}`" class="w-20 h-20">
             <div class="ml-10">{{ item.title }}</div>
           </div>
           <div class="i-material-symbols:arrow-right-rounded text-20 text-gray-400">
             <!---->
           </div>
-          
+
 
         </div>
       </div>
@@ -72,7 +67,7 @@
 import { useUserStore } from '@/store/user';
 import { useI18n } from "vue-i18n";
 import useClipboard from "vue-clipboard3";
-import { showToast } from "vant";
+import { showConfirmDialog } from 'vant';
 import addBankIcon from '@/assets/image/userCenter/addBank.png'
 import kycHighStatusIcon from '@/assets/image/userCenter/kycHighStatus.png'
 import store from '@/store/store'
@@ -81,29 +76,32 @@
 
 const router = useRouter()
 const userStore = useUserStore()
-const status = ref(null)
+const status = ref([t('未认证'), t("审核中"), t("已认证"), t("审核未通过")])
 const kycHighStatus = ref(null)
+// kyc_status
 
 // 账户详情选项数据
 const accountItems = ref([
   // { icon: 'icon-option.png', title: '貨幣訂單' , path: '/position/index'},
-  { icon: 'icon-option.png', title: '現貨訂單' , path: '/position/index'},
-  { icon: 'icon-option.png', title: '帳單' , path:'/cryptos/accountChange'},
-  { icon: 'icon-wallet.png', title: '錢包', path: '/payMentMethod/list'},
-  { icon: 'icon-real.png', title: '實名認證', status: '未認證' , path: '/certificationCenter'},
-  { icon: 'icon-small-language.png', title: '語言', status: '中文繁體', path: '/language' },
-  { icon: 'icon-small-password.png', title: '修改密碼', path: '/changePassword'},
-  { icon: 'icon-small-password.png', title: '修改提現密碼', path: '/changeFundsPassword' }
+  { icon: new URL('../../assets/img/icon-option.png', import.meta.url), title: t('hbdhdd'), path: '/cryptos/deliveryContractHistory?symbol=USDSGD&type=forex' },
+  { icon: new URL('../../assets/img/icon-option.png', import.meta.url), title: t('whjydd'), path: '/cryptos/tradeRecord/USDSGD/?type=forex' },
+  { icon: new URL('../../assets/img/icon-option.png', import.meta.url), title: t('账变记录'), path: '/cryptos/accountChange' },
+  // { icon: new URL('../../assets/img/icon-wallet.png', import.meta.url), title: t('银行卡'), path: '/payMentMethod/list'},
+  { icon: new URL('../../assets/img/icon-real.png', import.meta.url), title: t('实名认证'), status: status.value[userStore.userInfo.kyc_status], path: '/certificationCenter' },
+  { icon: new URL('../../assets/img/icon-small-language.png', import.meta.url), title: t('语言'), status: JSON.parse(localStorage.getItem('lang_tit')), path: '/language' },
+  { icon: new URL('../../assets/img/icon-small-password.png', import.meta.url), title: t('修改密码'), path: '/changePassword' },
+  { icon: new URL('../../assets/img/icon-small-password.png', import.meta.url), title: t('修改资金密码'), path: '/changeFundsPassword' }
 ]);
 
 // 帮助和支持选项数据
 const helpItems = ref([
   // { icon: 'icon-market.png', title: '市場模式' },
-  { icon: 'icon-service.png', title: '線上客服', path: '/customerService' },
+  // 客服
+  { icon: new URL('../../assets/img/icon-service.png', import.meta.url), title: t('onLineService'), path: '/customerService' },
   // { icon: 'icon-service.png', title: '專屬客服' },
-  { icon: 'icon-about.png', title: '關於我們', path: '/aboutUs' },
+  { icon: new URL('../../assets/img/icon-about.png', import.meta.url), title: t('关于我们'), path: '/aboutUs' },
   // { icon: 'icon-logout.png', title: '下載 APP' },
-  { icon: 'icon-logout.png', title: '註銷', button: true  }
+  { icon: new URL('../../assets/img/icon-logout.png', import.meta.url), title: t('退出'), path: '/aaa', button: true }
 ]);
 
 const state = reactive({
@@ -127,8 +125,16 @@
   ]
 })
 const onRoute = (path) => {
-  console.log(path)
-  router.push(path)
+  console.log(path, userStore)
+  if (!userStore.userInfo || !userStore.userInfo.token) {
+    router.push('/login')
+    return
+  }
+  if (path == '/aaa') {
+    loginOut()
+  } else {
+    router.push(path)
+  }
 }
 onMounted(() => {
   if (userStore.userInfo && userStore.userInfo.token) {
@@ -190,11 +196,22 @@
 
 })
 const loginOut = () => {
-  _logOut({
-    token: userStore.userInfo.token
-  }).then(res => {
-    userStore.userInfo = {}
-    store.state.user.userInfo = {}
+  showConfirmDialog({
+    title: `${t('确认退出')}`,
+    message: `${t('确定要退出登录吗?')}`
+  }).then(() => {
+    _logOut({
+      token: userStore.userInfo.token
+    }).then(res => {
+      userStore.userInfo = {}
+      store.state.user.userInfo = {}
+      router.push('/login')
+    })
+      .catch(err => {
+        // showFailToast(`${t('退出失败,请重试')}`)
+      })
+  }).catch(() => {
+    // 用户取消操作
   })
 }
 const getIdentify = () => {
@@ -224,6 +241,7 @@
 .bgimg {
   background: url('@/assets/imgs/bg-account.png') 0% 0% / cover;
 }
+
 :deep(.van-cell-group__title) {
   background: $main2_background !important;
   padding: 12px 16px;

--
Gitblit v1.9.3