From d155f9015a98f12e7bb4acb68d07b30cd199de55 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 5 Mar 2021 11:30:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/Cropper/dialog.vue | 4 ++++ src/components/ShowFile/ShowFile.vue | 3 +++ src/views/setting/sys/cusomerInfo.vue | 13 +++++++++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1504ded..7e10d12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jmal-cloud-view", - "version": "2.1.7", + "version": "2.1.8", "description": "jmal cloud", "author": "Jmal ", "license": "MIT", diff --git a/src/components/Cropper/dialog.vue b/src/components/Cropper/dialog.vue index 3170940..bce8b4b 100644 --- a/src/components/Cropper/dialog.vue +++ b/src/components/Cropper/dialog.vue @@ -48,6 +48,7 @@ return { loading: true, cropper: null, + filename: '', sourceImg: '' } }, @@ -100,6 +101,8 @@ } }, changImg(file) { + console.log(file) + this.filename = file.name if(file.size > 0){ this.loading = true this.cropper.reset() @@ -122,6 +125,7 @@ }) let dataURL = cro.toDataURL('image/jpeg'); cro.toBlob((blob)=>{ + blob.name = this.filename this.$emit('croppedCanvas', dataURL, blob) }) }, diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 93d34a5..0360f26 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1767,6 +1767,9 @@ export default { }, // 填充数据 loadData(res, onLoad) { + if (!this.$refs.fileListTable) { + return + } if (onLoad) { res.data.forEach((file, number) => { file['index'] = (this.pagination.pageIndex - 1) * this.pagination.pageSize + number diff --git a/src/views/setting/sys/cusomerInfo.vue b/src/views/setting/sys/cusomerInfo.vue index 91ed689..7a4a451 100644 --- a/src/views/setting/sys/cusomerInfo.vue +++ b/src/views/setting/sys/cusomerInfo.vue @@ -166,6 +166,7 @@ } this.fileImg = files[0] this.dialogAvatar = true + this.selectedImgRow = {} if(this.$refs.cropperDialog){ this.$refs.cropperDialog.changImg(files[0]) } @@ -267,15 +268,23 @@ return data }, // 保存头像 - saveAvatar(dataURL,blob) { + saveAvatar(dataURL, blob) { this.dialogAvatar = false this.srcImage = dataURL let data = new FormData(); data.append('id', this.$store.state.user.userId) - data.append('avatar', dataURL) + // data.append('avatar', dataURL) + console.log(this.blobToFile(blob)) data.append('blobAvatar',blob) this.userUpdate(data,dataURL) }, + blobToFile(blob){ + return new window.File( + [blob], + blob.name, + { type: blob.type } + ) + }, // 保存不剪裁的头像 saveNoCropAvatar(fileId) { this.dialogAvatar = false