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/maintain.vue | 49 +++++++++++++++++++++++++++++++------------------
1 files changed, 31 insertions(+), 18 deletions(-)
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}`;
};
// 涓婁紶鎴愬姛澶勭悊
--
Gitblit v1.9.3