From 7b577a283d1b81b9623eb22e9c3b0b2e76b5d985 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 17 Jul 2026 10:55:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(editor):=20=E7=89=87=E6=AE=B5=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=A4=B1=E8=B4=A5=E5=8A=A0=E6=8F=90=E7=A4=BA=20+=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=89=87=E6=AE=B5=E5=8A=A0=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - syncClipsToBackend 失败时提示用户,不再静默吞错 - 删除片段统一走 Modal.confirm 二次确认(时间轴✕按钮/右键菜单/顶栏退格/片段列表 4处入口全部生效) --- .../pages/editing-planner/EditingPlanner.tsx | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/web/src/pages/editing-planner/EditingPlanner.tsx b/apps/web/src/pages/editing-planner/EditingPlanner.tsx index 472231131..6c46ff45b 100755 --- a/apps/web/src/pages/editing-planner/EditingPlanner.tsx +++ b/apps/web/src/pages/editing-planner/EditingPlanner.tsx @@ -622,8 +622,17 @@ const EditingPlanner: React.FC = () => { }; const handleClipRemove = (clipId: string) => { - setClips((prev) => prev.filter((c) => c.id !== clipId)); - if (selectedClipId === clipId) setSelectedClipId(null); + Modal.confirm({ + title: "删除片段", + content: "确定要删除这个片段吗?此操作可通过撤销恢复。", + okText: "删除", + okType: "danger", + cancelText: "取消", + onOk: () => { + setClips((prev) => prev.filter((c) => c.id !== clipId)); + if (selectedClipId === clipId) setSelectedClipId(null); + }, + }); }; const handleClipUpdate = useCallback( @@ -1009,17 +1018,13 @@ const EditingPlanner: React.FC = () => { const syncClipsToBackend = async (planId: string): Promise => { if (clips.length === 0) return; - // 1. 获取后端现有片段 ID - try { - const existing = await getEditPlanClips(planId, { limit: 500 }); - if (existing.items.length > 0) { - await batchDeleteEditPlanClips( - planId, - existing.items.map((c) => c.id), - ); - } - } catch (err) { - console.warn("[获取后端片段失败,跳过删除]", err); + // 1. 获取并删除后端现有片段 + const existing = await getEditPlanClips(planId, { limit: 500 }); + if (existing.items.length > 0) { + await batchDeleteEditPlanClips( + planId, + existing.items.map((c) => c.id), + ); } // 2. 批量创建新片段(并发 3 个) @@ -1118,6 +1123,7 @@ const EditingPlanner: React.FC = () => { await syncClipsToBackend(planId); } catch (syncErr) { console.warn("[片段同步失败]", syncErr); + message.warning("片段同步失败,将使用模板默认配置生成"); // 同步失败不阻塞生成,后端有模板兜底 } -- 2.54.0