|
@@ -5,8 +5,23 @@
|
|
|
</template>
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container register__form" @submit="formSubmit">
|
|
<Form ref="formRef" class="g-form__container register__form" @submit="formSubmit">
|
|
|
<CellGroup inset>
|
|
<CellGroup inset>
|
|
|
- <Field v-model="formData.mobilephone" type="digit" name="mobilephone" :label="$t('user.register.mobile')"
|
|
|
|
|
- :placeholder="$t('common.required')" :rules="formRules.mobilephone" />
|
|
|
|
|
|
|
+ <Field v-model="formData.mobilephone" type="digit" name="mobilephone" :placeholder="$t('common.required')" :rules="formRules.mobilephone">
|
|
|
|
|
+ <template #label>
|
|
|
|
|
+ <span>{{ $t('user.register.mobile') }}</span>
|
|
|
|
|
+ <span style="margin-left: 10px;" @click="show = true">
|
|
|
|
|
+ {{ countryCode }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <Popup v-model:show="show" position="bottom" teleport="body" round>
|
|
|
|
|
+ <Picker :columns="datalist" @cancel="onCancel" @confirm="onConfirm" :confirm-button-text="$t('operation.confirm')" :cancel-button-text="$t('operation.cancel')">
|
|
|
|
|
+ <template #option="{ text, index }">
|
|
|
|
|
+ <slot name="option" :row="datalist[index]" :index="index">
|
|
|
|
|
+ {{ text }}
|
|
|
|
|
+ </slot>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Picker>
|
|
|
|
|
+ </Popup>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Field>
|
|
|
<Field v-model="formData.vcode" type="digit" name="vcode" :label="$t('user.register.vcode')"
|
|
<Field v-model="formData.vcode" type="digit" name="vcode" :label="$t('user.register.vcode')"
|
|
|
:placeholder="$t('common.required')" :rules="formRules.vcode">
|
|
:placeholder="$t('common.required')" :rules="formRules.vcode">
|
|
|
<template #button>
|
|
<template #button>
|
|
@@ -61,14 +76,15 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, ref, computed, onMounted } from 'vue'
|
|
|
|
|
-import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, showFailToast, showToast, FieldRule } from 'vant'
|
|
|
|
|
|
|
+import { reactive, shallowRef, ref, computed, onMounted } from 'vue'
|
|
|
|
|
+import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, showFailToast, showToast, FieldRule, Popup, Picker, PickerConfirmEventParams } from 'vant'
|
|
|
import { useCountDown } from '@vant/use'
|
|
import { useCountDown } from '@vant/use'
|
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
|
import { validateRules } from '@/constants/regex'
|
|
import { validateRules } from '@/constants/regex'
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { userRegister, sendRegisterVerifyCode, queryMyRegisterMoney } from '@/services/api/common'
|
|
import { userRegister, sendRegisterVerifyCode, queryMyRegisterMoney } from '@/services/api/common'
|
|
|
import { i18n, useGlobalStore, useUserStore } from '@/stores'
|
|
import { i18n, useGlobalStore, useUserStore } from '@/stores'
|
|
|
|
|
+import { getCountryCodeList } from '@/constants/unit'
|
|
|
import cryptojs from 'crypto-js'
|
|
import cryptojs from 'crypto-js'
|
|
|
import plus from '@/utils/h5plus'
|
|
import plus from '@/utils/h5plus'
|
|
|
import AppReward from '@mobile/components/modules/reward/index.vue'
|
|
import AppReward from '@mobile/components/modules/reward/index.vue'
|
|
@@ -81,6 +97,22 @@ defineProps({
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+const show = shallowRef(false) // 是否弹出选择器
|
|
|
|
|
+const datalist = computed(() => {
|
|
|
|
|
+ return getCountryCodeList().map(e => {
|
|
|
|
|
+ return { text: e.value, value: e.value }
|
|
|
|
|
+ })
|
|
|
|
|
+})
|
|
|
|
|
+const countryCode = ref(datalist.value[0].value.toString())
|
|
|
|
|
+const onCancel = () => {
|
|
|
|
|
+ show.value = false
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onConfirm = ({ selectedValues: [value] }: PickerConfirmEventParams) => {
|
|
|
|
|
+ show.value = false
|
|
|
|
|
+ countryCode.value = value.toString()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const { router, routerTo } = useNavigation()
|
|
const { router, routerTo } = useNavigation()
|
|
|
const globalStore = useGlobalStore()
|
|
const globalStore = useGlobalStore()
|
|
|
const registrationCodeRule = globalStore.getSystemInfo('registrationCodeRule')
|
|
const registrationCodeRule = globalStore.getSystemInfo('registrationCodeRule')
|
|
@@ -190,7 +222,7 @@ const sendVerifyCode = () => {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
sendRegisterVerifyCode({
|
|
sendRegisterVerifyCode({
|
|
|
data: {
|
|
data: {
|
|
|
- phonenumber: formData.mobilephone
|
|
|
|
|
|
|
+ phonenumber: countryCode.value+formData.mobilephone
|
|
|
}
|
|
}
|
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
isCountdown.value = true
|
|
isCountdown.value = true
|
|
@@ -235,11 +267,13 @@ const formSubmit = () => {
|
|
|
// 密码需进行两次base64加密
|
|
// 密码需进行两次base64加密
|
|
|
const passwordData = Base64.stringify(Utf8.parse(formData.loginpwd))
|
|
const passwordData = Base64.stringify(Utf8.parse(formData.loginpwd))
|
|
|
const loginpwd = Base64.stringify(Utf8.parse(passwordData))
|
|
const loginpwd = Base64.stringify(Utf8.parse(passwordData))
|
|
|
|
|
+ const mobilephone = countryCode.value+formData.mobilephone
|
|
|
|
|
|
|
|
userRegister({
|
|
userRegister({
|
|
|
data: {
|
|
data: {
|
|
|
...formData,
|
|
...formData,
|
|
|
- loginpwd
|
|
|
|
|
|
|
+ loginpwd,
|
|
|
|
|
+ mobilephone
|
|
|
}
|
|
}
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|