From 5df732ffe16b3f162422c2db61a78458e28c7f8d Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期五, 10 十月 2025 14:45:29 +0800
Subject: [PATCH] 钥匙柜开发 天气预警通知
---
admin/src/components/common/UploadFaceImg.vue | 49 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/admin/src/components/common/UploadFaceImg.vue b/admin/src/components/common/UploadFaceImg.vue
index 5e72d18..467f672 100644
--- a/admin/src/components/common/UploadFaceImg.vue
+++ b/admin/src/components/common/UploadFaceImg.vue
@@ -19,13 +19,14 @@
:close-on-click-modal="false"
title="涓婁紶鍥剧墖"
:visible.sync="updateImg"
- width="800px"
+ 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
})
})
},
@@ -91,13 +110,13 @@
// 涓婁紶鍥剧墖
openUpdateIcon (file, fileList) {
const isJPG = file.raw.type === 'image/jpeg' || file.raw.type === 'image/png'
- const isLt2M = file.size / 1024 / 1024 < 2
+ const isLt2M = file.size / 1024 / 1024 < 5
if (!isJPG) {
this.$message.error('涓婁紶澶村儚鍥剧墖鍙兘鏄� JPG/PNG 鏍煎紡!')
return false
}
if (!isLt2M) {
- this.$message.error('涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!')
+ this.$message.error('涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 5MB!')
return false
}
// 涓婁紶鎴愬姛鍚庡皢鍥剧墖鍦板潃璧嬪�肩粰瑁佸壀妗嗘樉绀哄浘鐗�
--
Gitblit v1.9.3