|
@@ -9,12 +9,12 @@
|
|
|
<uni-forms-item name="phonenumber" label="手机号码">
|
|
|
<uni-easyinput :inputBorder="false" type="number" v-model="phonenumber" placeholder="请输入手机号码" />
|
|
|
</uni-forms-item>
|
|
|
- <!-- <uni-forms-item name="code" label="验证码">
|
|
|
+ <uni-forms-item name="code" label="验证码">
|
|
|
<uni-easyinput :inputBorder="false" v-model="code" placeholder="请输入验证码" />
|
|
|
<view class="line flex0"></view>
|
|
|
<view v-if="timefalg" class="code act">{{time}}秒</view>
|
|
|
<view v-else @click="getCode" class="code">获取验证码</view>
|
|
|
- </uni-forms-item> -->
|
|
|
+ </uni-forms-item>
|
|
|
</view>
|
|
|
|
|
|
<view class="rbtn" @click="submit">开门</view>
|
|
@@ -85,57 +85,74 @@
|
|
|
that.$toast("请输入手机号")
|
|
|
return
|
|
|
}
|
|
|
+ if (!this.code ) {
|
|
|
+ that.$toast("请输入验证码")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.code!=this.newcode){
|
|
|
+ that.$toast("验证码错误,请重新输入")
|
|
|
+ return
|
|
|
+ }
|
|
|
let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
|
|
if (this.phonenumber && !regphone.test(this.phonenumber)) {
|
|
|
that.$toast("请输入正确的手机号")
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ that.timefalg=false;
|
|
|
+ that.time=60;
|
|
|
+ clearInterval(that.timer)
|
|
|
// this.getDataFn()
|
|
|
},
|
|
|
// getDetail(data){
|
|
|
// var s=base64.encode(data)
|
|
|
// this.$tab.navigateTo('/a/code?id='+s)
|
|
|
// },
|
|
|
- // getCode(){
|
|
|
- // var that=this;
|
|
|
- // if (!this.phonenumber ) {
|
|
|
- // that.$toast("请输入手机号")
|
|
|
- // return
|
|
|
- // }
|
|
|
- // let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
|
|
- // if (this.phonenumber && !regphone.test(this.phonenumber)) {
|
|
|
- // that.$toast("请输入正确的手机号")
|
|
|
- // return
|
|
|
- // }
|
|
|
- // sendSmsFn(this.phonenumber).then(res=>{
|
|
|
- // if (res.code == 200) {
|
|
|
- // // 发送验证码
|
|
|
- // that.$toast("发送成功")
|
|
|
- // that.newcode=res.msg
|
|
|
- // that.time=60;
|
|
|
- // that.timefalg=true;
|
|
|
- // that.setTimein()
|
|
|
- // } else {
|
|
|
- // that.$toast(res.msg)
|
|
|
- // }
|
|
|
- // // 判断是不是对等的
|
|
|
- // // that.getCodesend(that.phonenumber)
|
|
|
- // })
|
|
|
- // },
|
|
|
+ getCode(){
|
|
|
+ var that=this;
|
|
|
+ if (!this.phonenumber ) {
|
|
|
+ that.$toast("请输入手机号")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
|
|
+ if (this.phonenumber && !regphone.test(this.phonenumber)) {
|
|
|
+ that.$toast("请输入正确的手机号")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.$toast("发送成功")
|
|
|
+ that.newcode='1234'
|
|
|
+ that.time=60;
|
|
|
+ that.timefalg=true;
|
|
|
+ that.setTimein()
|
|
|
+ return
|
|
|
+
|
|
|
+ sendSmsFn(this.phonenumber).then(res=>{
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 发送验证码
|
|
|
+ that.$toast("发送成功")
|
|
|
+ that.newcode=res.msg
|
|
|
+ that.time=60;
|
|
|
+ that.timefalg=true;
|
|
|
+ that.setTimein()
|
|
|
+ } else {
|
|
|
+ that.$toast(res.msg)
|
|
|
+ }
|
|
|
+ // 判断是不是对等的
|
|
|
+ // that.getCodesend(that.phonenumber)
|
|
|
+ })
|
|
|
+ },
|
|
|
// 验证码倒计时
|
|
|
- // setTimein(){
|
|
|
- // var that=this;
|
|
|
- // clearInterval(that.timer)
|
|
|
- // that.timer=setInterval(()=>{
|
|
|
- // if(that.time<=1){
|
|
|
- // that.timefalg=false;
|
|
|
- // that.time=60;
|
|
|
- // clearInterval(that.timer)
|
|
|
- // }
|
|
|
- // that.time=that.time-1;
|
|
|
- // },1000)
|
|
|
- // },
|
|
|
+ setTimein(){
|
|
|
+ var that=this;
|
|
|
+ clearInterval(that.timer)
|
|
|
+ that.timer=setInterval(()=>{
|
|
|
+ if(that.time<=1){
|
|
|
+ that.timefalg=false;
|
|
|
+ that.time=60;
|
|
|
+ clearInterval(that.timer)
|
|
|
+ }
|
|
|
+ that.time=that.time-1;
|
|
|
+ },1000)
|
|
|
+ },
|
|
|
// getDataFn(){
|
|
|
// var params={
|
|
|
// visitPhone:this.phonenumber,
|