Commit 49f96980 by tang

feat: 找回密码

parent f470ca25
...@@ -19,8 +19,18 @@ const code = (params = {}) => { ...@@ -19,8 +19,18 @@ const code = (params = {}) => {
return POST(`${Prefix}/office/timescoderegi/api/getVerificationCode`, params) return POST(`${Prefix}/office/timescoderegi/api/getVerificationCode`, params)
} }
const resetPasswordByMobile = (params = {}) => {
return POST(`${Prefix}/office/timescodefindps/api/forgotPasswordPhone`, params)
}
const resetPasswordByEmail = (params = {}) => {
return POST(`${Prefix}/office/timescodefindps/api/forgotPasswordEmiail`, params)
}
export default { export default {
login, login,
register, register,
code, code,
resetPasswordByMobile,
resetPasswordByEmail,
} }
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
<div class="reset-pass"> <div class="reset-pass">
<el-tabs v-model="activeName" class="tab-no-bottom"> <el-tabs v-model="activeName" class="tab-no-bottom">
<el-tab-pane label="手机号找回" name="first"> <el-tab-pane label="手机号找回" name="first">
<el-form :model="mobileForm" status-icon> <el-form ref="mobileForm" :model="mobileForm" status-icon>
<el-form-item> <el-form-item prop='userName' :rules="[{
required: true,
message: '不能为空',
}]">
<el-input v-model="mobileForm.userName" <el-input v-model="mobileForm.userName"
placeholder="请输入用户名"></el-input> placeholder="请输入用户名"></el-input>
</el-form-item> </el-form-item>
...@@ -35,8 +38,11 @@ ...@@ -35,8 +38,11 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="邮箱找回" name="second"> <el-tab-pane label="邮箱找回" name="second">
<el-form :model="emailForm" status-icon> <el-form ref="emailForm" :model="emailForm" status-icon>
<el-form-item> <el-form-item prop='userName' :rules="[{
required: true,
message: '不能为空',
}]">
<el-input v-model="emailForm.userName" <el-input v-model="emailForm.userName"
placeholder="请输入用户名"></el-input> placeholder="请输入用户名"></el-input>
</el-form-item> </el-form-item>
...@@ -125,34 +131,60 @@ export default { ...@@ -125,34 +131,60 @@ export default {
}, },
methods: { methods: {
resetByMobile() { resetByMobile() {
if (this.mobileForm.mobile === '') { this.$refs['mobileForm'].validate((valid) => {
this.$message({type: 'error', message: '请输入手机号码'}); if (valid) {
} else { this.$api.user.resetPasswordByMobile({
this.hasSent = true; "userName": this.mobileForm.userName,
this.timer = setInterval(() => { "phone": this.mobileForm.mobile
this.time -= 1; }).then(res => {
if (this.time === 0) { console.log(res)
clearInterval(this.timer); if (res.success) {
this.time = 60; this.$message.success(res.returnMsg || '发送成功,请注意查收')
this.hasSent = false; this.hasSent = true;
} this.timer = setInterval(() => {
}, 1000); this.time -= 1;
} if (this.time === 0) {
clearInterval(this.timer);
this.time = 60;
this.hasSent = false;
}
}, 1000);
} else {
this.$message.error(res.returnMsg || '网络错误,请稍后再试')
}
})
}
})
}, },
resetByEmail() { resetByEmail() {
if (this.emailForm.email === '') { this.$refs['emailForm'].validate((valid) => {
this.$message({type: 'error', message: '请输入邮箱号'}); if (valid) {
} else { this.$api.user.resetPasswordByEmail({
this.hasSent = true; "userName": this.emailForm.userName,
this.timer = setInterval(() => { "e-miail": this.emailForm.email
this.time -= 1; }).then(res => {
if (this.time === 0) { console.log(res)
clearInterval(this.timer); if (res.success) {
this.time = 60; this.$message.success(res.returnMsg || '发送成功,请注意查收')
this.hasSent = false; this.hasSent = true;
} this.timer = setInterval(() => {
}, 1000); this.time -= 1;
} if (this.time === 0) {
clearInterval(this.timer);
this.time = 60;
this.hasSent = false;
}
}, 1000);
} else {
this.$message.error(res.returnMsg || '网络错误,请稍后再试')
}
})
}
})
// if (this.emailForm.email === '') {
// this.$message({type: 'error', message: '请输入邮箱号'});
// } else {
// }
} }
}, },
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment