Make hedge the default home and drop unused product-surface entries.

Put永期/期期对冲 first in nav, default embed tab to hedge_plan, and remove risk-policy/options-account UI instead of only hiding them.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 18:51:57 +08:00
parent cfecbcfbb5
commit d40a0d25be
8 changed files with 49 additions and 61 deletions
+9 -19
View File
@@ -7062,7 +7062,7 @@ def index():
@login_required
def key_monitor_page():
# CoinOX 去掉单独永续关键位开仓入口
flash("CoinOX 不提供关键位自动开仓,请使用期权或对冲计划")
flash("本仓仅对冲,请使用对冲计划")
return redirect("/hedge-plan")
@@ -7070,51 +7070,41 @@ def key_monitor_page():
@login_required
def trade_page():
# CoinOX 去掉单独永续下单入口
flash("CoinOX 不提供单独永续下单,请使用期权或对冲计划")
flash("本仓仅对冲,请使用对冲计划")
return redirect("/hedge-plan")
@app.route("/records")
@login_required
def records_page():
# CoinOX 已移除「交易记录与复盘」
flash("CoinOX 不提供交易记录与复盘,请使用期权复盘或对冲计划")
return redirect("/hedge-plan")
flash("本仓仅对冲,请使用对冲复盘")
return redirect("/hedge-plan/review")
@app.route("/stats")
@login_required
def stats_page():
# CoinOX 已移除全站「统计分析」(对冲计划内统计仍保留)
flash("CoinOX 不提供全站统计分析,请在对冲计划内查看")
flash("本仓不提供全站统计分析,请在对冲计划内查看")
return redirect("/hedge-plan")
@app.route("/dashboard")
@login_required
def dashboard_page():
redir = redirect_to_embed_shell_if_enabled("dashboard")
if redir is not None:
return redir
return render_main_page("dashboard")
return redirect("/hedge-plan")
@app.route("/risk_policy")
@login_required
def risk_policy_page():
redir = redirect_to_embed_shell_if_enabled("risk_policy")
if redir is not None:
return redir
return render_main_page("risk_policy")
# 本仓已去掉风控说明产品面
return redirect("/hedge-plan")
@app.route("/system_guide")
@login_required
def system_guide_page():
redir = redirect_to_embed_shell_if_enabled("system_guide")
if redir is not None:
return redir
return render_main_page("system_guide")
return redirect("/hedge-plan")
@app.route("/env_config")
+3 -3
View File
@@ -44,7 +44,7 @@
const t = new URLSearchParams(location.search).get("tab");
if (t) return t;
} catch (_) {}
return document.body.getAttribute("data-page") || "trade";
return document.body.getAttribute("data-page") || "hedge_plan";
}
function listWindowQueryString() {
@@ -401,7 +401,7 @@
const options = opts || {};
if (!tab) return;
if (!pageNavAllowed(tab)) {
void loadTab("trade", { replace: true });
void loadTab("hedge_plan", { replace: true });
return;
}
@@ -564,7 +564,7 @@
initBootPane();
const bootTab = getTab();
if (!pageNavAllowed(bootTab)) {
void loadTab("trade", { replace: true });
void loadTab("hedge_plan", { replace: true });
return;
}
if (bootTab === "settings") {
+3 -3
View File
@@ -2,7 +2,7 @@
* 实例手机壳: ≤720px 底栏 +「更多」,与 embed soft-nav 同步.
*/
(function (global) {
const PRIMARY = { trade: 1, key_monitor: 1, options: 1 };
const PRIMARY = { hedge_plan: 1, options: 1 };
const MQ = "(max-width: 720px)";
function isEmbedShell() {
@@ -26,7 +26,7 @@
const t = new URLSearchParams(location.search).get("tab");
if (t) return t;
} catch (_) {}
return (document.body && document.body.getAttribute("data-page")) || "trade";
return (document.body && document.body.getAttribute("data-page")) || "hedge_plan";
}
function closeMore() {
@@ -106,7 +106,7 @@
env_config: "/env_config",
settings: "/settings",
};
location.href = pathMap[tab] || "/trade";
location.href = pathMap[tab] || "/hedge-plan";
}
function bindChrome() {
+8 -2
View File
@@ -501,8 +501,14 @@ def ui_sections_for_exchange(
if not m:
m = _okx_mode_for_env_ui()
sections.append(_MODE_SECTION)
# 单独期权模式才展示「期权账户」;对冲模式相关项已并入下方对冲分区
if m == "options":
# 本仓默认无「期权账户」;仅紧急打开 STANDALONE_OPTIONS_UI 且单独期权模式才展示
try:
from lib.hedge_plan.okx_trade_mode_lib import standalone_options_ui_enabled
_show_opt_acct = standalone_options_ui_enabled() and m == "options"
except Exception:
_show_opt_acct = False
if _show_opt_acct:
sections.append({"title": "期权账户", "fields": _options_fields_for_mode(m)})
hedge_fields = _hedge_fields_for_mode(m)
if hedge_fields:
+4 -3
View File
@@ -20,7 +20,7 @@ DEFAULT_INSTANCE_DISPLAY: dict[str, bool] = {
"show_nav_risk_policy": False, # 本仓对冲不需要风控说明页
"show_nav_system_guide": False,
"show_nav_env_config": True,
"show_nav_options": True,
"show_nav_options": False, # 本仓不装单独期权页
"show_nav_options_review": True,
"show_nav_hedge_plan": True,
"show_settings_transfer": False, # CoinOX 不需要永续自动划转
@@ -87,6 +87,7 @@ def normalize_display_prefs(raw: dict | None) -> dict[str, bool]:
out["show_nav_strategy_records"] = False
out["show_nav_system_guide"] = False
out["show_nav_risk_policy"] = False
out["show_nav_options"] = False
out["show_settings_options_swap"] = False
out["show_settings_transfer"] = False
# 本仓不装单独期权 UI:系统设置不展示期权划转/兑换(避免缺模板/缺 API 500)
@@ -133,10 +134,10 @@ def tab_allowed(tab: str, display: Optional[dict[str, bool]] = None) -> bool:
def display_meta_for_ui() -> list[dict[str, Any]]:
# CoinOX 顶栏仅保留对冲相关入口
# CoinOX 顶栏:对冲优先
nav_keys = [
"show_nav_options_review",
"show_nav_hedge_plan",
"show_nav_options_review",
"show_nav_env_config",
]
settings_keys = [
+3 -3
View File
@@ -29,7 +29,7 @@ EMBED_TABS: tuple[str, ...] = (
)
PATH_TO_EMBED_TAB: dict[str, str] = {
"/": "trade",
"/": "hedge_plan",
"/trade": "trade",
"/dashboard": "dashboard",
"/account_ledger": "account_ledger",
@@ -183,9 +183,9 @@ def register_embed_routes(
@login_required
@app.route("/embed")
def embed_shell_page():
tab = (request.args.get("tab") or "trade").strip()
tab = (request.args.get("tab") or "hedge_plan").strip()
if tab not in EMBED_TABS:
tab = "trade"
tab = "hedge_plan"
session["hub_embed_shell"] = True
resp = make_response(render_main_page_fn(tab, embed_mode="shell"))
resp.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0"
+13 -19
View File
@@ -31,21 +31,18 @@
<h1>okx对冲</h1>
</div>
<nav class="top-nav embed-top-nav" aria-label="实例导航">
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" data-embed-tab="hedge_plan" class="{% if initial_tab == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_options_review %}
<a href="/hedge-plan/review" data-embed-tab="options_review" class="{% if initial_tab == 'options_review' %}active{% endif %}">对冲复盘</a>
{% endif %}
{% if options_nav_visible and display.show_nav_options %}
<a href="/options" data-embed-tab="options" class="{% if initial_tab == 'options' %}active{% endif %}">期权</a>
{% endif %}
{% if options_nav_visible and display.show_nav_options_review %}
<a href="/options/review" data-embed-tab="options_review" class="{% if initial_tab == 'options_review' %}active{% endif %}">期权复盘</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_options_review %}
<a href="/hedge-plan/review" data-embed-tab="options_review" class="{% if initial_tab == 'options_review' %}active{% endif %}">对冲复盘</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" data-embed-tab="hedge_plan" class="{% if initial_tab == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
{% endif %}
{% if display.show_nav_risk_policy %}
<a href="/risk_policy" data-embed-tab="risk_policy" class="{% if initial_tab == 'risk_policy' %}active{% endif %}">风控说明</a>
{% endif %}
{% if display.show_nav_env_config %}
<a href="/env_config" data-embed-tab="env_config" class="{% if initial_tab == 'env_config' %}active{% endif %}">env配置</a>
{% endif %}
@@ -83,12 +80,12 @@
<!-- 手机端主导航(≤720px);桌面不显示 -->
<nav id="inst-mobile-tabbar" class="inst-mobile-tabbar" aria-label="手机主导航">
{% if options_nav_visible and display.show_nav_options %}
<a href="/options" class="inst-m-tab{% if initial_tab == 'options' %} active{% endif %}" data-embed-tab="options">期权</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" class="inst-m-tab{% if initial_tab == 'hedge_plan' %} active{% endif %}" data-embed-tab="hedge_plan">{% if hedge_plan_show_options_options %}期期{% else %}永期{% endif %}</a>
{% endif %}
{% if options_nav_visible and display.show_nav_options %}
<a href="/options" class="inst-m-tab{% if initial_tab == 'options' %} active{% endif %}" data-embed-tab="options">期权</a>
{% endif %}
<button type="button" class="inst-m-tab" data-embed-tab="more" id="inst-m-tab-more" aria-haspopup="dialog" aria-expanded="false">更多</button>
</nav>
<div id="inst-mobile-more" class="inst-mobile-more" aria-hidden="true">
@@ -98,14 +95,11 @@
<h2 id="inst-mobile-more-title" class="inst-mobile-more-title">更多</h2>
<p class="inst-mobile-more-hint">次要页面 · 完整界面请用电脑</p>
<nav class="inst-mobile-more-nav" aria-label="更多页面">
{% if options_nav_visible and display.show_nav_options_review %}
<a href="/options/review" data-embed-tab="options_review">期权复盘</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_options_review %}
<a href="/hedge-plan/review" data-embed-tab="options_review">对冲复盘</a>
{% endif %}
{% if display.show_nav_risk_policy %}
<a href="/risk_policy" data-embed-tab="risk_policy">风控说明</a>
{% if options_nav_visible and display.show_nav_options_review %}
<a href="/options/review" data-embed-tab="options_review">期权复盘</a>
{% endif %}
{% if display.show_nav_env_config %}
<a href="/env_config" data-embed-tab="env_config">env配置</a>
@@ -144,7 +138,7 @@ window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
</script>
<script src="/static/instance_settings_prefs.js?v=22"></script>
<script src="/static/instance_live.js?v=6"></script>
<script src="/static/instance_embed.js?v=31"></script>
<script src="/static/instance_mobile_nav.js?v=2"></script>
<script src="/static/instance_embed.js?v=32"></script>
<script src="/static/instance_mobile_nav.js?v=3"></script>
</body>
</html>
+6 -9
View File
@@ -154,21 +154,18 @@
<h1>okx对冲</h1>
</div>
<div class="top-nav">
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" class="{% if page == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_options_review %}
<a href="/hedge-plan/review" class="{% if page == 'options_review' %}active{% endif %}">对冲复盘</a>
{% endif %}
{% if options_nav_visible and display.show_nav_options %}
<a href="/options" class="{% if page == 'options' %}active{% endif %}">期权</a>
{% endif %}
{% if options_nav_visible and display.show_nav_options_review %}
<a href="/options/review" class="{% if page == 'options_review' %}active{% endif %}">期权复盘</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_options_review %}
<a href="/hedge-plan/review" class="{% if page == 'options_review' %}active{% endif %}">对冲复盘</a>
{% endif %}
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" class="{% if page == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
{% endif %}
{% if display.show_nav_risk_policy %}
<a href="/risk_policy" class="{% if page == 'risk_policy' %}active{% endif %}">风控说明</a>
{% endif %}
{% if display.show_nav_env_config %}
<a href="/env_config" class="{% if page == 'env_config' %}active{% endif %}">env配置</a>
{% endif %}