From 567b824c43e8fa9206f82e89354d46422f0dff5a Mon Sep 17 00:00:00 2001 From: ZLY Date: Mon, 26 Jan 2026 15:42:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(apps):=20=E6=9B=B4=E6=96=B0=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AEID=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/apps.ts | 11 +++++++++-- src/pages/ideContainer/sideBar.tsx | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/api/apps.ts b/src/api/apps.ts index 1269819..0c89d85 100644 --- a/src/api/apps.ts +++ b/src/api/apps.ts @@ -55,8 +55,15 @@ export function copyApp(data: any) { } // 导入应用 -export function importApp(file: File) { - return axios.post(`${urlPrefix}/apps/import`, { file }); +export function importApp(params: { file: File, projectId: string }) { + const formData = new FormData(); + formData.append('file', params.file); + + return axios.post(`${urlPrefix}/apps/import/${params.projectId}`, formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }); } // 导出应用 diff --git a/src/pages/ideContainer/sideBar.tsx b/src/pages/ideContainer/sideBar.tsx index 74fee80..1cd9da9 100644 --- a/src/pages/ideContainer/sideBar.tsx +++ b/src/pages/ideContainer/sideBar.tsx @@ -1017,7 +1017,10 @@ const SideBar: React.FC = ({ try { setImporting(true); - const res: any = await importApp(importFile); + const res: any = await importApp({ + file: importFile, + projectId: info.id + }); if (res.code === 200) { Message.success('应用导入成功');