![在这里插入图片描述](https://img-blog.csdnimg.cn/f71b81140d6c4d8fbdb4530ff751e996.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5pyJ5LqL5rKh5LqL56CB5LiA56CB77yB,size_9,color_FFFFFF,t_70,g_se,x_16#pic_center)
1.判断如果存在手机号则多一个input框为旧手机号栏
<view class="fnListRowBetweenCenter">
<view class="fnListRowCenter" style="margin: 20rpx 0;">
<view><text>新手机号码</text></view>
</view>
<input class="passwordInput" type="text" value="" v-model="newPhone" @input="phoneModel('newPhone',$event)" placeholder="请输入手机号码" />
</view>
<view class="fnListRowBetweenCenter">
<view class="fnListRowCenter" style="margin: 20rpx 0;">
<view><text>验证码</text></view>
</view>
<input class="passwordInput" type="text" value="" v-model="code" @input="phoneModel('code',$event)"
placeholder="请输入验证码" style="width: 28%;"/>
<view class="code" v-show="sendAuthCode" :disabled="isDisable" @click="getCode">获取验证码</view>
<view class="code" v-show="!sendAuthCode" :disabled="isDisable">{{ auth_time }}秒后重新获取</view>
</view>
<button class='bottom' @click="submit">立即绑定</button>
2.点击验证码倒计时60s
this.sendAuthCode = false;
this.auth_time = 60;
var auth_timetimer = setInterval(() => {
this.auth_time--;
if (this.auth_time <= 0) {
this.sendAuthCode = true;
clearInterval(auth_timetimer);
}
}, 1000);
3.手机格式中间四位变成*
computed: {
phone() {
const reg = /^(\d{3})\d{4}(\d{4})$/
return this.userInfo.phoneNumber.replace(reg, '$1****$2')
}
}