//点击事件执行getcode后需要禁用点击倒计时完成激活点击事件
Page({
data: {
codetime:"获取验证码",
close:""
},
//获取验证码
getcode:function(){
var that = this;
that.setData({
codetime:60,
close: setInterval(that.gettime, 1000)
});
},
gettime:function(){
var that = this;
if (that.data.codetime == 0) {
//清除js定时器
clearInterval(that.data.close);
that.setData({
codetime: "获取验证码",
});
} else {
that.setData({
codetime: --that.data.codetime,
});
}
}
})