From cd23663b5290736240c159fd00453a80710dde6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Mon, 10 May 2021 17:59:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=90=E5=8A=9F/=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=90=8E=E6=97=A0=E6=B3=95=E6=B8=85=E7=A9=BA=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/src/pages/system/account/setting/info.vue | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Web/src/pages/system/account/setting/info.vue b/Web/src/pages/system/account/setting/info.vue index 12f82ed..6650fc6 100644 --- a/Web/src/pages/system/account/setting/info.vue +++ b/Web/src/pages/system/account/setting/info.vue @@ -4,16 +4,12 @@

我的信息

-
+

- - - - -
+
@@ -56,7 +52,7 @@ icon="check" type="primary" >确认 - 取消 + 取消 @@ -172,7 +168,6 @@ export default { form: {}, avatar: { - key: Date.now(), cropper: false, img: '', autoWidth: 200, @@ -223,6 +218,10 @@ export default { return false; }, + onAvatarStart() { + this.avatar.cropper = true; + }, + onAvatarOk() { this.avatar.uploading = true; this.$refs.cropper.getCropBlob(async (data) => { @@ -233,17 +232,35 @@ export default { const { data: fileId } = await this.$api.sysFileInfoUpload(fd); this.form.avatar = fileId; - this.avatar.cropper = false; + this.onAvatarCancel(); } finally { this.avatar.uploading = false; } }); }, + onAvatarCancel() { + this.avatar = { + ...this.avatar, + ...{ + cropper: false, + img: '', + preview: {}, + file: null, + }, + }; + }, + async onSaveInfo() { this.saving = true; try { - await this.$api.sysUserUpdateInfo(this.form); + await this.$api.sysUserUpdateInfo({ + avatar: this.form.avatar, + nickName: this.form.nickName, + birthday: this.form.birthday, + sex: this.form.sex, + tel: this.form.tel, + }); await this.onRefreshInfo(); this.$message.success('更新个人信息成功'); } finally {