Browse Source

修改密码限制输入长度

dev_pda
李俊城 2 years ago
parent
commit
e05290311e
  1. 26
      fe/PDA/pages/setter/passwordpage.vue

26
fe/PDA/pages/setter/passwordpage.vue

@ -35,8 +35,8 @@
errorMessage: '请输入密码', errorMessage: '请输入密码',
}, },
{ {
minLength: 3, minLength: 6,
maxLength: 5, maxLength: 16,
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符',
} }
] ]
@ -48,8 +48,8 @@
errorMessage: '请输入密码', errorMessage: '请输入密码',
}, },
{ {
minLength: 3, minLength: 6,
maxLength: 5, maxLength: 16,
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符',
} }
] ]
@ -61,8 +61,8 @@
errorMessage: '请输入密码', errorMessage: '请输入密码',
}, },
{ {
minLength: 3, minLength: 6,
maxLength: 5, maxLength: 16,
errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符', errorMessage: '密码长度在 {minLength} 到 {maxLength} 个字符',
}, },
{ {
@ -91,15 +91,27 @@
// }, // },
// //
submit() { submit() {
if(localStorage.userName=="admin"){
uni.showToast({
title:"admin 用户密码不能修改"
})
return;
}
this.$refs.form.validate().then(res=>{ this.$refs.form.validate().then(res=>{
console.log(res) console.log(res)
let params = { let params = {
newPassword:res.newpassword, newPassword:res.newpassword,
currentPassword:res.oldpassword currentPassword:res.oldpassword
} }
changePassword(params).then((ress)=>{ changePassword(params).then((ress)=>{
console.log('返回结果:', ress); console.log('返回结果:', ress);
uni.showToast({
title:"密码修改成功"
})
}).catch(error=>{
uni.showToast({
title:error.message
})
}) })
}).catch(err =>{ }).catch(err =>{
console.log('表单错误信息:', err); console.log('表单错误信息:', err);

Loading…
Cancel
Save