From 4d9bf31260d457cbfb5b079f177ea1447f9a9019 Mon Sep 17 00:00:00 2001 From: Qiufeng Date: Fri, 21 Aug 2026 17:20:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20DialogPlugin=20=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=90=8E=E6=98=BE=E5=BC=8F=20hide()=20?= =?UTF-8?q?=E5=85=B3=E9=97=AD=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=AD=89=E6=93=8D=E4=BD=9C=E5=90=8E=E5=BC=B9=E7=AA=97=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E3=80=81=E5=88=97=E8=A1=A8=E7=9C=8B=E4=BC=BC=E4=B8=8D?= =?UTF-8?q?=E5=88=B7=E6=96=B0=EF=BC=9Brefresh=20=E5=8A=A0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=98=B2=E5=BE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sau_web_react/src/pages/Account/index.tsx | 14 +++++++++++--- sau_web_react/src/pages/ApiDocs/index.tsx | 4 +++- sau_web_react/src/pages/Material/index.tsx | 10 ++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sau_web_react/src/pages/Account/index.tsx b/sau_web_react/src/pages/Account/index.tsx index 7666cde..e884dee 100644 --- a/sau_web_react/src/pages/Account/index.tsx +++ b/sau_web_react/src/pages/Account/index.tsx @@ -79,7 +79,11 @@ const Account = () => { }); }, [accounts, filterPlatform, searchKeyword]); - const refresh = () => dispatch(loadAccounts()); + const refresh = () => { + dispatch(loadAccounts()).catch(() => { + // 刷新失败不阻塞,列表保持现状 + }); + }; const startCheck = async (ids: number[]) => { if (!ids.length) { @@ -126,7 +130,7 @@ const Account = () => { MessagePlugin.warning('请先选择账号'); return; } - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '批量删除', body: '确定删除选中的 ' + selectedRowKeys.length + ' 个账号?对应 Cookie 文件也会被删除。', confirmBtn: { content: '删除', theme: 'danger' }, @@ -138,13 +142,15 @@ const Account = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); }; const onDelete = (row: IAccount) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除账号', body: '确定删除账号「' + row.name + '」?对应 Cookie 文件也会被删除。', confirmBtn: { content: '删除', theme: 'danger' }, @@ -155,6 +161,8 @@ const Account = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); diff --git a/sau_web_react/src/pages/ApiDocs/index.tsx b/sau_web_react/src/pages/ApiDocs/index.tsx index e83feb8..13e7bed 100644 --- a/sau_web_react/src/pages/ApiDocs/index.tsx +++ b/sau_web_react/src/pages/ApiDocs/index.tsx @@ -153,7 +153,7 @@ const ApiDocs = () => { }; const onDeleteKey = (row: IApiKey) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除密钥', body: '删除后使用该密钥的外部系统将无法调用 API,确定删除?', confirmBtn: { content: '删除', theme: 'danger' }, @@ -164,6 +164,8 @@ const ApiDocs = () => { loadKeys(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); diff --git a/sau_web_react/src/pages/Material/index.tsx b/sau_web_react/src/pages/Material/index.tsx index 22b494f..60a047d 100644 --- a/sau_web_react/src/pages/Material/index.tsx +++ b/sau_web_react/src/pages/Material/index.tsx @@ -36,7 +36,11 @@ const Material = () => { dispatch(loadMaterials()); }, [dispatch]); - const refresh = () => dispatch(loadMaterials()); + const refresh = () => { + dispatch(loadMaterials()).catch(() => { + // 刷新失败不阻塞,列表保持现状 + }); + }; const onPickFiles = () => { fileInputRef.current?.click(); @@ -63,7 +67,7 @@ const Material = () => { }; const onDelete = (row: IMaterial) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除素材', body: '确定删除素材「' + row.filename + '」?', confirmBtn: { content: '删除', theme: 'danger' }, @@ -74,6 +78,8 @@ const Material = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, });