From 734123d37ece5db6add47a2a17e673e69194ae98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=B4=A0?= <66666@66.com> Date: Fri, 17 May 2024 14:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/env.development.js | 4 ++-- src/plugins/vant.js | 2 +- src/views/mine/changePassword.vue | 33 ++++++++++++++----------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/config/env.development.js b/src/config/env.development.js index 5fdf3f0..a8001a7 100644 --- a/src/config/env.development.js +++ b/src/config/env.development.js @@ -3,8 +3,8 @@ module.exports = { env: 'development', title: 'e联社区', baseUrl: 'http://192.168.1.144/', // 项目地址 - // baseApi: 'http://192.168.1.144/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' - baseApi: 'http://219.146.91.110:30801/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' + baseApi: 'http://192.168.1.144/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' + // baseApi: 'http://219.146.91.110:30801/api', // 本地api请求地址,注意:如果你使用了代理,请设置成'/' APPID: 'xxx', APPSECRET: 'xxx', } diff --git a/src/plugins/vant.js b/src/plugins/vant.js index 15af4b7..a6fa8e3 100644 --- a/src/plugins/vant.js +++ b/src/plugins/vant.js @@ -25,7 +25,7 @@ import { ActionSheet, Checkbox, CellGroup, - Form + Form, } from 'vant' Vue.use(Button) diff --git a/src/views/mine/changePassword.vue b/src/views/mine/changePassword.vue index 5d0fb83..61d3991 100644 --- a/src/views/mine/changePassword.vue +++ b/src/views/mine/changePassword.vue @@ -97,27 +97,24 @@ export default { if (this.errorMessages.oldPasswordError || this.errorMessages.newPasswordError || this.errorMessages.confirmPasswordError) { return; } - try { - let parms = { - oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword), - newPassword: encryptedData(this.pubKey, this.dataForm.newPassword), - confirmPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword), - } - let { code, data, msg } = changePassword(parms); - console.log(code, data, msg); - if (code === 0) { - localStorage.setItem("token", data.token); - this.$router.replace({ name: 'mine' }); - } else { - throw new Error(msg); - } - } catch (error) { - console.log(error.message); + let parms = { + oldPassword: encryptedData(this.pubKey, this.dataForm.oldPassword), + newPassword: encryptedData(this.pubKey, this.dataForm.newPassword), + confirmNewPassword: encryptedData(this.pubKey, this.dataForm.confirmPassword), } + changePassword(parms).then(response => { + let { data, code, msg } = response; + if(code === 0){ + console.log('data111'); + this.$toast('修改成功!请重新登录'); + this.$router.replace({name:'login'}) + } + }).catch(error => { + console.error('Error:', error); + }); } } }; - \ No newline at end of file + \ No newline at end of file