fix(web): DialogPlugin 弹窗操作后显式 hide() 关闭,修复删除等操作后弹窗残留、列表看似不刷新;refresh 加异常防御

This commit is contained in:
Qiufeng
2026-08-21 17:20:14 +08:00
parent 9295e715b5
commit 4d9bf31260
3 changed files with 22 additions and 6 deletions
+11 -3
View File
@@ -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();
}
},
});
+3 -1
View File
@@ -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();
}
},
});
+8 -2
View File
@@ -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();
}
},
});