From 700b2246c75a1a94d5cbfe733c83ef9a3f317a62 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Tue, 12 May 2026 15:38:32 +0800 Subject: [PATCH] fix: confirmation dialog fires only once (remove duplicate listener), remove debug log --- internal/web/ui/templates/console.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/web/ui/templates/console.html b/internal/web/ui/templates/console.html index 489744b..c3eb187 100644 --- a/internal/web/ui/templates/console.html +++ b/internal/web/ui/templates/console.html @@ -339,8 +339,9 @@ updateSaveButton(); }; - // Confirmation dialog - document.getElementById('console-save-btn').addEventListener('click', function() { + // Confirmation dialog (one-shot listener using {once:true}) + var saveBtn = document.getElementById('console-save-btn'); + var confirmHandler = function() { if (!isDirty()) return; var summary = ''; document.querySelectorAll('.console-device-row').forEach(function(row) { @@ -356,7 +357,6 @@ }); }); if (!summary) { alert('未选择任何检测功能或视频源'); return; } - // Require at least one feature. var hasFeature = false; document.querySelectorAll('.console-device-row input[type=checkbox]:checked').forEach(function() { hasFeature = true; }); if (!hasFeature) { alert('请至少选择一项检测功能'); return; } @@ -376,8 +376,9 @@ document.getElementById('confirm-deploy-btn').addEventListener('click', function() { overlay.remove(); document.getElementById('console-form').submit(); - }); - }); + }, {once: true}); + }; + saveBtn.addEventListener('click', confirmHandler); // Show status from URL param, then clear the param so refresh doesn't repeat it. (function() {