|
|
@ -36,7 +36,7 @@ |
|
|
|
oldpassword: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入密码', |
|
|
|
errorMessage: '请输入原密码', |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
@ -44,26 +44,26 @@ |
|
|
|
newpassword: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入密码', |
|
|
|
errorMessage: '请输入新密码', |
|
|
|
}, |
|
|
|
{ |
|
|
|
minLength: 6, |
|
|
|
maxLength: 20, |
|
|
|
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
} |
|
|
|
// { |
|
|
|
// minLength: 1, |
|
|
|
// maxLength: 100, |
|
|
|
// errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
// } |
|
|
|
] |
|
|
|
}, |
|
|
|
// 对email字段进行必填验证 |
|
|
|
newpassword2: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请输入密码', |
|
|
|
}, |
|
|
|
{ |
|
|
|
minLength: 6, |
|
|
|
maxLength: 20, |
|
|
|
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
errorMessage: '请输入新密码', |
|
|
|
}, |
|
|
|
// { |
|
|
|
// minLength: 1, |
|
|
|
// maxLength: 100, |
|
|
|
// errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', |
|
|
|
// }, |
|
|
|
{ |
|
|
|
validateFunction:function(rule,value,data,callback){ |
|
|
|
console.log(value !== data.newpassword) |
|
|
@ -91,11 +91,18 @@ |
|
|
|
// 触发提交表单 |
|
|
|
submit() { |
|
|
|
this.$refs.form.validate().then(res=>{ |
|
|
|
uni.showLoading({ |
|
|
|
title:"提交中", |
|
|
|
mask:true |
|
|
|
}) |
|
|
|
updateUserPwd(res.oldpassword,res.newpassword).then((ress)=>{ |
|
|
|
console.log('返回结果:', ress); |
|
|
|
uni.hideLoading() |
|
|
|
if(ress.data){ |
|
|
|
this.showCommitSuccessMessage("修改成功") |
|
|
|
} |
|
|
|
}).catch(error=>{ |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
}).catch(err =>{ |
|
|
|
console.log('表单错误信息:', err); |
|
|
@ -106,6 +113,10 @@ |
|
|
|
navigateBack(1) |
|
|
|
}) |
|
|
|
}, |
|
|
|
showErrorMessage(hint) { |
|
|
|
this.$refs.comMessage.showErrorMessage(hint, res => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|