From 056ea576d820729878ffd62cd54cd7598e72d07e Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 29 七月 2025 16:07:31 +0800
Subject: [PATCH] 新增图片超出限制,无法选中功能

---
 src/views/overlay-clue/report/components/QuestionDetail.vue |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/views/overlay-clue/report/components/QuestionDetail.vue b/src/views/overlay-clue/report/components/QuestionDetail.vue
index 7352c04..5e8e57b 100644
--- a/src/views/overlay-clue/report/components/QuestionDetail.vue
+++ b/src/views/overlay-clue/report/components/QuestionDetail.vue
@@ -90,9 +90,10 @@
           <el-icon><Plus /></el-icon>
           <template #file="{ file }">
             <div>
-              <img
+              <el-image
                 class="el-upload-list__item-thumbnail"
                 :src="file.url"
+                fit="cover"
                 alt=""
               />
               <span class="el-upload-list__item-actions">
@@ -122,7 +123,7 @@
           <template #tip>
             <div class="el-upload__tip">
               {{
-                `璇烽�夋嫨灏忎簬500kb鐨刯pg/png鍥剧墖锛屾渶澶�${maxImageCount}寮燻
+                `璇烽�夋嫨灏忎簬5MB鐨刯pg/png鍥剧墖锛屾渶澶�${maxImageCount}寮燻
               }}
             </div>
           </template>
@@ -150,9 +151,7 @@
   <MapSearch
     v-model:show="mapDialogShow"
     :defaultCoor="
-      formObj.coordinate
-        ? formObj.coordinate.split(',')
-        : undefined
+      formObj.coordinate ? formObj.coordinate.split(',') : undefined
     "
     @on-submit="selectAddress"
   ></MapSearch>
@@ -166,6 +165,9 @@
 import clueQuestionApi from '@/api/clue/clueQuestionApi';
 import { $clue } from '@/api/index';
 import MapSearch from '@/components/map/MapSearch.vue';
+
+// 鍥剧墖闄愬畾澶у皬锛堝崟浣嶏細B锛�
+const IMG_MAX_SIZE = 4 * 1024 * 1024;
 
 // 鍐冲畾褰撳墠鏄惁鏄唴閮ㄧ嚎绱㈢浉鍏虫搷浣�
 const isInternal = inject('isInternal', false);
@@ -246,7 +248,18 @@
 }
 
 function handleFileChange(file, files) {
-  fileList.value = files;
+  // console.log('fileSelect', file);
+  // 鍒ゆ柇
+  if (file.size > IMG_MAX_SIZE) {
+    const index = files.indexOf(file);
+    files.splice(index, 1);
+    ElMessage({
+      message: '鍥剧墖澶у皬瓒呰繃闄愬埗',
+      type: 'error'
+    });
+  } else {
+    fileList.value = files;
+  }
   edit.value = true;
 }
 

--
Gitblit v1.9.3