From a25d76d22a1fe0db329e7b634e540ca0908e20a2 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 23 四月 2026 13:36:26 +0800
Subject: [PATCH] fix: 图片显示路径修改
---
src/views/salesManagement/deliveryLedger/index.vue | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 0d0ea70..21a0c5a 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -193,10 +193,12 @@
<div class="detail-images" v-if="detailImages.length">
<div class="detail-images-title">鍙戣揣鍥剧墖</div>
- <ImagePreview
- :src="detailImages.map(i => i.url).join(',')"
- width="120px"
- height="120px"
+ <el-image
+ v-for="img in detailImages"
+ :key="img.url"
+ :src="img.url"
+ :preview-src-list="detailImages.map(i => i.url)"
+ fit="cover"
class="detail-image"
/>
</div>
@@ -245,28 +247,25 @@
const normalizeFileUrl = (rawUrl = '') => {
let fileUrl = rawUrl || '';
-
+ // Windows 璺緞杞� URL
if (fileUrl && fileUrl.indexOf('\\') > -1) {
- const lowerPath = fileUrl.toLowerCase();
- const uploadPathIndex = lowerPath.indexOf('uploadpath');
-
- if (uploadPathIndex > -1) {
- fileUrl = fileUrl
- .substring(uploadPathIndex)
- .replace(/\\/g, '/');
+ const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
+ if (uploadsIndex > -1) {
+ const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
+ fileUrl = '/' + relativePath;
} else {
- fileUrl = fileUrl.replace(/\\/g, '/');
+ const parts = fileUrl.split('\\');
+ const fileName = parts[parts.length - 1];
+ fileUrl = '/uploads/' + fileName;
}
}
- fileUrl = fileUrl.replace(/^\/?uploadPath/, '/profile');
-
- if (!fileUrl.startsWith('http')) {
+ if (fileUrl && !fileUrl.startsWith('http')) {
if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
fileUrl = javaApi + fileUrl;
}
-
return fileUrl;
};
+
// 涓婁紶閰嶇疆
const upload = reactive({
// 涓婁紶鐨勫湴鍧�
--
Gitblit v1.9.3