This commit is contained in:
hrx 2026-04-27 10:16:16 +08:00
parent 89fed5a6ea
commit f31a47f56c

View File

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