fix: Fix the preview image error of child nodes (#9296)

#9245
This commit is contained in:
2025-06-26 14:43:22 +08:00 committed by GitHub
parent 9cba19d4db
commit 79556affbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -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);
};

View file

@ -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}&timestamp=${timestamp}`;
return `${baseUrl}?operateNode=${currentNode.value}&path=${encodedPath}&timestamp=${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;