main #98
@ -121,7 +121,8 @@
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
<!-- 重置密码对话框 -->
|
||||
<!-- 重置密码对话框暂时注释 -->
|
||||
<!--
|
||||
<el-dialog title="重置密码" :visible.sync="dialogVisible" width="25%" class="myDialog">
|
||||
<el-form ref="form" :model="form" label-width="100px" :rules="forms">
|
||||
<el-form-item label="用户名:" prop="username" class="rePassword" style="background-color: white">
|
||||
@ -150,6 +151,7 @@
|
||||
</div>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -178,12 +180,12 @@
|
||||
import {
|
||||
getCodeAPI, // 获取验证码API
|
||||
getLogoAPI, // 获取Logo信息API
|
||||
getPasswordCodeAPI, // 重置密码API
|
||||
// getPasswordCodeAPI, // 重置密码API
|
||||
logintypeAPI, // 登录类型API
|
||||
loginUserAPI, // 用户登录API
|
||||
reqGetAppidAPI, // 获取微信AppID API
|
||||
reqGetCodeAPI, // 获取微信授权码API
|
||||
retrieveCodeAPI, // 获取重置密码验证码API,
|
||||
// retrieveCodeAPI, // 获取重置密码验证码API,
|
||||
} from "@/api/login";
|
||||
|
||||
import store from "@/store";
|
||||
@ -222,22 +224,15 @@ export default {
|
||||
|
||||
// 验证码相关
|
||||
SendCode_text: "获取验证码", // 手机登录验证码按钮文本
|
||||
SendCode_text1: "获取验证码", // 重置密码验证码按钮文本
|
||||
isDisabled: false, // 手机登录验证码按钮是否禁用
|
||||
isDisabled1: false, // 重置密码验证码按钮是否禁用
|
||||
time_count: 60, // 手机登录验证码倒计时
|
||||
time_count1: 60, // 重置密码验证码倒计时
|
||||
timer: null, // 手机登录验证码定时器
|
||||
timer1: null, // 重置密码验证码定时器
|
||||
|
||||
// 防抖相关
|
||||
isGettingCode: false, // 是否正在获取验证码
|
||||
isGettingCode1: false, // 是否正在获取重置密码验证码
|
||||
debounceTimer: null, // 防抖定时器
|
||||
debounceTimer1: null, // 重置密码防抖定时器
|
||||
|
||||
// 对话框和加载状态
|
||||
dialogVisible: false, // 重置密码对话框是否可见
|
||||
loading: false, // 登录按钮加载状态
|
||||
|
||||
// 登录表单数据
|
||||
@ -266,21 +261,20 @@ export default {
|
||||
capsTooltip: false,
|
||||
passwordType: "password", // 密码输入框类型:password或text
|
||||
|
||||
// 重置密码表单数据
|
||||
form: {
|
||||
username: "", // 用户名
|
||||
vcode: "", // 验证码
|
||||
password: "", // 新密码
|
||||
id: "", // 用户ID
|
||||
codeid: "", // 验证码ID
|
||||
},
|
||||
// 重置密码相关暂时注释
|
||||
// form: {
|
||||
// username: "", // 用户名
|
||||
// vcode: "", // 验证码
|
||||
// password: "", // 新密码
|
||||
// id: "", // 用户ID
|
||||
// codeid: "", // 验证码ID
|
||||
// },
|
||||
|
||||
// 重置密码表单验证规则
|
||||
forms: {
|
||||
username: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
||||
vcode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
||||
},
|
||||
// forms: {
|
||||
// username: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
||||
// password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
||||
// vcode: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
||||
// },
|
||||
|
||||
// Logo显示控制
|
||||
isLogo: false,
|
||||
@ -331,7 +325,6 @@ export default {
|
||||
beforeDestroy() {
|
||||
// 组件销毁前清理定时器和事件监听
|
||||
clearInterval(this.timer)
|
||||
clearInterval(this.timer1)
|
||||
clearInterval(this.getCodeTimer)
|
||||
window.removeEventListener('keydown', this.handleEnter);
|
||||
|
||||
@ -384,21 +377,19 @@ export default {
|
||||
}, 300);
|
||||
},
|
||||
|
||||
// 防抖后的获取重置密码验证码方法
|
||||
debouncedGetCode1: function () {
|
||||
if (this.isDisabled1 || this.isGettingCode1) return;
|
||||
|
||||
this.isGettingCode1 = true;
|
||||
|
||||
// 清除之前的定时器
|
||||
clearTimeout(this.debounceTimer1);
|
||||
|
||||
// 设置新的定时器,300ms后执行
|
||||
this.debounceTimer1 = setTimeout(() => {
|
||||
this.getCode1();
|
||||
this.isGettingCode1 = false;
|
||||
}, 300);
|
||||
},
|
||||
// 重置密码相关方法暂时注释
|
||||
// debouncedGetCode1: function () {
|
||||
// if (this.isDisabled1 || this.isGettingCode1) return;
|
||||
//
|
||||
// this.isGettingCode1 = true;
|
||||
//
|
||||
// clearTimeout(this.debounceTimer1);
|
||||
//
|
||||
// this.debounceTimer1 = setTimeout(() => {
|
||||
// this.getCode1();
|
||||
// this.isGettingCode1 = false;
|
||||
// }, 300);
|
||||
// },
|
||||
|
||||
// 跳转到百度产品页面
|
||||
goBaidu(listUrl, url) {
|
||||
@ -753,56 +744,53 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 获取重置密码验证码
|
||||
getCode1() {
|
||||
// 验证手机号格式
|
||||
if (!this.form.username || !/^1[3-9]\d{9}$/.test(this.form.username)) {
|
||||
this.$message.error('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用新的API参数:mobile和action_type
|
||||
retrieveCodeAPI({
|
||||
mobile: this.form.username,
|
||||
action_type: 'login'
|
||||
}).then((res) => {
|
||||
if (res.status == true) {
|
||||
this.form.id = res.userid;
|
||||
this.form.codeid = res.codeid;
|
||||
let that = this;
|
||||
this.time_count1 = 59;
|
||||
this.isDisabled1 = true;
|
||||
this.SendCode_text1 = "重新发送" + this.time_count1 + "s";
|
||||
|
||||
if (!that.timer1) {
|
||||
that.timer1 = setInterval(() => {
|
||||
if (that.time_count1 > 0) {
|
||||
that.time_count1--;
|
||||
that.SendCode_text1 = "重新发送" + that.time_count1 + "s";
|
||||
} else {
|
||||
that.SendCode_text1 = "获取验证码";
|
||||
clearInterval(that.timer1);
|
||||
that.timer1 = null;
|
||||
this.isDisabled1 = false;
|
||||
that.time_count1 = 60;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
this.$message({
|
||||
message: "验证码已发送,请注意查收。",
|
||||
type: "success",
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
this.isGettingCode1 = false;
|
||||
this.$message.error('验证码获取失败');
|
||||
});
|
||||
},
|
||||
// getCode1() {
|
||||
// if (!this.form.username || !/^1[3-9]\d{9}$/.test(this.form.username)) {
|
||||
// this.$message.error('请输入正确的手机号');
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// retrieveCodeAPI({
|
||||
// mobile: this.form.username,
|
||||
// action_type: 'login'
|
||||
// }).then((res) => {
|
||||
// if (res.status == true) {
|
||||
// this.form.id = res.userid;
|
||||
// this.form.codeid = res.codeid;
|
||||
// let that = this;
|
||||
// this.time_count1 = 59;
|
||||
// this.isDisabled1 = true;
|
||||
// this.SendCode_text1 = "重新发送" + this.time_count1 + "s";
|
||||
//
|
||||
// if (!that.timer1) {
|
||||
// that.timer1 = setInterval(() => {
|
||||
// if (that.time_count1 > 0) {
|
||||
// that.time_count1--;
|
||||
// that.SendCode_text1 = "重新发送" + that.time_count1 + "s";
|
||||
// } else {
|
||||
// that.SendCode_text1 = "获取验证码";
|
||||
// clearInterval(that.timer1);
|
||||
// that.timer1 = null;
|
||||
// this.isDisabled1 = false;
|
||||
// that.time_count1 = 60;
|
||||
// }
|
||||
// }, 1000);
|
||||
// }
|
||||
// this.$message({
|
||||
// message: "验证码已发送,请注意查收。",
|
||||
// type: "success",
|
||||
// });
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: res.msg,
|
||||
// type: "error",
|
||||
// });
|
||||
// }
|
||||
// }).catch(error => {
|
||||
// this.isGettingCode1 = false;
|
||||
// this.$message.error('验证码获取失败');
|
||||
// });
|
||||
// },
|
||||
|
||||
// 标签页点击事件
|
||||
handleClick(tab, event) {
|
||||
@ -939,11 +927,10 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// 打开重置密码对话框
|
||||
resetPassword() {
|
||||
this.dialogVisible = true;
|
||||
this.$refs.loginForm.resetFields();
|
||||
},
|
||||
// resetPassword() {
|
||||
// this.dialogVisible = true;
|
||||
// this.$refs.loginForm.resetFields();
|
||||
// },
|
||||
|
||||
// 跳转到注册页面
|
||||
handleRegister() {
|
||||
@ -951,41 +938,39 @@ export default {
|
||||
this.$router.push({ name: "registrationPage" });
|
||||
},
|
||||
|
||||
// 取消重置密码
|
||||
cancelReset() {
|
||||
this.dialogVisible = false;
|
||||
this.$refs.form.resetFields();
|
||||
},
|
||||
// cancelReset() {
|
||||
// this.dialogVisible = false;
|
||||
// this.$refs.form.resetFields();
|
||||
// },
|
||||
|
||||
// 提交重置密码
|
||||
handleSubmit() {
|
||||
let parmas = {
|
||||
id: this.form.id,
|
||||
password: this.form.password,
|
||||
codeid: this.form.codeid,
|
||||
vcode: this.form.vcode,
|
||||
};
|
||||
getPasswordCodeAPI(parmas).then((res) => {
|
||||
if (res.status == true) {
|
||||
this.$message({
|
||||
message: "密码重置成功",
|
||||
type: "success",
|
||||
});
|
||||
this.isDisabled1 = false;
|
||||
this.dialogVisible = false;
|
||||
this.SendCode_text1 = "获取验证码";
|
||||
clearInterval(this.timer1);
|
||||
this.timer1 = null;
|
||||
this.time_count1 = 60;
|
||||
this.$refs.form.resetFields();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// handleSubmit() {
|
||||
// let parmas = {
|
||||
// id: this.form.id,
|
||||
// password: this.form.password,
|
||||
// codeid: this.form.codeid,
|
||||
// vcode: this.form.vcode,
|
||||
// };
|
||||
// getPasswordCodeAPI(parmas).then((res) => {
|
||||
// if (res.status == true) {
|
||||
// this.$message({
|
||||
// message: "密码重置成功",
|
||||
// type: "success",
|
||||
// });
|
||||
// this.isDisabled1 = false;
|
||||
// this.dialogVisible = false;
|
||||
// this.SendCode_text1 = "获取验证码";
|
||||
// clearInterval(this.timer1);
|
||||
// this.timer1 = null;
|
||||
// this.time_count1 = 60;
|
||||
// this.$refs.form.resetFields();
|
||||
// } else {
|
||||
// this.$message({
|
||||
// message: res.msg,
|
||||
// type: "error",
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user