From 5a887de6f43868eedffd6e3811a24237ce2dc808 Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 26 Jun 2026 23:07:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=BB=9A=E4=BB=93=E6=96=90=E6=B3=A2/?= =?UTF-8?q?=E7=AA=81=E7=A0=B4=E4=BB=B7=E8=BE=93=E5=85=A5=E6=A1=86=E5=8F=AF?= =?UTF-8?q?=E5=9C=A8=E5=88=87=E6=8D=A2=E6=A8=A1=E5=BC=8F=E5=90=8E=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= 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/instance_theme.css | 4 -- static/strategy_roll.js | 52 +++++++++++--------- strategy_templates/strategy_roll_panel.html | 14 +++--- 8 files changed, 42 insertions(+), 38 deletions(-) diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index 29b02ca..3953607 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/instance_theme.css b/static/instance_theme.css index c4dbed6..98f60da 100644 --- a/static/instance_theme.css +++ b/static/instance_theme.css @@ -1305,10 +1305,6 @@ html[data-theme="light"] .detail-actions { align-items: center; } -.roll-field[hidden] { - display: none !important; -} - #strategy-roll-panel .roll-risk-banner { margin-bottom: 8px; color: #8fc8ff; diff --git a/static/strategy_roll.js b/static/strategy_roll.js index 47b38ae..c4c8d02 100644 --- a/static/strategy_roll.js +++ b/static/strategy_roll.js @@ -1,6 +1,35 @@ (function () { "use strict"; + function syncRollFormMode(form, mode) { + if (!form) return; + const m = mode || "market"; + form.setAttribute("data-add-mode", m); + const showFib = m === "fib_618" || m === "fib_786"; + const showBreakout = m === "breakout"; + const fibWrap = form.querySelector(".roll-field-fib"); + const breakoutWrap = form.querySelector(".roll-field-breakout"); + const fibUpper = form.querySelector("#roll-fib-upper"); + const fibLower = form.querySelector("#roll-fib-lower"); + const breakoutInput = form.querySelector("#roll-breakout"); + + function tuneInput(inp, active, required) { + if (!inp) return; + inp.disabled = !active; + inp.required = !!required && active; + inp.tabIndex = active ? 0 : -1; + if (!active) inp.value = ""; + } + + if (fibWrap) fibWrap.setAttribute("aria-hidden", showFib ? "false" : "true"); + if (breakoutWrap) breakoutWrap.setAttribute("aria-hidden", showBreakout ? "false" : "true"); + tuneInput(fibUpper, showFib, showFib); + tuneInput(fibLower, showFib, showFib); + tuneInput(breakoutInput, showBreakout, showBreakout); + } + + window.syncRollFormMode = syncRollFormMode; + const form = document.getElementById("roll-form"); if (!form) return; @@ -13,11 +42,6 @@ const previewBox = document.getElementById("roll-preview-box"); const previewText = document.getElementById("roll-preview-text"); const countdownEl = document.getElementById("roll-countdown"); - const fibWrap = form.querySelector(".roll-field-fib"); - const breakoutWrap = form.querySelector(".roll-field-breakout"); - const fibUpper = document.getElementById("roll-fib-upper"); - const fibLower = document.getElementById("roll-fib-lower"); - const breakoutInput = document.getElementById("roll-breakout"); let countdownTimer = null; let previewOk = false; @@ -40,24 +64,8 @@ "当前风险:" + rp + "%(来自监控单 #" + (opt.getAttribute("data-monitor-id") || "?") + ")"; } - function setFieldGroup(wrap, inputs, visible, required) { - if (!wrap) return; - wrap.hidden = !visible; - inputs.forEach(function (inp) { - if (!inp) return; - inp.disabled = !visible; - inp.required = !!required && visible; - if (!visible) inp.value = ""; - }); - } - function syncFieldVisibility() { - const mode = modeSel.value || "market"; - form.setAttribute("data-add-mode", mode); - const showFib = mode === "fib_618" || mode === "fib_786"; - const showBreakout = mode === "breakout"; - setFieldGroup(fibWrap, [fibUpper, fibLower], showFib, showFib); - setFieldGroup(breakoutWrap, [breakoutInput], showBreakout, showBreakout); + syncRollFormMode(form, modeSel.value || "market"); resetPreview(); } diff --git a/strategy_templates/strategy_roll_panel.html b/strategy_templates/strategy_roll_panel.html index 791e3e7..3d52d7f 100644 --- a/strategy_templates/strategy_roll_panel.html +++ b/strategy_templates/strategy_roll_panel.html @@ -30,18 +30,18 @@ {% endfor %} - -