/* *获取短信验证码
*/ getCodenumber() { if(this.phoneRight) { let countdown = 60; document.querySelector(".btnCode").setAttribute("disabled",true) function count() { if(countdown == 0) { clearInterval(t) document.querySelector(".btnCode").removeAttribute("disabled") document.querySelector(".btnCode").innerhtml = "重新获取" return false }else{ countdown-- document.querySelector(".btnCode").innerHTML = ‘已发送‘ +countdown + "s" } } this.t = setInterval(function() { count() },1000) API.common.regPhone({ "phoneNum": this.phone, }).then((res) => { if(res.code == "0") { document.querySelector(".codeTips").innerHTML = "验证码已发送到您的手机上,有效时间为30分钟,请及时收查。" }else { alert(res) } console.log(res) }).catch((error) => { console.log(error) }) }else { this.$message.error(‘请输入手机号‘) } }, /* *正则匹配手机号格式 */ checkMobile(sMobile) { if(!(/0?(13|14|15|17|18|19)[0-9]{9}/.test(sMobile))){ this.codeTips = ‘请输入正确的手机号!‘ this.phoneRight = false return false; } else{ this.phoneRight = true } },