|
|
|
@ -110,31 +110,41 @@ Page({ |
|
|
|
sendFlag: false, |
|
|
|
codeId: res.data.id |
|
|
|
}) |
|
|
|
// 获取成功之后需要马上改变成倒计时
|
|
|
|
let time = 59; |
|
|
|
var timer = setInterval(() => { |
|
|
|
// 倒计时结束需要重置可发送验证码状态和按钮文字
|
|
|
|
if (time < 0) { |
|
|
|
// 清除定时器
|
|
|
|
clearInterval(timer) |
|
|
|
this.setData({ |
|
|
|
buttonText: "重新发送", |
|
|
|
sendFlag: true |
|
|
|
}) |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
this.changeImgCode() |
|
|
|
this.setData({ |
|
|
|
buttonText: time + "秒后重新发送" |
|
|
|
picCode: "" |
|
|
|
}) |
|
|
|
wx.showModal({ |
|
|
|
content: res.msg, |
|
|
|
showCancel: false, |
|
|
|
}) |
|
|
|
time--; |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
// this.setData({
|
|
|
|
// buttonText: "重新发送",
|
|
|
|
// sendFlag: true
|
|
|
|
// })
|
|
|
|
} |
|
|
|
else { |
|
|
|
|
|
|
|
// 获取成功之后需要马上改变成倒计时
|
|
|
|
let time = 59; |
|
|
|
var timer = setInterval(() => { |
|
|
|
// 倒计时结束需要重置可发送验证码状态和按钮文字
|
|
|
|
if (time < 0) { |
|
|
|
// 清除定时器
|
|
|
|
clearInterval(timer) |
|
|
|
this.setData({ |
|
|
|
buttonText: "重新发送", |
|
|
|
sendFlag: true |
|
|
|
}) |
|
|
|
return false; |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
buttonText: "重新发送", |
|
|
|
sendFlag: true |
|
|
|
buttonText: time + "秒后重新发送" |
|
|
|
}) |
|
|
|
} |
|
|
|
time--; |
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}) |
|
|
|
// wx.navigateToMiniProgram({
|
|
|
|
|