From 79556affbdff0fb0654deeb3d9826266c916f8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:43:22 +0800 Subject: [PATCH] fix: Fix the preview image error of child nodes (#9296) #9245 --- frontend/src/views/host/file-management/index.vue | 3 ++- frontend/src/views/host/file-management/preview/index.vue | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index eeb3c23bc..984096d96 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -623,7 +623,7 @@ const fileCreate = reactive({ path: '/', isDir: false, mode: 0o755 }); const fileCompress = reactive({ files: [''], name: '', dst: '', operate: 'compress' }); const fileDeCompress = reactive({ path: '', name: '', dst: '', mimeType: '' }); const fileEdit = reactive({ content: '', path: '', name: '', language: 'plaintext', extension: '' }); -const filePreview = reactive({ path: '', name: '', extension: '', fileType: '', imageFiles: [] }); +const filePreview = reactive({ path: '', name: '', extension: '', fileType: '', imageFiles: [], currentNode: '' }); const codeReq = reactive({ path: '', expand: false, page: 1, pageSize: 100, isDetail: false }); const fileUpload = reactive({ path: '' }); const fileRename = reactive({ path: '', oldName: '' }); @@ -1081,6 +1081,7 @@ const openPreview = (item: File.File, fileType: string) => { filePreview.extension = item.extension; filePreview.fileType = fileType; filePreview.imageFiles = imageFiles.value; + filePreview.currentNode = globalStore.currentNode; previewRef.value.acceptParams(filePreview); }; diff --git a/frontend/src/views/host/file-management/preview/index.vue b/frontend/src/views/host/file-management/preview/index.vue index 9ba432bba..77273268f 100644 --- a/frontend/src/views/host/file-management/preview/index.vue +++ b/frontend/src/views/host/file-management/preview/index.vue @@ -101,6 +101,7 @@ interface EditProps { name: string; extension: string; imageFiles: []; + currentNode: string; } const open = ref(false); @@ -109,6 +110,7 @@ const filePath = ref(''); const fileName = ref(''); const fileType = ref(''); const fileUrl = ref(''); +const currentNode = ref(''); const imageFiles = ref([]); const fileExtension = ref(''); @@ -140,7 +142,7 @@ const getDownloadUrl = (path: string) => { const baseUrl = `${import.meta.env.VITE_API_URL as string}/files/download`; const encodedPath = encodeURIComponent(path); const timestamp = new Date().getTime(); - return `${baseUrl}?path=${encodedPath}×tamp=${timestamp}`; + return `${baseUrl}?operateNode=${currentNode.value}&path=${encodedPath}×tamp=${timestamp}`; }; const acceptParams = (props: EditProps) => { @@ -149,6 +151,7 @@ const acceptParams = (props: EditProps) => { fileName.value = props.name; filePath.value = props.path; fileType.value = props.fileType; + currentNode.value = props.currentNode; isFullscreen.value = fileType.value === 'excel'; loading.value = true;