From 02255a3b02458652f67b8acd18a6c6e08b4aed29 Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 26 Jun 2026 23:25:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=90=E6=B3=A2/?= =?UTF-8?q?=E7=AA=81=E7=A0=B4=E6=BB=9A=E4=BB=93=E9=87=8D=E5=A4=8D=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- crypto_monitor_binance/templates/index.html | 2 +- crypto_monitor_gate/templates/index.html | 2 +- crypto_monitor_gate_bot/templates/index.html | 2 +- crypto_monitor_okx/templates/index.html | 2 +- embed_templates/embed_shell.html | 2 +- static/strategy_roll.js | 18 ++++++++++-------- strategy_templates/strategy_roll.html | 1 + strategy_templates/strategy_roll_panel.html | 1 - 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index 3c1dcb4..ccb96c1 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -834,7 +834,7 @@ - + - + - + - + - + {% include 'embed_boot_scripts.html' %} diff --git a/static/strategy_roll.js b/static/strategy_roll.js index 85779e8..fddaa01 100644 --- a/static/strategy_roll.js +++ b/static/strategy_roll.js @@ -32,6 +32,8 @@ const form = document.getElementById("roll-form"); if (!form) return; + if (form.dataset.rollJsInit === "1") return; + form.dataset.rollJsInit = "1"; const symbolSel = document.getElementById("roll-symbol"); const dirInput = document.getElementById("roll-direction"); @@ -47,7 +49,7 @@ let countdownTimer = null; let previewOk = false; let lastPreviewMode = ""; - let allowMonitorSubmit = false; + let monitorSubmitting = false; function isMarketMode() { return (modeSel.value || "market") === "market"; @@ -99,6 +101,7 @@ previewBox.classList.add("is-error"); previewText.textContent = msg || "无法执行"; if (countdownEl) countdownEl.style.display = "none"; + previewBox.scrollIntoView({ behavior: "smooth", block: "nearest" }); } function showPreviewResult(p) { @@ -133,7 +136,7 @@ function resetPreview() { previewOk = false; - allowMonitorSubmit = false; + monitorSubmitting = false; clearMessageBox(); if (countdownTimer) { clearInterval(countdownTimer); @@ -193,13 +196,16 @@ } function runMonitorSubmit() { + if (monitorSubmitting) return; if (!symbolSel.value) { showReject("请先选择持仓币种"); return; } + monitorSubmitting = true; if (submitBtn) submitBtn.disabled = true; requestPreview() .then(function (data) { + monitorSubmitting = false; if (submitBtn && !trendLocked) submitBtn.disabled = false; if (!data.ok) { showReject(data.msg || "无法提交监控"); @@ -217,10 +223,10 @@ if (!confirm("确认提交「" + modeLabel + "」?\n" + summary)) { return; } - allowMonitorSubmit = true; - form.requestSubmit(); + form.submit(); }) .catch(function () { + monitorSubmitting = false; if (submitBtn && !trendLocked) submitBtn.disabled = false; showReject("校验请求失败,请稍后重试"); }); @@ -258,10 +264,6 @@ if (previewBtn) previewBtn.addEventListener("click", runPreview); form.addEventListener("submit", function (e) { if (isMonitorMode()) { - if (allowMonitorSubmit) { - allowMonitorSubmit = false; - return; - } e.preventDefault(); runMonitorSubmit(); return; diff --git a/strategy_templates/strategy_roll.html b/strategy_templates/strategy_roll.html index 1c12d93..fa3509a 100644 --- a/strategy_templates/strategy_roll.html +++ b/strategy_templates/strategy_roll.html @@ -14,5 +14,6 @@ {% include 'strategy_roll_panel.html' %}

顺势加仓完整逻辑说明

+ diff --git a/strategy_templates/strategy_roll_panel.html b/strategy_templates/strategy_roll_panel.html index 4e02a36..fbbaf3e 100644 --- a/strategy_templates/strategy_roll_panel.html +++ b/strategy_templates/strategy_roll_panel.html @@ -101,4 +101,3 @@ -