修复提现定时器未清除问题

This commit is contained in:
YeMingfei666 2024-12-19 16:20:00 +08:00
parent 35eaae83dc
commit 491e0f1ae2
1 changed files with 7 additions and 4 deletions

View File

@ -941,14 +941,15 @@ export default {
reset() { reset() {
console.log("reset"); console.log("reset");
this.msg = ""; this.msg = "";
this.timer = null;
clearInterval(this.timer);
this.msgTime = 60; this.msgTime = 60;
clearInterval(this.timer);
this.timer = null;
}, },
sendMsg() { sendMsg() {
if (this.msgTime < 60) { if (this.msgTime < 60) {
return; return;
} }
var that = this;
this.$http({ this.$http({
// url: this.$http.adornUrl('app/Login/sendMsg/'+this.tableData.mobile+'/regis'), // url: this.$http.adornUrl('app/Login/sendMsg/'+this.tableData.mobile+'/regis'),
url: this.$http.adornUrl( url: this.$http.adornUrl(
@ -963,7 +964,9 @@ export default {
type: "success", type: "success",
}); });
this.msgTime--; this.msgTime--;
this.timer = setInterval(() => { clearInterval(this.timer);
that.timer = setInterval(() => {
console.log(this.msgTime);
this.msgTime--; this.msgTime--;
if (this.msgTime == 0) { if (this.msgTime == 0) {
clearInterval(this.timer); clearInterval(this.timer);
@ -972,7 +975,7 @@ export default {
}, 1000); }, 1000);
} else { } else {
this.$message({ this.$message({
message: res.data.msg|| "发送失败", message: res.data.msg || "发送失败",
type: "error", type: "error",
}); });
} }