From bcad3fe1b888ae11d437f6558b7974cfa30cfb2e Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 13 一月 2026 18:24:07 +0800
Subject: [PATCH] 经销商管理

---
 admin/src/components/common/UploadImage.vue |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/admin/src/components/common/UploadImage.vue b/admin/src/components/common/UploadImage.vue
index 5a6a876..2fc87b3 100644
--- a/admin/src/components/common/UploadImage.vue
+++ b/admin/src/components/common/UploadImage.vue
@@ -33,15 +33,15 @@
         </span>
       </div>
     </el-upload>
-    <el-image-viewer 
-      v-if="showViewer" 
+    <el-image-viewer
+      v-if="showViewer"
       :on-close="closeViewer"
       :initialIndex="tempIndex"
       :url-list="srcList"
       :z-index="3000"
     />
   </div>
-  
+
 </template>
 
 <script>
@@ -55,12 +55,15 @@
       type: Array,
       default: () => []
     },
+    maxNum: {
+      type: Number,
+      default: () => null
+    },
     uploadData: Object,
   },
   data() {
     return {
       uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadPicture',
-      
       realList: [],
       srcList: [],
       tempIndex: 0,
@@ -70,28 +73,34 @@
   watch: {
     fileList: {
       handler(val) {
-        console.log(val);
+        console.log("===================",val);
         if (val.length==0) {
           this.realList = []
           this.srcList = []
+        }else{
+          this.realList=val
+          val.forEach(item =>{
+            this.srcList.push(item.url)
+          })
         }
+
+        console.log("==================srcList=",this.srcList);
       }
-      
+
     }
   },
   methods: {
     beforeUpload(file) {
-      
       this.$emit('beginUpload')
       return true
     },
      // 涓婁紶鍥剧墖鎴愬姛
-     uploadSuccess (res, file, fileList) {     
-      // console.log('this.fileList', this.fileList);
+     uploadSuccess (res, file, fileList) {
+      console.log('this.fileList', this.fileList);
       // console.log('fileList', fileList);
       this.$emit('endUpload')
-      this.realList = fileList
-      this.srcList.push(res.data.url)
+      // this.realList = fileList
+      // this.srcList.push(res.data.url)
       // console.log('file', file);
       if (res.code === 200) {
         this.fileList.push(
@@ -110,7 +119,7 @@
       this.$message.error('涓婁紶澶辫触')
     },
     handlePictureCardPreview(file) {
-      this.tempIndex = this.srcList.findIndex(item => item == file.response.data.url )
+      this.tempIndex = this.srcList.findIndex(item => item == file.url )
       this.showViewer = true
     },
     closeViewer() {
@@ -118,12 +127,12 @@
     },
     handleRemove(file) {
       console.log(this.fileList);
-      let tempIndex = this.realList.findIndex(item => item.fileurl === file.response.data.imgaddr)
+      let tempIndex = this.realList.findIndex(item => item.fileurl === file.fileurl)
       // debugger
       this.realList.splice(tempIndex, 1)
       this.fileList.splice(tempIndex, 1)
       this.srcList.splice(tempIndex, 1)
-      
+
     },
   },
 }

--
Gitblit v1.9.3