From 2a33f742520020c50f8484d2e733f1f290d969b6 Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 12 Aug 2026 16:17:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BF=BB=E5=80=8D=E5=80=8D?= =?UTF-8?q?=E6=95=B0=E6=97=A0=E6=B3=95=E6=89=8B=E8=BE=93=EF=BC=9A=E6=9C=AA?= =?UTF-8?q?=E5=8B=BE=E9=80=89=E5=BC=80=E5=90=AF=E6=97=B6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=20disabled=EF=BC=8C=E5=BA=94=E7=94=A8/=E5=8B=BE=E9=80=89?= =?UTF-8?q?=E5=8F=AA=E6=8E=A7=E5=88=B6=E6=98=AF=E5=90=A6=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- lib/common/static/options_panel.js | 28 ++++++++++++++---------- lib/options/templates/options_panel.html | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/common/static/options_panel.js b/lib/common/static/options_panel.js index 14f79dc..b546ea1 100644 --- a/lib/common/static/options_panel.js +++ b/lib/common/static/options_panel.js @@ -1570,7 +1570,8 @@ '" + '" + + '" min="0.1" step="0.1" value="' + mult + + '" autocomplete="off" inputmode="decimal" data-lpignore="true" data-1p-ignore="true">' + '" + @@ -1790,14 +1791,14 @@ }); container.querySelectorAll(".opt-pos-profit-exit-enabled").forEach(function (cb) { cb.addEventListener("click", function (e) { e.stopPropagation(); }); - cb.addEventListener("change", function () { - const row = cb.closest(".opt-profit-exit-pos-row"); - const multInp = row && row.querySelector(".opt-pos-profit-exit-mult"); - if (multInp) multInp.disabled = !cb.checked; - }); }); container.querySelectorAll(".opt-pos-profit-exit-mult").forEach(function (inp) { + // 倍数随时可改;「开启/应用」只控制是否监控,不再因未勾选而 disabled + inp.disabled = false; + inp.removeAttribute("readonly"); inp.addEventListener("click", function (e) { e.stopPropagation(); }); + inp.addEventListener("mousedown", function (e) { e.stopPropagation(); }); + inp.addEventListener("focus", function (e) { e.stopPropagation(); }); inp.addEventListener("keydown", function (e) { if (e.key === "Enter") { e.preventDefault(); @@ -1906,7 +1907,10 @@ const mode = btn && btn.getAttribute("data-mode"); let enabled = !!(enabledEl && enabledEl.checked); if (mode === "cancel") enabled = false; - if (mode === "apply") enabled = true; + if (mode === "apply") { + enabled = true; + if (enabledEl) enabledEl.checked = true; + } let mult = 1; if (enabled) { mult = parseFloat(multEl ? multEl.value : "1"); @@ -2518,12 +2522,12 @@ const peCb = document.getElementById("opt-profit-exit-enabled"); const peMult = document.getElementById("opt-profit-exit-mult"); if (!peCb || !peMult) return; - function sync() { - peMult.disabled = !peCb.checked; + // 倍数始终可手输;勾选只决定开仓是否带上翻倍出场 + peMult.disabled = false; + peMult.removeAttribute("readonly"); + peCb.addEventListener("change", function () { if (peCb.checked && (!peMult.value || Number(peMult.value) <= 0)) peMult.value = "1"; - } - peCb.addEventListener("change", sync); - sync(); + }); })(); document.querySelectorAll('input[name="opt-size-mode"]').forEach(function (r) { diff --git a/lib/options/templates/options_panel.html b/lib/options/templates/options_panel.html index 29b2422..91261e8 100644 --- a/lib/options/templates/options_panel.html +++ b/lib/options/templates/options_panel.html @@ -132,7 +132,7 @@ 翻倍出场 - 1倍=盈利等于权利金(可回收≥2×权利金);可开可关,与目标位并行 @@ -350,4 +350,4 @@ - +