From a525c62094f6b40545e299f3d1171a933cd40e14 Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Wed, 24 Sep 2025 13:56:36 +0800
Subject: [PATCH] 1

---
 src/views/safety/resetPhoneEmail.vue |  154 +++++++++++++++++++-------------------------------
 1 files changed, 59 insertions(+), 95 deletions(-)

diff --git a/src/views/safety/resetPhoneEmail.vue b/src/views/safety/resetPhoneEmail.vue
index 6544f04..3ffc5c7 100644
--- a/src/views/safety/resetPhoneEmail.vue
+++ b/src/views/safety/resetPhoneEmail.vue
@@ -4,11 +4,8 @@
             <img src="../../assets/image/icon-close.png" alt="" @click="router.go(-1)">
             <div @click="onRoute('/customerService')">{{ $t('onLineService') }}</div>
         </div>
-        <div class="title textColor">{{ $t('更换绑定') }}</div>
+        <div class="title textColor">{{ $t('bind') }}</div>
         <div class="flex re-tab">
-            <!-- <div class="textColor1" :class="activeIndex == 0 ? 'active' : ''" @click="changeIndex(0)">{{
-                $t('account')
-            }}</div> -->
             <div class="textColor1" :class="activeIndex == 1 ? 'active' : ''" @click="changeIndex(1)">
                 {{ $t('email') }}
             </div>
@@ -16,45 +13,37 @@
                 {{ $t('phoneNum') }}
             </div>
         </div>
-        <ExInput :label="getRegType(activeIndex, true)" :placeholderText="getRegType(activeIndex, false)"
-            v-model="username" :area="isArea" :dialCode="dialCode" @selectArea="onSelectArea" :icon="icon" />
 
-        <ExInput :label="$t('repassword')" :placeholderText="$t('请输入')" v-model="password"
-            typeText="password" />
-        <!-- <ExInput :label="$t('repassword')" :placeholderText="$t('surePassword')" v-model="repassword"
-            typeText="password" /> -->
-        <ExInput :label="$t('fundsPassword')" :placeholderText="$t('请输入')" v-model="safeword" typeText="password"
-            v-if="activeIndex === 1 || activeIndex === 2" />
-        <div class="inputCom" v-if="activeIndex === 1 || activeIndex === 2">
-            <p class="label  textColor">{{ $t('验证码') }}</p>
-            <div class="iptbox inputBackground">
-                <input class="inputBackground textColor" type="text" :placeholder="$t('entryVerifyCode')"
-                    v-model="verifyCode">
-                <span v-if="type !== 3" @click="senCode">{{ $t('sendVerifyCode') }}
-                    <template v-if="time">({{ time }})s</template>
-                </span>
+        <template v-if="(activeIndex == 1 && !userdata.emailverif) || (activeIndex == 2 && !userdata.phoneverif)">
+            <ExInput :label="getRegType(activeIndex, true)" :placeholderText="getRegType(activeIndex, false)"
+                v-model="username" :area="isArea" :dialCode="dialCode" @selectArea="onSelectArea" :icon="icon" />
+
+            <div class="inputCom" v-if="activeIndex === 1 || activeIndex === 2">
+                <p class="label  textColor">{{ $t('验证码') }}</p>
+                <div class="iptbox inputBackground">
+                    <input class="inputBackground textColor" type="text" :placeholder="$t('entryVerifyCode')"
+                        v-model="verifyCode">
+                    <span v-if="type !== 3" @click="senCode">{{ $t('sendVerifyCode') }}
+                        <template v-if="time">({{ time }})s</template>
+                    </span>
+                </div>
             </div>
-        </div>
 
-        <!-- <ExInput :label="$t('金融机构代码')" :placeholderText="$t('请输入')" v-model="invitCode" :clearBtn="false" /> -->
+            <van-button class="w-full" style="margin-top:10px;" type="primary" @click="register">{{ $t('confirm') }}
+            </van-button>
+        </template>
 
-        <div class="protocol textColor">
-            <i @click="agreeProt">
-                <img v-show="agree" src="../../assets/image/login/prot2.png" alt="" />
-                <img v-show="!agree" src="../../assets/image/login/prot1.png" alt="" />
-            </i>
-            <!-- {{ $t('readAgree') }}<span class="colorMain" @click="router.push('/TermsOfService')">{{
-                $t('serviceConf')
-            }}</span> -->
-            {{ $t('readAgree') }}<span class="colorMain" @click="router.push('/aboutUs?serviceTerm=23')">{{
-                $t('serviceConf')
-            }}</span>
-        </div>
-        <van-button class="w-full" style="margin-top:10px;" type="primary" @click="register">{{ $t('confirm') }}
-        </van-button>
-        <!-- <div class="noTips textColor">{{ $t('hasAccount') }}<span class="colorMain" @click="router.push('/login')">
-                {{ $t('goLogin') }}</span>
-        </div> -->
+        <!-- 邮箱已绑定显示 -->
+        <template v-if="(activeIndex == 1 && userdata.emailverif)">
+            <div>{{ $t('邮箱已绑定') }}:</div>
+            <div>{{ userdata.email }}</div>
+        </template>
+        <!-- 手机号已绑定显示 -->
+        <template v-if="(activeIndex == 2 && userdata.phoneverif)">
+            <div>{{ $t('手机号已绑定') }}:</div>
+            <div>{{ userdata.phone }}</div>
+        </template>
+
         <nationality-list ref='controlChildRef' :title="$t('selectArea')" @getName="getName"></nationality-list>
 
         <Vcode :imgs="[img1, img2]" :show="show" @success="onSuccess" :canvasHeight="200" @fail="onFail"
@@ -67,14 +56,12 @@
 <script setup>
 import ExInput from "@/components/ex-input/index.vue";
 import { _registerUser, _sendVerifyCode } from "@/service/login.api";
-import { _bindEmailRegister, _registerEorP } from "@/service/user.api.js";
+import { _info, _bindEmail, _bindPhone } from "@/service/user.api.js";
 import { useUserStore } from '@/store/user';
-import { GET_USERINFO } from '@/store/types.store'
 import nationalityList from '../authentication/components/nationalityList.vue'
 import Vcode from "vue3-puzzle-vcode";
 import img1 from "@/assets/image/slider/1.png";
 import img2 from "@/assets/image/slider/2.png";
-import { getStorage } from '@/utils/index'
 import { useI18n } from 'vue-i18n'
 import { customerServiceUrl } from "@/config";
 import { useRouter } from 'vue-router';
@@ -105,16 +92,9 @@
 const msg = ref('')
 const type = ref(1)
 const time = ref(0)
-let agree = ref(false)
 const username = ref('')
-const password = ref('')
-const repassword = ref('')
 const verifyCode = ref('')
-const safeword = ref('')
-const fundPassword = ref('')
-const refundPassword = ref('')
 const activeIndex = ref(1)
-const typeText = ref('password')
 let isArea = ref(false)
 let dialCode = ref(0)
 let icon = ref('')
@@ -122,13 +102,7 @@
     timer: null
 })
 
-let invitCode = ref('')
 onMounted(() => {
-    console.log(store)
-    let usercode = getStorage('usercode')
-    if (usercode) {
-        invitCode = usercode;
-    }
     clearInterval(state.timer)
     state.timer = null
 })
@@ -179,9 +153,6 @@
 const onFail = () => {
     msg.value = ''
 }
-const onRefresh = () => {
-    msg.value = ''
-}
 
 const controlChildRef = ref(null)
 const onSelectArea = () => {
@@ -191,9 +162,6 @@
 const getName = (params) => {
     icon.value = params.code;
     dialCode.value = params.dialCode;
-}
-const agreeProt = () => {
-    agree.value = !agree.value
 }
 const register = () => {
     console.log(activeIndex.value, 'activeIndex.value')
@@ -212,10 +180,6 @@
             showToast(t('entryCorrectEmail'));
             return
         }
-        if (safeword.value == '') {
-            showToast(t('safewordTips'));
-            return
-        }
         if (verifyCode.value.length < 6) {
             showToast(t('entryVerifyTips'));
             return
@@ -229,22 +193,10 @@
             showToast(t('entryPhone'));
             return
         }
-    }
-    if (password.value == '') {
-        showToast(t('entryPassword'));
-        return
-    }
-    if (password.value.length < 6) {
-        showToast(t('passwordTips'));
-        return
-    }
-    // if (repassword.value !== password.value) {
-    //     showToast(t('noSamePassword'));
-    //     return
-    // }
-    if (!agree.value) {
-        showToast(t('agreeServiceCond'));
-        return
+        if (verifyCode.value.length < 6) {
+            showToast(t('entryVerifyTips'));
+            return
+        }
     }
     show.value = true
 }
@@ -266,29 +218,41 @@
         case 1:
             {
                 type.value = 2;
+
+                _bindEmail({
+                    email: username.value,
+                    verifcode: verifyCode.value, // 验证码
+                }).then(res => {
+                    showToast(t('bindSuccess'));
+                    getinfo()
+                })
                 break;
             }
         case 2:
             {
                 type.value = 1;
+
+                _bindPhone({
+                    phone: username.value,
+                    verifcode: verifyCode.value, // 验证码
+                }).then(res => {
+                    showToast(t('bindSuccess'));
+                    getinfo()
+                })
                 break;
             }
     }
-
-    _registerEorP({
-        username: activeIndex.value === 1 ? username.value : dialCode.value + username.value,
-        password: password.value,
-        type: activeIndex.value === 1 ? '2' : '1',   // 2邮箱,1手机
-        verifcode: verifyCode.value,
-        safeword: safeword.value
-    }).then((res) => {
-        userStore[GET_USERINFO](res)
-        store.state.user.userInfo = res
-        // 其他操作??
-        // router.push('/identity')
-        router.push('/login')
-    })
 }
+// 获取用户信息
+let userdata = ref({})
+const getinfo = () => {
+    _info().then((data) => {
+        userdata.value = data;  // 确保 userdata 被正确声明
+    }).catch(error => {
+        console.error('Error fetching data:', error);
+    });
+};
+getinfo()
 </script>
 
 <style lang="scss" scoped>

--
Gitblit v1.9.3