// 判定输入为非空字符
formSubmit: function (e) {
var that = this;
var phone = e.detail.value.phone;
var vip = e.detail.value.vip;
var reg = new RegExp('^(13[0-9]|15[0-9]|17[0-9]|18[0-9])\\d{8}$');
// console.log(vip,phone)
if (phone.length === 0 || vip.length === 0) {
wx.showModal({
title: '提示',
content: '请输入完整信息!',
})
} else if (!reg.exec(phone)) {
wx.showToast({
icon: 'none',
title: '输入正确手机号',
})
} else {
//请求接口
}
},
// 手机号部分
inputPhoneNum: function (e) {
let phoneNumber = e.detail.value
if (phoneNumber.length === 11) {
let checkedNum = this.checkPhoneNum(phoneNumber)
}
},
checkPhoneNum: function (phoneNumber) {
var reg = new RegExp('^(13[0-9]|15[0-9]|17[0-9]|18[0-9])\\d{8}$');
if (reg.test(phoneNumber)) {
return true
} else {
this.setData({
correct: false
})
setTimeout(() => {
this.setData({
correct: true
})
}, 1500);
return false
}
},
小程序的密码隐藏显示password="true"
<view class="weui-cell">
<view class="weui-cell__bd">
<input password='{{isShowPassword}}' placeholder="新密码,至少6位英文数字结合" placeholder-class='placeholder_class' />
</view>
<view class="weui-cell__ft get_qrcode" bindtap='toggleShowPassword'>
<image src='../../image/28.png' wx:if='{{isShowPassword}}' />
<image src='../../image/29.png' wx:if='{{!isShowPassword}}' />
</view>
</view>
Page({
data: {
isShowPassword: true
},
toggleShowPassword: function (e) {
var isShowPassword = !this.data.isShowPassword;
this.setData({
isShowPassword: isShowPassword
});
}
})