feat(ui): 全局弹窗替代原生 alert/confirm,添加防重复提交与搜索功能

- 新增 ConfirmModal / ResultModal 全局组件,替代原生 alert/confirm/prompt
- 资产/平台/账号保存添加防重复提交锁(assetSaving / providerSaving)
- 添加 Esc 键盘快捷键关闭模态框
- 平台/监控视图添加搜索过滤功能
- 修复监控中心 SSL TAB 下新增按钮的显示逻辑
- 调整 toast 位置避免遮挡底部导航
- 统一各弹窗 z-index 层级
This commit is contained in:
gouki
2026-10-17 21:17:18 +00:00
parent a63fcb786f
commit eeb05372c4
7 changed files with 167 additions and 48 deletions
+6 -6
View File
@@ -131,19 +131,19 @@ const DomainsView = {
}
async function saveSub(a) {
const f = forms[a.id];
if (!f.host.trim()) { alert('请填写主机名'); return; }
if (!f.host.trim()) { showResult('提示', '请填写主机名', true); return; }
const payload = { host: f.host.trim(), record_type: f.record_type, record_value: f.record_value, note: f.note, is_active: !!f.is_active };
try {
if (f.editing) await Api.put('/subdomains/' + f.editing, payload);
else await Api.post('/subdomains', { ...payload, asset_id: a.id });
await loadSubdomains();
resetForm(a);
} catch (e) { alert('保存失败:' + e.message); }
} catch (e) { showResult('保存失败', e.message, true); }
}
async function delSub(s) {
if (!confirm('删除子域名「' + s.host + '」?')) return;
if (!await showConfirm('删除子域名', '删除子域名「' + s.host + '」?', true)) return;
try { await Api.del('/subdomains/' + s.id); await loadSubdomains(); }
catch (e) { alert('删除失败:' + e.message); }
catch (e) { showResult('删除失败', e.message, true); }
}
async function probeSsl(defaultHost, a) {
const target = prompt('探测 SSL 证书的站点(留空取消):', defaultHost);
@@ -151,8 +151,8 @@ const DomainsView = {
try {
await Api.post('/site-certs', { hostname: target, asset_id: a.id });
await loadSiteCerts();
alert('已探测:' + target);
} catch (e) { alert('探测失败:' + e.message); }
showResult('探测成功', '已探测:' + target);
} catch (e) { showResult('探测失败', e.message, true); }
}
function certText(c) {
// 统一走 Fmt.countdownText:不再自己维护一份,也避免负数直出「-3天」