From 6d26a6b3397f6433fe070de72381887151950158 Mon Sep 17 00:00:00 2001 From: pyt <626651354@qq.com> Date: 星期四, 03 四月 2025 09:09:58 +0800 Subject: [PATCH] feat --- src/component/userInfo.vue | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/src/component/userInfo.vue b/src/component/userInfo.vue index 993c728..8a585bf 100644 --- a/src/component/userInfo.vue +++ b/src/component/userInfo.vue @@ -184,6 +184,7 @@ </el-form-item> </el-col> </el-row> + </el-form> <div class="btns"> <el-button @click="$emit('close')">关闭 | Close</el-button> @@ -229,6 +230,14 @@ } }, methods: { + // 验证确认密码 + validateConfirmPassword(rule, value, callback) { + if (value !== this.form.newPassword) { + callback(new Error('两次输入的密码不一致')); + } else { + callback(); + } + }, // 提交 submit() { this.$refs.form.validate((valid) => { @@ -243,9 +252,22 @@ emails: this.form.otherEmails, addressInfos: this.form.contactInfoList } + + // 如果有修改密码,添加密码相关参数 + if (this.form.oldPassword && this.form.newPassword) { + params.password = { + oldPassword: this.form.oldPassword, + newPassword: this.form.newPassword + } + } + saveUserInfo(params).then(res => { this.$message.success('保存成功') this.$store.commit('SET_USERNAME', this.form.userName) + // 清空密码字段 + this.form.oldPassword = '' + this.form.newPassword = '' + this.form.confirmPassword = '' }) } }) -- Gitblit v1.7.1