zhangwencui
5 天以前 6b0dacaccba1c5ee2b431a80d44673ec81eb94c8
src/pages/inspectionUpload/index.vue
@@ -282,7 +282,7 @@
                      @click="previewAttachment(file)">
                  <view class="attachment-preview-container">
                    <image v-if="file.type === 'image' || isImageFile(file)"
                           :src="file.url || file.downloadUrl"
                           :src="formatFileUrl(file.url || file.downloadUrl)"
                           class="attachment-preview"
                           mode="aspectFill" />
                    <view v-else
@@ -1589,7 +1589,19 @@
  const uploadedSuccessfully = () => {
    // 此函数已不再使用,文件上传成功后立即添加到对应分类
  };
  // 格式化文件URL
  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.fileUrl}/${relativePath}`;
    }
    return `${config.fileUrl}/${url}`;
  };
  // 格式化文件大小
  const formatFileSize = size => {
    if (!size) return "";