|
|
@@ -5,21 +5,22 @@
|
|
|
</template>
|
|
|
<Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
<CellGroup inset>
|
|
|
- <Field v-model="formData.mobile" type="tel" name="mobile" :label="$t('user.forget.mobile')" :placeholder="$t('common.pleaseenter')" autocomplete="off"
|
|
|
- :rules="formRules.mobile" />
|
|
|
- <Field v-model="formData.vcode" type="digit" name="vcode" :label="$t('user.forget.vcode')" :placeholder="$t('common.pleaseenter')" autocomplete="off"
|
|
|
- :rules="formRules.vcode">
|
|
|
+ <Field v-model="formData.mobile" type="tel" name="mobile" :label="$t('user.forget.mobile')"
|
|
|
+ :placeholder="$t('common.pleaseenter')" autocomplete="off" :rules="formRules.mobile" />
|
|
|
+ <Field v-model="formData.vcode" type="digit" name="vcode" :label="$t('user.forget.vcode')"
|
|
|
+ :placeholder="$t('common.pleaseenter')" autocomplete="off" :rules="formRules.vcode">
|
|
|
<template #button>
|
|
|
- <Button size="small" type="danger" :disabled="isCountdown" @click="sendVerifyCode">
|
|
|
+ <Button size="small" type="danger" :disabled="loading" @click="sendVerifyCode">
|
|
|
<span v-if="isCountdown">{{ $t('user.forget.sendagain') }}({{ currentTime.seconds }})</span>
|
|
|
<span v-else>{{ $t('user.forget.getsmscode') }}</span>
|
|
|
</Button>
|
|
|
</template>
|
|
|
</Field>
|
|
|
- <Field v-model="formData.password" name="password" type="password" :label="$t('user.forget.newpwd')" :placeholder="$t('common.pleaseenter')"
|
|
|
- autocomplete="off" :rules="formRules.password" />
|
|
|
- <Field v-model="formData.confirmpassword" name="confirmpassword" type="password" :label="$t('user.forget.confirmpwd')"
|
|
|
- :placeholder="$t('common.pleaseenter')" autocomplete="off" :rules="formRules.confirmpassword" />
|
|
|
+ <Field v-model="formData.password" name="password" type="password" :label="$t('user.forget.newpwd')"
|
|
|
+ :placeholder="$t('common.pleaseenter')" autocomplete="off" :rules="formRules.password" />
|
|
|
+ <Field v-model="formData.confirmpassword" name="confirmpassword" type="password"
|
|
|
+ :label="$t('user.forget.confirmpwd')" :placeholder="$t('common.pleaseenter')" autocomplete="off"
|
|
|
+ :rules="formRules.confirmpassword" />
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
@@ -31,7 +32,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { reactive, ref, computed, shallowRef } from 'vue'
|
|
|
+import { reactive, ref, computed } from 'vue'
|
|
|
import { CellGroup, Button, Field, Form, FormInstance, showFailToast, FieldRule } from 'vant'
|
|
|
import { useCountDown } from '@vant/use'
|
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
|
@@ -45,19 +46,22 @@ import { i18n, useUserStore } from '@/stores'
|
|
|
|
|
|
const { router } = useNavigation()
|
|
|
const formRef = ref<FormInstance>()
|
|
|
+const loading = ref(false)
|
|
|
const isCountdown = ref(false) // 是否正在倒计时
|
|
|
|
|
|
const { getSystemParamValue } = useUserStore()
|
|
|
-const system_1010 = shallowRef(getSystemParamValue('1010') ?? '1')
|
|
|
+const param1010 = getSystemParamValue('1010') ?? '1'
|
|
|
+const param1013 = getSystemParamValue('1013') ?? '30'
|
|
|
|
|
|
const { global: { t } } = i18n
|
|
|
|
|
|
// 倒计时函数
|
|
|
const countdown = useCountDown({
|
|
|
- time: 60 * 1000,
|
|
|
+ time: +param1013 * 1000,
|
|
|
onFinish: () => {
|
|
|
countdown.reset()
|
|
|
isCountdown.value = false
|
|
|
+ loading.value = false
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -80,14 +84,14 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
|
|
|
message: t('user.forget.tips1'),
|
|
|
validator: (val) => {
|
|
|
/// 值为”0“ 时 只校验长度20位,不限字符
|
|
|
- if (system_1010.value === '0') {
|
|
|
+ if (param1010 === '0') {
|
|
|
if (val.length <= 20) {
|
|
|
return true
|
|
|
}
|
|
|
return t('banksign.tips6')
|
|
|
} else {
|
|
|
if (validateRules.phone.validate(val)) {
|
|
|
- return true
|
|
|
+ return true
|
|
|
}
|
|
|
return validateRules.phone.message
|
|
|
}
|
|
|
@@ -122,6 +126,7 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
|
|
|
// 发送手机验证码
|
|
|
const sendVerifyCode = () => {
|
|
|
formRef.value?.validate('mobile').then(() => {
|
|
|
+ loading.value = true
|
|
|
sendResetVerifyCode({
|
|
|
data: {
|
|
|
mobile: getEncryptMobile(formData.mobile),
|
|
|
@@ -131,6 +136,7 @@ const sendVerifyCode = () => {
|
|
|
isCountdown.value = true
|
|
|
countdown.start()
|
|
|
}).catch(() => {
|
|
|
+ loading.value = false
|
|
|
showFailToast(t('user.forget.tips7'))
|
|
|
})
|
|
|
})
|