From 42bb8f644516ae17257b7654cf6ec38fb529506c Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 29 Nov 2023 12:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=B4=E5=83=8F=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=8F=82=E6=95=B0=E6=96=B0=E5=A2=9E=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/user/profile/userAvatar.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index 96aa01f4..cbf3ca19 100644 --- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -70,12 +70,13 @@ export default { // 弹出层标题 title: "修改头像", options: { - img: store.getters.avatar, //裁剪图片的地址 - autoCrop: true, // 是否默认生成截图框 - autoCropWidth: 200, // 默认生成截图框宽度 - autoCropHeight: 200, // 默认生成截图框高度 - fixedBox: true, // 固定截图框大小 不允许改变 - outputType:"png" // 默认生成截图为PNG格式 + img: store.getters.avatar, //裁剪图片的地址 + autoCrop: true, // 是否默认生成截图框 + autoCropWidth: 200, // 默认生成截图框宽度 + autoCropHeight: 200, // 默认生成截图框高度 + fixedBox: true, // 固定截图框大小 不允许改变 + outputType:"png", // 默认生成截图为PNG格式 + filename: 'avatar' // 文件名称 }, previews: {}, resizeHandler: null @@ -125,6 +126,7 @@ export default { reader.readAsDataURL(file); reader.onload = () => { this.options.img = reader.result; + this.options.filename = file.name; }; } }, @@ -132,7 +134,7 @@ export default { uploadImg() { this.$refs.cropper.getCropBlob(data => { let formData = new FormData(); - formData.append("avatarfile", data); + formData.append("avatarfile", data, this.options.filename); uploadAvatar(formData).then(response => { this.open = false; this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;