From 56df9a596fdd48ee1793ad93256087ff905abbf4 Mon Sep 17 00:00:00 2001 From: dekun Date: Wed, 30 Sep 2026 23:28:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E5=AF=BC=E8=88=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8E=E9=A1=B6=E6=A0=8F=E5=8E=BB=E6=8E=89=E3=80=8C=E5=AF=B9?= =?UTF-8?q?=E5=86=B2=E8=AE=A1=E5=88=92=E3=80=8D=E5=BC=80=E5=85=B3=E4=B8=8E?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=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/instance_settings_prefs.js | 10 ++++++---- lib/instance/instance_display_prefs_lib.py | 8 ++------ lib/instance/instance_embed_lib.py | 3 +-- lib/instance/templates/embed_page_fragment.html | 2 -- lib/instance/templates/embed_shell.html | 11 +---------- lib/instance/templates/index.html | 7 +------ tests/test_remove_hedge_smoke.py | 9 +++++++++ 7 files changed, 20 insertions(+), 30 deletions(-) diff --git a/lib/common/static/instance_settings_prefs.js b/lib/common/static/instance_settings_prefs.js index 362ab9f..e2c97cb 100644 --- a/lib/common/static/instance_settings_prefs.js +++ b/lib/common/static/instance_settings_prefs.js @@ -46,8 +46,6 @@ options: "show_nav_options", "options-review": "show_nav_options_review", options_review: "show_nav_options_review", - "hedge-plan": "show_nav_hedge_plan", - hedge_plan: "show_nav_hedge_plan", risk_policy: "show_nav_risk_policy", system_guide: "show_nav_system_guide", env_config: "show_nav_env_config", @@ -59,6 +57,11 @@ .forEach((a) => { const tab = a.getAttribute("data-embed-tab") || (a.getAttribute("href") || "").replace(/^\//, "").split("?")[0]; if (tab === "more") return; + if (tab === "hedge_plan" || tab === "hedge-plan") { + a.classList.add("nav-hidden"); + a.style.display = "none"; + return; + } const key = map[tab]; if (!key) return; const show = navPrefShow(display, key); @@ -70,6 +73,7 @@ function pageNavAllowed(tab) { const d = DISPLAY(); + if (tab === "hedge_plan" || tab === "hedge-plan") return false; const map = { dashboard: "show_nav_dashboard", account_ledger: "show_nav_account_ledger", @@ -82,8 +86,6 @@ options: "show_nav_options", "options-review": "show_nav_options_review", options_review: "show_nav_options_review", - "hedge-plan": "show_nav_hedge_plan", - hedge_plan: "show_nav_hedge_plan", risk_policy: "show_nav_risk_policy", system_guide: "show_nav_system_guide", env_config: "show_nav_env_config", diff --git a/lib/instance/instance_display_prefs_lib.py b/lib/instance/instance_display_prefs_lib.py index c60cc29..2976f36 100644 --- a/lib/instance/instance_display_prefs_lib.py +++ b/lib/instance/instance_display_prefs_lib.py @@ -21,7 +21,6 @@ DEFAULT_INSTANCE_DISPLAY: dict[str, bool] = { "show_nav_env_config": True, "show_nav_options": True, "show_nav_options_review": True, - "show_nav_hedge_plan": False, "show_settings_transfer": False, # 永续资金划转默认隐藏 "show_settings_export": True, "show_settings_password": True, @@ -43,7 +42,6 @@ DISPLAY_LABELS: dict[str, str] = { "show_nav_env_config": "env配置", "show_nav_options": "期权", "show_nav_options_review": "期权复盘", - "show_nav_hedge_plan": "对冲计划", "show_settings_transfer": "永续资金划转", "show_settings_export": "数据导出", "show_settings_password": "账户密码修改", @@ -65,7 +63,6 @@ NAV_TAB_ALLOWED: dict[str, str] = { "env_config": "show_nav_env_config", "options": "show_nav_options", "options_review": "show_nav_options_review", - "hedge_plan": "show_nav_hedge_plan", } @@ -111,8 +108,8 @@ def display_prefs_template_context(get_db: Callable) -> dict[str, Any]: def tab_allowed(tab: str, display: Optional[dict[str, bool]] = None) -> bool: prefs = normalize_display_prefs(display or {}) t = (tab or "").strip() - if t in ("trade", "records", "stats"): - return False # 实盘下单 / 交易记录复盘 / 统计分析 已移除 + if t in ("trade", "records", "stats", "hedge_plan"): + return False # 实盘下单 / 交易记录复盘 / 统计分析 / 对冲计划 已移除 key = NAV_TAB_ALLOWED.get(t) if not key: return True @@ -129,7 +126,6 @@ def display_meta_for_ui() -> list[dict[str, Any]]: "show_nav_env_config", "show_nav_options", "show_nav_options_review", - "show_nav_hedge_plan", ] settings_keys = [ "show_settings_transfer", diff --git a/lib/instance/instance_embed_lib.py b/lib/instance/instance_embed_lib.py index 308b1f0..614f8fe 100644 --- a/lib/instance/instance_embed_lib.py +++ b/lib/instance/instance_embed_lib.py @@ -16,7 +16,6 @@ EMBED_TABS: tuple[str, ...] = ( "key_monitor", "options", "options_review", - "hedge_plan", "risk_policy", "system_guide", "env_config", @@ -33,7 +32,7 @@ PATH_TO_EMBED_TAB: dict[str, str] = { "/key_monitor": "key_monitor", "/options": "options", "/options/review": "options_review", - "/hedge-plan": "hedge_plan", + "/hedge-plan": "options", # 对冲计划已移除,旧链接落到期权 "/risk_policy": "risk_policy", "/system_guide": "system_guide", "/env_config": "env_config", diff --git a/lib/instance/templates/embed_page_fragment.html b/lib/instance/templates/embed_page_fragment.html index cafc65f..5faa0d1 100644 --- a/lib/instance/templates/embed_page_fragment.html +++ b/lib/instance/templates/embed_page_fragment.html @@ -127,8 +127,6 @@ {% include 'options_panel.html' %} {% elif page == 'options_review' %} {% include 'options_review_panel.html' %} - {% elif page == 'hedge_plan' %} - {% include 'hedge_plan_panel.html' %} {% endif %} diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index efb7378..fa602fc 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -35,7 +35,7 @@ >
-

加密货币|OKX 期权与对冲

+

加密货币|OKX 期权

@@ -115,9 +109,6 @@ {% if options_nav_visible and display.show_nav_options_review %} 期权复盘 {% endif %} - {% if hedge_plan_nav_visible and display.show_nav_hedge_plan %} - 对冲计划 - {% endif %} {% if display.show_nav_risk_policy %} 风控说明 {% endif %} diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index 2e64eb5..08c81c3 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -176,9 +176,6 @@ {% if options_nav_visible and display.show_nav_options_review %} 期权复盘 {% endif %} - {% if hedge_plan_nav_visible and display.show_nav_hedge_plan %} - 对冲计划 - {% endif %} {% if display.show_nav_risk_policy %} 风控说明 {% endif %} @@ -191,7 +188,7 @@ {% with msg=get_flashed_messages() %}{% if msg %}
{{ msg[0] }}
{% endif %}{% endwith %} {% include 'instance_header_panel.html' %} - {% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options', 'options_review', 'hedge_plan') %} + {% if page not in ('settings', 'risk_policy', 'system_guide', 'env_config', 'options', 'options_review') %} {% include 'instance_top_bar.html' %} {% endif %} @@ -365,8 +362,6 @@ {% include 'options_panel.html' %} {% elif page == 'options_review' %} {% include 'options_review_panel.html' %} - {% elif page == 'hedge_plan' %} - {% include 'hedge_plan_panel.html' %} {% endif %} diff --git a/tests/test_remove_hedge_smoke.py b/tests/test_remove_hedge_smoke.py index f688efc..e7f2f55 100644 --- a/tests/test_remove_hedge_smoke.py +++ b/tests/test_remove_hedge_smoke.py @@ -47,6 +47,15 @@ class RemoveHedgeSmokeTests(unittest.TestCase): src = inspect.getsource(m) self.assertNotIn("hedge_plan", src) + def test_nav_display_meta_no_hedge(self): + from lib.instance.instance_display_prefs_lib import display_meta_for_ui, tab_allowed + from lib.instance.instance_embed_lib import EMBED_TABS + + labels = [e["label"] for g in display_meta_for_ui() for e in g["entries"]] + self.assertNotIn("对冲计划", labels) + self.assertFalse(tab_allowed("hedge_plan")) + self.assertNotIn("hedge_plan", EMBED_TABS) + if __name__ == "__main__": unittest.main()