|
|
@@ -5,20 +5,22 @@
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container register__form" @submit="formSubmit">
|
|
|
<CellGroup inset>
|
|
|
- <Field v-model="formData.mobilephone" type="digit" name="mobilephone" :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 }}
|
|
|
+ {{ 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>
|
|
|
+ <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>
|
|
|
@@ -26,7 +28,7 @@
|
|
|
:placeholder="$t('common.required')" :rules="formRules.vcode">
|
|
|
<template #button>
|
|
|
<Button size="small" type="danger" :disabled="loading" @click="sendVerifyCode">
|
|
|
- <span v-if="isCountdown">{{ $t('user.register.sendagain') }}({{ currentTime.seconds }})</span>
|
|
|
+ <span v-if="isCountdown">{{ $t('user.register.sendagain') }}({{ currentTime }})</span>
|
|
|
<span v-else>{{ $t('user.register.getsmscode') }}</span>
|
|
|
</Button>
|
|
|
</template>
|
|
|
@@ -99,18 +101,18 @@ defineProps({
|
|
|
|
|
|
const show = shallowRef(false) // 是否弹出选择器
|
|
|
const datalist = computed(() => {
|
|
|
- return getCountryCodeList().map(e => {
|
|
|
- return { text: e.value, value: e.value }
|
|
|
- })
|
|
|
+ return getCountryCodeList().map(e => {
|
|
|
+ return { text: e.value, value: e.value }
|
|
|
+ })
|
|
|
})
|
|
|
const countryCode = ref(datalist.value[0].value.toString())
|
|
|
const onCancel = () => {
|
|
|
- show.value = false
|
|
|
+ show.value = false
|
|
|
}
|
|
|
|
|
|
const onConfirm = ({ selectedValues: [value] }: PickerConfirmEventParams) => {
|
|
|
- show.value = false
|
|
|
- countryCode.value = value.toString()
|
|
|
+ show.value = false
|
|
|
+ countryCode.value = value.toString()
|
|
|
}
|
|
|
|
|
|
const { router, routerTo } = useNavigation()
|
|
|
@@ -142,7 +144,10 @@ const countdown = useCountDown({
|
|
|
})
|
|
|
|
|
|
// 倒计时剩余时间
|
|
|
-const currentTime = computed(() => countdown.current.value)
|
|
|
+const currentTime = computed(() => {
|
|
|
+ const { total } = countdown.current.value
|
|
|
+ return (total / 1000).toFixed(0)
|
|
|
+})
|
|
|
|
|
|
// 表单数据
|
|
|
const formData = reactive<Model.RegisterReq>({
|
|
|
@@ -222,7 +227,7 @@ const sendVerifyCode = () => {
|
|
|
loading.value = true
|
|
|
sendRegisterVerifyCode({
|
|
|
data: {
|
|
|
- phonenumber: countryCode.value+formData.mobilephone
|
|
|
+ phonenumber: countryCode.value + formData.mobilephone
|
|
|
}
|
|
|
}).then(() => {
|
|
|
isCountdown.value = true
|
|
|
@@ -267,7 +272,7 @@ const formSubmit = () => {
|
|
|
// 密码需进行两次base64加密
|
|
|
const passwordData = Base64.stringify(Utf8.parse(formData.loginpwd))
|
|
|
const loginpwd = Base64.stringify(Utf8.parse(passwordData))
|
|
|
- const mobilephone = countryCode.value+formData.mobilephone
|
|
|
+ const mobilephone = countryCode.value + formData.mobilephone
|
|
|
|
|
|
userRegister({
|
|
|
data: {
|