點擊發送驗證碼
validateBtn() {
if (!/^1[3456789]\d{9}$/.test(this.mobile)){
this.isshow=true
this.msg="手機號碼格式錯誤"
return false
}else{
this.isshow=false;
}
codesend({
phone: this.mobile,
})
.then(res => {
if (res.data.code === 1) {
console.log(res)
uid = res.data.data.uuId;
sessionStorage.setItem("uuId", res.data.data.uuId)
let time = 60;
let timer = setInterval(() => {
if (time == 0) {
clearInterval(timer);
this.disabled = false;
this.btnTitle = "獲取驗證碼";
} else {
this.btnTitle = time + '秒后重試';
this.disabled = true;
time--
}
}, 1000)
} else {}
})
.catch(err => { //請求錯誤后執行函
})
},