From 31ad6b60f22011cdf3d4ef1b1bcdf4304b58bc09 Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Fri, 29 Nov 2024 16:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/httpRequest3.js | 12 +++++----- src/pages/setter/passwordpage.vue | 39 ++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/api/httpRequest3.js b/src/api/httpRequest3.js index 23d1c340..cc300aff 100644 --- a/src/api/httpRequest3.js +++ b/src/api/httpRequest3.js @@ -47,12 +47,12 @@ function service(options = {}) { url: '/pages/login/index' }) } - if (res.data.code == 1002000008) { - uni.setStorageSync('username',options.data.username) - uni.reLaunch({ - url: '/pages/setter/loginPwdUpdate' - }) - } + // if (res.data.code == 1002000008) { + // uni.setStorageSync('username',options.data.username) + // uni.reLaunch({ + // url: '/pages/setter/loginPwdUpdate' + // }) + // } if (res.data.msg) { if (res.data.msg.includes('get lock')) { reject("系统异常:状态码["+res.statusCode +"]\n"+"数据库死锁") diff --git a/src/pages/setter/passwordpage.vue b/src/pages/setter/passwordpage.vue index 8a2fa82d..339f0189 100644 --- a/src/pages/setter/passwordpage.vue +++ b/src/pages/setter/passwordpage.vue @@ -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 => { + }) + }, } }