提交 422bcf2f 编写于 作者: M m0_74163447

密码判定

上级 9c05343f
......@@ -145,18 +145,17 @@
// })
// }
// },
savaInfo() {
savaInfo () {
uni.showModal({
title: '温馨提示', //提示标题
content: '确认修改你的个人信息吗', //提示内容
showCancel: true, //是否显示取消按钮
success: function(res) {
success:res => {
if (res.confirm) { //confirm为ture,代表用户点击确定
let that = this;
let nickname = that.nickName;
let mobile = that.mobile;
// let updata = {};
if (!nickname) {
uni.showToast({
......@@ -173,7 +172,7 @@
// updata.headimg = headimg;
// updata.gender = gender;
if (that.isPoneAvailable(mobile)) {
updata.mobile = mobile;
// updata.mobile = mobile;
} else {
uni.showToast({
title: '手机号码有误,请重填',
......@@ -191,6 +190,7 @@
})
},
isPoneAvailable(poneInput) {
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
if (!myreg.test(poneInput)) {
......
......@@ -18,11 +18,13 @@
</veiw>
<veiw class="password">
<span>&ensp;&ensp;码:</span>
<input placeholder="请输入新密码" type="text" :password="showPassword" name="input"></input>
<input placeholder="请输入新密码" type="text" @input="bindNewPassword" :password="showPassword"
name="input"></input>
</veiw>
<veiw class="password">
<span>确认密码:</span>
<input placeholder="请确认密码" type="text" :password="showPassword" name="input"></input>
<input placeholder="请确认密码" type="text" @input="bindConfirmPassword" :password="showPassword"
name="input"></input>
</veiw>
</view>
<view class="confirm">
......@@ -36,9 +38,17 @@
data() {
return {
showPassword: true,
newPassword: '',
confirmPassword: '',
}
},
methods: {
bindNewPassword(e) {
this.newPassword = e.detail.value;
},
bindConfirmPassword(e) {
this.confirmPassword = e.detail.value;
},
// showPwd: function() {
// this.showPassword = !this.showPassword;
// },
......@@ -48,21 +58,58 @@
title: '温馨提示', //提示标题
content: '确认修改密码吗', //提示内容
showCancel: true, //是否显示取消按钮
success: function(res) {
success: res => {
if (res.confirm) { //confirm为ture,代表用户点击确定
console.log('点击了确定按钮');
let that = this;
let newPassword = that.newPassword;
let confirmPassword = that.confirmPassword;
if (!that.isPasswordAvailable(newPassword)) {
uni.showToast({
title: '密码长度在8-20位!',
icon: 'none',
duration: 2000
});
return;
} else if (!that.isConfirmPasswordAvailable(newPassword, confirmPassword)) {
uni.showToast({
title: '两次密码不一致',
icon: 'none',
duration: 2000
});
return;
} else {
// updata.mobile = mobile;
//return;
}
} else if (res.cancel) { //cancel为ture,代表用户点击取消
console.log('点击了取消按钮');
}
}
})
},
isPasswordAvailable(newPassword) {
if (newPassword.length > 20 || newPassword.length < 8) {
return false;
} else {
return true;
}
},
isConfirmPasswordAvailable(newPassword, confirmPassword) {
if (newPassword == confirmPassword) {
return true;
} else {
return false;
}
},
goBack() {
uni.navigateBack({
delta: 1, //返回层数,2则上上页
})
},
onload(){
onload() {
plus.navigator.setStatusBarBackground('#EDEEF0');
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册