|
|
@@ -41,11 +41,14 @@ import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { queryLoginId } from '@/services/api/account'
|
|
|
import { resetPassword, sendResetVerifyCode } from '@/services/api/common'
|
|
|
import cryptojs from 'crypto-js'
|
|
|
+import { i18n } from '@/stores'
|
|
|
|
|
|
const { router } = useNavigation()
|
|
|
const formRef = ref<FormInstance>()
|
|
|
const isCountdown = ref(false) // 是否正在倒计时
|
|
|
|
|
|
+const { global: { t } } = i18n
|
|
|
+
|
|
|
// 倒计时函数
|
|
|
const countdown = useCountDown({
|
|
|
time: 60 * 1000,
|
|
|
@@ -71,7 +74,7 @@ const formData = reactive<Model.ResetPasswordReq & { confirmpassword: string }>(
|
|
|
const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: FieldRule[] } = {
|
|
|
mobile: [{
|
|
|
required: true,
|
|
|
- message: '请输入手机号码',
|
|
|
+ message: t('user.forget.tips1'),
|
|
|
validator: (val) => {
|
|
|
if (validateRules.phone.validate(val)) {
|
|
|
return true
|
|
|
@@ -81,7 +84,7 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
|
|
|
}],
|
|
|
password: [{
|
|
|
required: true,
|
|
|
- message: '请输入新密码',
|
|
|
+ message: t('user.forget.tips3'),
|
|
|
validator: (val) => {
|
|
|
if (validateRules.password.validate(val)) {
|
|
|
return true
|
|
|
@@ -91,7 +94,7 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
|
|
|
}],
|
|
|
vcode: [{
|
|
|
required: true,
|
|
|
- message: '请输入短信验证码',
|
|
|
+ message: t('user.forget.tips2'),
|
|
|
}],
|
|
|
confirmpassword: [{
|
|
|
required: true,
|
|
|
@@ -100,7 +103,7 @@ const formRules: { [key in keyof Model.ResetPasswordReq | 'confirmpassword']?: F
|
|
|
if (formData.password === val) {
|
|
|
return true
|
|
|
}
|
|
|
- return '新密码和确认密码不一致'
|
|
|
+ return t('user.forget.tips6')
|
|
|
}
|
|
|
}],
|
|
|
}
|
|
|
@@ -117,7 +120,7 @@ const sendVerifyCode = () => {
|
|
|
isCountdown.value = true
|
|
|
countdown.start()
|
|
|
}).catch(() => {
|
|
|
- showFailToast('发送失败')
|
|
|
+ showFailToast(t('user.forget.tips7'))
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
@@ -144,7 +147,7 @@ const formSubmit = () => {
|
|
|
}).then((res) => {
|
|
|
if (res.code === '0') {
|
|
|
hideLoading()
|
|
|
- dialog('密码重置成功,请重新登录。').then(() => {
|
|
|
+ dialog(t('user.forget.tips8')).then(() => {
|
|
|
router.back()
|
|
|
})
|
|
|
} else {
|