From 2001258ef47b8d7c39af25d4b914851a48155b18 Mon Sep 17 00:00:00 2001 From: Ran_Chen <1908198662@qq.com> Date: Mon, 24 Mar 2025 18:08:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BF=AE=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/src/apis/module/user.js | 35 ++++- .../src/components/ChangePasswordDialog.vue | 141 ++++++++++++++++++ main/manager-web/src/components/HeaderBar.vue | 31 ++-- 3 files changed, 187 insertions(+), 20 deletions(-) create mode 100644 main/manager-web/src/components/ChangePasswordDialog.vue diff --git a/main/manager-web/src/apis/module/user.js b/main/manager-web/src/apis/module/user.js index 2e9bc6e2..0c917a63 100755 --- a/main/manager-web/src/apis/module/user.js +++ b/main/manager-web/src/apis/module/user.js @@ -43,9 +43,9 @@ export default { }) .fail(() => { RequestService.reAjaxFun(() => { - this.unbindDevice(device_id, callback); + this.unbindDevice(device_id, callback); }); - }).send() + }).send() }, // 绑定设备 bindDevice(deviceCode, callback) { @@ -71,9 +71,9 @@ export default { .method('GET') .type('blob') .header({ - 'Content-Type': 'image/gif', - 'Pragma': 'No-cache', - 'Cache-Control': 'no-cache' + 'Content-Type': 'image/gif', + 'Pragma': 'No-cache', + 'Cache-Control': 'no-cache' }) .success((res) => { RequestService.clearRequestTime(); @@ -173,7 +173,7 @@ export default { this.getAgentList(callback); }); }).send(); - }, + }, getUserInfo(callback) { RequestService.sendRequest() @@ -195,7 +195,7 @@ export default { RequestService.sendRequest() .url(`${getServiceUrl()}/api/v1/user/agent`) .method('POST') - .data({ name: agentName }) + .data({name: agentName}) .success((res) => { RequestService.clearRequestTime(); callback(res); @@ -221,5 +221,24 @@ export default { }); }).send(); }, - + // API接口代码修改 + changePassword(oldPassword, newPassword, successCallback, errorCallback) { + RequestService.sendRequest() + .url(`${getServiceUrl()}/api/v1/user/change-password`) // 修改URL + .method('PUT') // 修改方法为PUT + .data({ + old_password: oldPassword, // 修改参数名 + new_password: newPassword // 修改参数名 + }) + .success((res) => { + RequestService.clearRequestTime(); + successCallback(res); + }) + .fail((error) => { + RequestService.reAjaxFun(() => { + this.changePassword(oldPassword, newPassword, successCallback, errorCallback); + }); + }) + .send(); + }, } diff --git a/main/manager-web/src/components/ChangePasswordDialog.vue b/main/manager-web/src/components/ChangePasswordDialog.vue new file mode 100644 index 00000000..19c20fd6 --- /dev/null +++ b/main/manager-web/src/components/ChangePasswordDialog.vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file diff --git a/main/manager-web/src/components/HeaderBar.vue b/main/manager-web/src/components/HeaderBar.vue index a8dff30c..dcaa3c0b 100644 --- a/main/manager-web/src/components/HeaderBar.vue +++ b/main/manager-web/src/components/HeaderBar.vue @@ -25,25 +25,31 @@ - {{ userInfo.username }} + {{ userInfo.username || '加载中...' }} 个人中心 - 修改密码 + 修改密码 退出登录 + + + @@ -181,4 +188,4 @@ export default { color: #3d4566; } - + \ No newline at end of file