|
@@ -23,7 +23,8 @@ export default {
|
|
isFetchingCode: false,
|
|
isFetchingCode: false,
|
|
codeContent: "获取验证码",
|
|
codeContent: "获取验证码",
|
|
codeWaitingTime,
|
|
codeWaitingTime,
|
|
- time: codeWaitingTime
|
|
|
|
|
|
+ time: codeWaitingTime,
|
|
|
|
+ setT: null
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -53,7 +54,7 @@ export default {
|
|
if (!this.isFetchingCode) return;
|
|
if (!this.isFetchingCode) return;
|
|
this.codeContent = "倒计时" + this.time + "s";
|
|
this.codeContent = "倒计时" + this.time + "s";
|
|
const circleTime = time => {
|
|
const circleTime = time => {
|
|
- let t = setInterval(() => {
|
|
|
|
|
|
+ this.setT = setInterval(() => {
|
|
if (time > 1) {
|
|
if (time > 1) {
|
|
time--;
|
|
time--;
|
|
let expire = new Date().getTime() + time * 1000;
|
|
let expire = new Date().getTime() + time * 1000;
|
|
@@ -67,15 +68,18 @@ export default {
|
|
);
|
|
);
|
|
this.codeContent = "倒计时" + time + "s";
|
|
this.codeContent = "倒计时" + time + "s";
|
|
} else {
|
|
} else {
|
|
- this.time = this.codeWaitingTime;
|
|
|
|
- wstorage.remove(this.nameWaitTime);
|
|
|
|
- this.codeContent = "获取验证码";
|
|
|
|
- this.isFetchingCode = false;
|
|
|
|
- clearInterval(t);
|
|
|
|
|
|
+ this.clearSetContent();
|
|
}
|
|
}
|
|
}, 1e3);
|
|
}, 1e3);
|
|
};
|
|
};
|
|
circleTime(this.time);
|
|
circleTime(this.time);
|
|
|
|
+ },
|
|
|
|
+ clearSetContent() {
|
|
|
|
+ this.time = this.codeWaitingTime;
|
|
|
|
+ wstorage.remove(this.nameWaitTime);
|
|
|
|
+ this.codeContent = "获取验证码";
|
|
|
|
+ this.isFetchingCode = false;
|
|
|
|
+ clearInterval(this.setT);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|