From 9e1e28591e0de5fa8f36abc144922e7809e60262 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 06 三月 2026 17:41:36 +0800
Subject: [PATCH] 图片预览问题

---
 src/pages/equipmentManagement/upkeep/detail.vue   |    4 ++--
 src/pages/inspectionUpload/index.vue              |    4 ++--
 src/pages/equipmentManagement/upkeep/maintain.vue |   49 +++++++++++++++++++++++++++++++------------------
 3 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/src/pages/equipmentManagement/upkeep/detail.vue b/src/pages/equipmentManagement/upkeep/detail.vue
index 042553f..44ead77 100644
--- a/src/pages/equipmentManagement/upkeep/detail.vue
+++ b/src/pages/equipmentManagement/upkeep/detail.vue
@@ -199,9 +199,9 @@
     const uploadsIndex = url.indexOf("uploads");
     if (uploadsIndex !== -1) {
       const relativePath = url.substring(uploadsIndex);
-      return `${config.baseUrl}/profile/${relativePath}`;
+      return `${config.baseUrl}/${relativePath}`;
     }
-    return `${config.baseUrl}/profile/${url}`;
+    return `${config.baseUrl}/${url}`;
   };
 
   // 鍒ゆ柇鏄惁涓哄浘鐗囨枃浠�
diff --git a/src/pages/equipmentManagement/upkeep/maintain.vue b/src/pages/equipmentManagement/upkeep/maintain.vue
index b745e83..610a185 100644
--- a/src/pages/equipmentManagement/upkeep/maintain.vue
+++ b/src/pages/equipmentManagement/upkeep/maintain.vue
@@ -123,8 +123,9 @@
                   :key="index"
                   class="file-item">
               <view class="file-preview-container">
+                {{formatFileUrl(file.url)}}
                 <image v-if="file.type === 'image' || isImageFile(file)"
-                       :src="file.url || file.tempFilePath || file.path || file.downloadUrl"
+                       :src="formatFileUrl(file.url || file.tempFilePath || file.path || file.downloadUrl)"
                        class="file-preview"
                        mode="aspectFill" />
                 <view v-else-if="file.type === 'video'"
@@ -634,26 +635,26 @@
   };
 
   // 鏍煎紡鍖栨枃浠禪RL
-  const formatFileUrl = url => {
-    if (!url) return "";
+  // const formatFileUrl = url => {
+  //   if (!url) return "";
 
-    // 濡傛灉宸茬粡鏄畬鏁寸殑URL锛坔ttp鎴杊ttps寮�澶达級锛岀洿鎺ヨ繑鍥�
-    if (url.startsWith("http://") || url.startsWith("https://")) {
-      return url;
-    }
+  //   // 濡傛灉宸茬粡鏄畬鏁寸殑URL锛坔ttp鎴杊ttps寮�澶达級锛岀洿鎺ヨ繑鍥�
+  //   if (url.startsWith("http://") || url.startsWith("https://")) {
+  //     return url;
+  //   }
 
-    // 濡傛灉鏄湰鍦拌矾寰勶紙濡� D:\\ruoyi\\prod\\uploads...锛夛紝闇�瑕佽浆鎹负缃戠粶URL
-    // 浠庤矾寰勪腑鎻愬彇uploads鍚庨潰鐨勯儴鍒�
-    const uploadsIndex = url.indexOf("uploads");
-    if (uploadsIndex !== -1) {
-      const relativePath = url.substring(uploadsIndex);
-      // 浣跨敤baseUrl + /profile/ + 鐩稿璺緞
-      return `http://192.168.1.35:8888/profile/${relativePath}`;
-    }
+  //   // 濡傛灉鏄湰鍦拌矾寰勶紙濡� D:\\ruoyi\\prod\\uploads...锛夛紝闇�瑕佽浆鎹负缃戠粶URL
+  //   // 浠庤矾寰勪腑鎻愬彇uploads鍚庨潰鐨勯儴鍒�
+  //   const uploadsIndex = url.indexOf("uploads");
+  //   if (uploadsIndex !== -1) {
+  //     const relativePath = url.substring(uploadsIndex);
+  //     // 浣跨敤baseUrl + /profile/ + 鐩稿璺緞
+  //     return `http://192.168.1.35:8888/profile/${relativePath}`;
+  //   }
 
-    // 鍏朵粬鎯呭喌锛屽皾璇曠洿鎺ユ嫾鎺�
-    return `http://192.168.1.35:8888/profile/${url}`;
-  };
+  //   // 鍏朵粬鎯呭喌锛屽皾璇曠洿鎺ユ嫾鎺�
+  //   return `http://192.168.1.35:8888/profile/${url}`;
+  // };
 
   // 鏍煎紡鍖栨枃浠跺ぇ灏�
   const formatFileSize = size => {
@@ -920,6 +921,18 @@
         uploadProgress.value = res.progress;
       });
     }
+  }; // 鏍煎紡鍖栨枃浠禪RL
+  const formatFileUrl = url => {
+    if (!url) return "";
+    if (url.startsWith("http://") || url.startsWith("https://")) {
+      return url;
+    }
+    const uploadsIndex = url.indexOf("uploads");
+    if (uploadsIndex !== -1) {
+      const relativePath = url.substring(uploadsIndex);
+      return `${config.baseUrl}/${relativePath}`;
+    }
+    return `${config.baseUrl}/${url}`;
   };
 
   // 涓婁紶鎴愬姛澶勭悊
diff --git a/src/pages/inspectionUpload/index.vue b/src/pages/inspectionUpload/index.vue
index 3db9924..d77e951 100644
--- a/src/pages/inspectionUpload/index.vue
+++ b/src/pages/inspectionUpload/index.vue
@@ -1599,9 +1599,9 @@
     const uploadsIndex = url.indexOf("uploads");
     if (uploadsIndex !== -1) {
       const relativePath = url.substring(uploadsIndex);
-      return `${config.baseUrl}/profile/${relativePath}`;
+      return `${config.baseUrl}/${relativePath}`;
     }
-    return `${config.baseUrl}/profile/${url}`;
+    return `${config.baseUrl}/${url}`;
   };
   // 鏍煎紡鍖栨枃浠跺ぇ灏�
   const formatFileSize = size => {

--
Gitblit v1.9.3