|
@@ -22,9 +22,10 @@
|
|
|
<t-form-item name="code">
|
|
|
<div class="flex items-center">
|
|
|
<t-input
|
|
|
+ style="width: 170px"
|
|
|
v-model="formData.code"
|
|
|
clearable
|
|
|
- placeholder="请输入验证码"
|
|
|
+ placeholder="验证码"
|
|
|
size="large"
|
|
|
>
|
|
|
<template #prefix-icon>
|
|
@@ -33,7 +34,7 @@
|
|
|
</t-input>
|
|
|
<t-button
|
|
|
class="m-l-20px"
|
|
|
- style="width: 160px"
|
|
|
+ style="width: 110px"
|
|
|
:loading="loading"
|
|
|
@click="getCode"
|
|
|
>{{ isActive ? lastSeconds + 's' : '获取验证码' }}</t-button
|
|
@@ -90,8 +91,16 @@ import { clear } from '@/utils/tool';
|
|
|
import { useIntervalFn } from '@vueuse/core';
|
|
|
import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
import { useRequest } from 'vue-request';
|
|
|
-import { getVerifyCode } from '@/api/user';
|
|
|
-const { run, loading } = useRequest(getVerifyCode);
|
|
|
+import { getBase64 } from '@/utils/crypto';
|
|
|
+import { getVerifyCode, forgetPassword } from '@/api/user';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+const router = useRouter();
|
|
|
+const form = ref();
|
|
|
+const { run, loading } = useRequest(getVerifyCode, {
|
|
|
+ onSuccess: () => {
|
|
|
+ MessagePlugin.success('验证码已发送');
|
|
|
+ },
|
|
|
+});
|
|
|
const lastSeconds = ref(10);
|
|
|
const countdown = () => {
|
|
|
if (lastSeconds.value == 0) {
|
|
@@ -112,8 +121,8 @@ const getCode = () => {
|
|
|
MessagePlugin.error('请先输入手机号');
|
|
|
return;
|
|
|
}
|
|
|
- run({ mobileNumber: formData.mobileNumber }).then((res) => {
|
|
|
- console.log('rrr', res);
|
|
|
+ run({
|
|
|
+ mobileNumber: formData.mobileNumber,
|
|
|
});
|
|
|
// resume();
|
|
|
};
|
|
@@ -174,6 +183,15 @@ const rules = {
|
|
|
const submitHandle = () => {
|
|
|
form.value.validate().then(async (result) => {
|
|
|
if (result === true) {
|
|
|
+ forgetPassword({
|
|
|
+ mobileNumber: formData.mobileNumber,
|
|
|
+ code: formData.code,
|
|
|
+ password: getBase64(formData.password),
|
|
|
+ }).then(() => {
|
|
|
+ MessagePlugin.success('密码修改成功,请登录');
|
|
|
+ clear();
|
|
|
+ router.push({ name: 'Login' });
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
};
|