gongchunyi
17 小时以前 c2cc9c6da8944f332918503710123a29a3562adb
fix: 图片显示路径替换为link
已修改1个文件
12 ■■■■ 文件已修改
src/views/equipmentManagement/repair/index.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/equipmentManagement/repair/index.vue
@@ -229,6 +229,14 @@
  previewUrl: "",
});
const getFileAccessUrl = (file = {}) => {
  if (file?.link) {
    if (String(file.link).startsWith('http')) return file.link;
    return normalizeFileUrl(file.link);
  }
  return normalizeFileUrl(file?.url || '');
};
const normalizeFileUrl = (rawUrl = '') => {
  let fileUrl = rawUrl || '';
@@ -447,7 +455,7 @@
    attachment.fileList = attachment.files.map((item) => ({
      id: item.id,
      name: item.name,
      url: normalizeFileUrl(item.url),
      url: getFileAccessUrl(item),
    }));
  } finally {
    attachment.loading = false;
@@ -484,7 +492,7 @@
};
const handleAttachmentPreview = (file) => {
  const rawUrl = file?.url || file?.response?.data?.url || "";
  const rawUrl = file?.url || file?.response?.data?.link || file?.response?.data?.url || "";
  if (!rawUrl) {
    ElMessage.warning("图片地址无效,无法预览");
    return;