1
李凌
2025-09-18 7a4e91cad492b5f2411ae3ec074dae533d0ec335
src/views/register/index.vue
@@ -1,26 +1,31 @@
<template>
    <div class="register">
        <div class="top" @click="router.go(-1)"><img src="../../assets/image/icon-close.png" alt=""></div>
        <Step :step="1"></Step>
        <div class="top flex justify-between items-center">
            <img src="../../assets/image/icon-close.png" alt="" @click="router.go(-1)">
            <div @click="onRoute('/customerService')">{{ $t('onLineService') }}</div>
        </div>
        <!-- <Step :step="1"></Step> -->
        <div class="title textColor">{{ $t('register') }}</div>
        <div class="flex re-tab">
            <div class="textColor1" :class="activeIndex == 0 ? 'active' : ''" @click="changeIndex(0)">{{
            <!-- <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> -->
            <div class="textColor1" :class="activeIndex == 1 ? 'active' : ''" @click="changeIndex(1)">{{ $t('email') }}
            </div>
            <div class="textColor1" :class="activeIndex == 2 ? 'active' : ''" @click="changeIndex(2)">{{
                $t('phoneNum')
            }}</div> -->
                }}</div>
        </div>
        <ExInput :label="getRegType(activeIndex, true)" :placeholderText="getRegType(activeIndex, false)" v-model="username"
            :area="isArea" :dialCode="dialCode" @selectArea="onSelectArea" :icon="icon" />
        <ExInput :label="getRegType(activeIndex, true)" :placeholderText="getRegType(activeIndex, false)"
            v-model="username" :area="isArea" :dialCode="dialCode" @selectArea="onSelectArea" :icon="icon" />
        <ExInput :label="$t('setPassword')" :placeholderText="$t('passwordTips')" v-model="password" typeText="password" />
        <ExInput :label="$t('repassword')" :placeholderText="$t('surePassword')" v-model="repassword" typeText="password" />
        <ExInput :label="$t('setPassword')" :placeholderText="$t('passwordTips')" v-model="password"
            typeText="password" />
        <ExInput :label="$t('repassword')" :placeholderText="$t('surePassword')" v-model="repassword"
            typeText="password" />
        <ExInput :label="$t('setSafeword')" :placeholderText="$t('safewordTips')" v-model="safeword" typeText="password"
            v-if="activeIndex === 1" />
        <div class="inputCom" v-if="activeIndex === 1">
            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')"
@@ -30,7 +35,7 @@
                </span>
            </div>
        </div>
        <ExInput :label="$t('invitCode')" :placeholderText="$t('entryInvitCode')" v-model="invitCode" :clearBtn="false" />
        <ExInput :label="$t('金融机构代码')" :placeholderText="$t('请输入')" v-model="invitCode" :clearBtn="false" />
        <div class="protocol textColor">
            <i @click="agreeProt">
                <img v-show="agree" src="../../assets/image/login/prot2.png" alt="" />
@@ -38,7 +43,7 @@
            </i>
            {{ $t('readAgree') }}<span class="colorMain" @click="router.push('/TermsOfService')">{{
                $t('serviceConf')
            }}</span>
                }}</span>
        </div>
        <van-button class="w-full" style="margin-top:10px;" type="primary" @click="register">{{ $t('register') }}
        </van-button>
@@ -67,14 +72,28 @@
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';
import { ref, onMounted, reactive, onUnmounted } from 'vue';
import { showToast } from "vant";
import store from '@/store/store'
const customer_service_url = ref(customerServiceUrl) // 客服链接,有值的话就会跳转到客服外链
const { t } = useI18n()
const router = useRouter()
const onRoute = (path) => {
    router.push(path)
    if (path == 'back') {
        router.go(-1)
    } else {
        if (path == '/customerService') {
            if (customer_service_url.value) {
                window.location.href = customer_service_url.value;
            } else {
                router.push(path)
            }
        } else {
            router.push(path)
        }
    }
}
const userStore = useUserStore();
@@ -90,7 +109,7 @@
const safeword = ref('')
const fundPassword = ref('')
const refundPassword = ref('')
const activeIndex = ref(0)
const activeIndex = ref(1)
const typeText = ref('password')
let isArea = ref(false)
let dialCode = ref(0)
@@ -173,7 +192,7 @@
    agree.value = !agree.value
}
const register = () => {
    console.log(activeIndex.value,'activeIndex.value')
    console.log(activeIndex.value, 'activeIndex.value')
    if (activeIndex.value == 0) {
        if (username.value == '') {
            showToast(t('entryAccount'));
@@ -198,7 +217,7 @@
            return
        }
    } else if (activeIndex.value == 2) {
        if(!(/(^[1-9]\d*$)/.test(username.value))){
        if (!(/(^[1-9]\d*$)/.test(username.value))) {
            showToast(t('entryPhone'));
            return
        }
@@ -252,11 +271,11 @@
            }
    }
    if (activeIndex.value === 1) {
    if (activeIndex.value === 1 || activeIndex.value === 2) {
        _bindEmailRegister({
            username: username.value,
            password: password.value,
            type: '2',   // 2邮箱
            type: activeIndex.value === 1 ? '2' : '1',   // 2邮箱,1手机
            verifcode: verifyCode.value,
            usercode: invitCode.value,
            safeword: safeword.value
@@ -264,7 +283,8 @@
            userStore[GET_USERINFO](res)
            store.state.user.userInfo = res
            // 其他操作??
            router.push('/identity')
            // router.push('/identity')
            router.push('/login')
        })
    } else {
        _registerUser({
@@ -284,8 +304,6 @@
        });
    }
}
</script>
<style lang="scss" scoped>