zhangwencui
5 天以前 b39e0358272ba224a7659fa2ed262c00e790ff0b
图片地址修正
已修改3个文件
34 ■■■■ 文件已修改
src/pages/equipmentManagement/upkeep/detail.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/equipmentManagement/upkeep/maintain.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/inspectionUpload/index.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/equipmentManagement/upkeep/detail.vue
@@ -196,11 +196,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}`;
  };
@@ -260,6 +260,7 @@
    // 处理附件数据 - 支持多种数据结构
    console.log(data.imagesFile);
    fileList.value = data.imagesFile;
    console.log(formatFileUrl(fileList.value[0].url));
  };
  // 返回上一页
src/pages/equipmentManagement/upkeep/maintain.vue
@@ -926,11 +926,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}`;
  };
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}`;
  };
  // 格式化文件大小