From f7e53299150f295e8c1300efbdb010cbd43199f3 Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 9 Aug 2026 08:49:24 +0800 Subject: [PATCH] fix(hedge): hide mode-specific fields and default to option-primary Co-authored-by: Cursor --- lib/common/static/hedge_plan.js | 6 ++++- lib/common/static/instance_theme.css | 5 +++++ .../templates/hedge_plan_panel.html | 22 +++++++++---------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/common/static/hedge_plan.js b/lib/common/static/hedge_plan.js index 5f2a13c..7eace0d 100644 --- a/lib/common/static/hedge_plan.js +++ b/lib/common/static/hedge_plan.js @@ -37,7 +37,7 @@ ooCloseModeEnabled: root.getAttribute("data-oo-close-mode-enabled") !== "0", ooCloseMode: "close_all", direction: "long", - optionPrimary: false, + optionPrimary: true, opLevTouched: false, opRatioTouched: false, tradingUsdc: null, @@ -279,15 +279,18 @@ }); const ins = $("hp-po-fields-insurance"); const op = $("hp-po-fields-option-primary"); + // 保险模式只显示开仓价/张数/止盈止损;以期权为主只显示权利金等执行参数 if (ins) { ins.classList.toggle("hidden", on); if (on) ins.setAttribute("hidden", "hidden"); else ins.removeAttribute("hidden"); + ins.style.display = on ? "none" : ""; } if (op) { op.classList.toggle("hidden", !on); if (!on) op.setAttribute("hidden", "hidden"); else op.removeAttribute("hidden"); + op.style.display = on ? "" : "none"; } const otmBtn = document.querySelector(".hp-money-otm"); if (otmBtn) { @@ -2533,5 +2536,6 @@ applyBudgetBuffer(state.budgetBuffer); updateOoBudgetLine(null); bind(); + syncOptionPrimaryUI(); void refreshAll(); })(); diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 4d43019..3749967 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -3480,6 +3480,11 @@ html[data-theme="light"] .opt-be-dist-down { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06); } +/* display:grid 会盖掉 [hidden];模式切换必须显式 none */ +.hedge-plan-page-wrap .hp-po-fields.hidden, +.hedge-plan-page-wrap .hp-po-fields[hidden] { + display: none !important; +} .hedge-plan-page-wrap .hp-po-field { display: flex; flex-direction: column; diff --git a/lib/hedge_plan/templates/hedge_plan_panel.html b/lib/hedge_plan/templates/hedge_plan_panel.html index c39ffde..866643d 100644 --- a/lib/hedge_plan/templates/hedge_plan_panel.html +++ b/lib/hedge_plan/templates/hedge_plan_panel.html @@ -43,7 +43,7 @@
-

永续 · ETH 合约账户

+

执行参数 · ETH 合约账户

规则说明
@@ -57,18 +57,18 @@
- - + +
- - + +
标记 —

加载中…

-
+ -
-

期权 · Put 期权账户

- +

期权 · Call 期权账户

+

- + 指数 — @@ -368,4 +368,4 @@
- +