From d789f6813538a3571c5b0c5eb7e0ec1e03b7a16e Mon Sep 17 00:00:00 2001 From: Lan Date: Mon, 24 Nov 2025 19:25:08 +0800 Subject: [PATCH] fix: https://github.com/vastsa/FileCodeBox/issues/420 --- src/services/index.ts | 2 +- src/views/manage/FileManageView.vue | 45 ----------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/src/services/index.ts b/src/services/index.ts index 4320647..536296c 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -78,7 +78,7 @@ export class FileService { } static async updateFile(data: FileEditForm): Promise { - return api.post('/admin/file/update', data) + return api.patch('/admin/file/update', data) } static async deleteAdminFile(id: number): Promise { diff --git a/src/views/manage/FileManageView.vue b/src/views/manage/FileManageView.vue index 3d86489..635df10 100644 --- a/src/views/manage/FileManageView.vue +++ b/src/views/manage/FileManageView.vue @@ -405,29 +405,6 @@ const handleUpdate = async () => { } } -// 下载文件处理 - 暂时移除未使用的函数 -// const downloadFile = async (id: number) => { -// try { -// const response = await FileService.downloadAdminFile(id) - -// const contentDisposition = response.headers['content-disposition'] -// let filename = 'file' -// const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/) -// if (filenameMatch != null && filenameMatch[1]) { -// filename = filenameMatch[1].replace(/['"]/g, '') -// } - -// // @ts-expect-error - showSaveFilePicker is not in standard Window interface -// if (window.showSaveFilePicker) { -// await saveFileByWebApi(response.data, filename) -// } else { -// await saveFileByElementA(response.data, filename) -// } -// } catch (error) { -// console.error('下载失败:', error) -// } -// } - // 删除文件处理 const deleteFile = async (id: number) => { try { @@ -438,28 +415,6 @@ const deleteFile = async (id: number) => { } } -// 文件保存辅助函数 - 暂时移除未使用的函数 -// async function saveFileByElementA(fileBlob: Blob, filename: string) { -// const downloadUrl = window.URL.createObjectURL(fileBlob) -// const link = document.createElement('a') -// link.href = downloadUrl -// link.download = filename -// document.body.appendChild(link) -// link.click() -// window.URL.revokeObjectURL(downloadUrl) -// document.body.removeChild(link) -// } - -// async function saveFileByWebApi(fileBlob: Blob, filename: string) { -// // @ts-expect-error - showSaveFilePicker is not in standard Window interface -// const newHandle = await window.showSaveFilePicker({ -// suggestedName: filename -// }) -// const writableStream = await newHandle.createWritable() -// await writableStream.write(fileBlob) -// await writableStream.close() -// } - // 加载文件列表 const loadFiles = async () => { try {