zhangwencui
5 天以前 4a68a94d5e429eca8b01a24bdbf601c0331ff73d
src/pages/inspectionUpload/index.vue
@@ -281,6 +281,7 @@
                      class="attachment-item"
                      @click="previewAttachment(file)">
                  <view class="attachment-preview-container">
                    <!-- {{formatFileUrl(file.url || file.downloadUrl)}} -->
                    <image v-if="file.type === 'image' || isImageFile(file)"
                           :src="formatFileUrl(file.url || file.downloadUrl)"
                           class="attachment-preview"
@@ -1053,7 +1054,7 @@
  };
  // 文件访问基础域(后端要求前缀)
  const filePreviewBase = config.baseUrl;
  const filePreviewBase = config.fileUrl;
  // 将后端返回的文件地址规范成可访问URL
  // 兼容场景:
@@ -1595,11 +1596,11 @@
    if (url.startsWith("http://") || url.startsWith("https://")) {
      return url;
    }
    const uploadsIndex = url.indexOf("uploads");
    if (uploadsIndex !== -1) {
      const relativePath = url.substring(uploadsIndex);
      return `${config.fileUrl}/${relativePath}`;
    }
    // const uploadsIndex = url.indexOf("uploads");
    // if (uploadsIndex !== -1) {
    //   const relativePath = url.substring(uploadsIndex);
    //   return `${config.fileUrl}/${relativePath}`;
    // }
    return `${config.fileUrl}/${url}`;
  };
  // 格式化文件大小