Browse Source

修改密码修改

hella_online_20241205
lijuncheng 2 months ago
parent
commit
31ad6b60f2
  1. 12
      src/api/httpRequest3.js
  2. 39
      src/pages/setter/passwordpage.vue

12
src/api/httpRequest3.js

@ -47,12 +47,12 @@ function service(options = {}) {
url: '/pages/login/index' url: '/pages/login/index'
}) })
} }
if (res.data.code == 1002000008) { // if (res.data.code == 1002000008) {
uni.setStorageSync('username',options.data.username) // uni.setStorageSync('username',options.data.username)
uni.reLaunch({ // uni.reLaunch({
url: '/pages/setter/loginPwdUpdate' // url: '/pages/setter/loginPwdUpdate'
}) // })
} // }
if (res.data.msg) { if (res.data.msg) {
if (res.data.msg.includes('get lock')) { if (res.data.msg.includes('get lock')) {
reject("系统异常:状态码["+res.statusCode +"]\n"+"数据库死锁") reject("系统异常:状态码["+res.statusCode +"]\n"+"数据库死锁")

39
src/pages/setter/passwordpage.vue

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

Loading…
Cancel
Save