From cb78b4fbcd31bbee7ed7882c7b5f6f660f20c511 Mon Sep 17 00:00:00 2001 From: doum <doum> Date: 星期一, 20 十月 2025 09:56:19 +0800 Subject: [PATCH] 最新版本541200007 --- admin/src/components/common/UploadFaceImg.vue | 43 +++++++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 12 deletions(-) diff --git a/admin/src/components/common/UploadFaceImg.vue b/admin/src/components/common/UploadFaceImg.vue index 4bc0b0d..467f672 100644 --- a/admin/src/components/common/UploadFaceImg.vue +++ b/admin/src/components/common/UploadFaceImg.vue @@ -21,11 +21,12 @@ :visible.sync="updateImg" width="1000px" class="icon-dialog-wrapper dialong-com-style"> - <ImageCropper ref="iconShot" v-if="updateImg" :imgSrc="img" > + <ImageCropper ref="iconShot" v-if="updateImg" :imgSrc="img" :auto-crop="autoCrop"> </ImageCropper> <span slot="footer" class="dialog-footer"> - <el-button @click="updateImg = false">鍙� 娑�</el-button> - <el-button type="primary" @click="uploadIcon">纭� 瀹�</el-button> + <el-button v-if="loading">鍙� 娑�</el-button> + <el-button v-else @click="updateImg = false">鍙� 娑�</el-button> + <el-button :loading="loading" type="primary" @click="uploadIcon">纭� 瀹�</el-button> </span> </el-dialog> </div> @@ -41,7 +42,17 @@ type: Object, default: () => {} }, - tipsLabel: '', + autoCrop: { + type: Object, + default () { + return { width: 500, height: 500 } + } + }, + // eslint-disable-next-line vue/require-prop-type-constructor + tipsLabel: { + type: String, + default: '' + }, customStyle: { type: String, default: 'width: 90px; height: 90px;' @@ -50,7 +61,8 @@ }, data () { return { - fileInfo:{}, + loading: false, + fileInfo: {}, img: null, updateImg: false, imageSrc: null, @@ -66,16 +78,21 @@ console.log(fileData) const formData = new FormData() - formData.append('folder', 'member') + formData.append('folder', this.uploadData.folder || 'member') + if (this.uploadData.isFace || this.uploadData.isFace == 0) { + formData.append('isFace', 0) + } formData.append( - 'file', - new File( - [fileData], // 灏咮lob绫诲瀷杞寲鎴怓ile绫诲瀷 - this.fileInfo.name, // 璁剧疆File绫诲瀷鐨勬枃浠跺悕绉� - { type: this.fileInfo.type } // 璁剧疆File绫诲瀷鐨勬枃浠剁被鍨� - ) + 'file', + new File( + [fileData], // 灏咮lob绫诲瀷杞寲鎴怓ile绫诲瀷 + this.fileInfo.name, // 璁剧疆File绫诲瀷鐨勬枃浠跺悕绉� + { type: this.fileInfo.type } // 璁剧疆File绫诲瀷鐨勬枃浠剁被鍨� + ) ) + this.loading = true upload(formData).then(res => { + this.loading = false console.log(res) this.file.imgurl = res.imgaddr this.file.imgurlfull = res.url @@ -84,6 +101,8 @@ this.updateImg = false this.$emit('uploadSuccess', { imgurl: res.imgaddr, imgurlfull: res.url, name: res.originname }) this.$emit('uploadEnd') + }, () => { + this.loading = false }) }) }, -- Gitblit v1.9.3