修复全仓复利开启时单笔预算仍显示:flex 覆盖了 hidden,改为强制隐藏。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-12 10:16:47 +08:00
parent a8d6795837
commit 886b6dcc5b
6 changed files with 36 additions and 5 deletions
@@ -295,6 +295,10 @@
input.dataset.envKey = field.key;
input.className = "env-field-input";
row.appendChild(input);
if (field.hidden) {
row.hidden = true;
row.style.display = "none";
}
return row;
}
@@ -367,6 +371,7 @@
if (!budgetRow) return;
const compoundOn = !compoundSel || String(compoundSel.value || "").toLowerCase() === "true";
budgetRow.hidden = compoundOn;
budgetRow.style.display = compoundOn ? "none" : "";
}
function bindCompoundBudgetVisibility(body) {
+5
View File
@@ -2494,6 +2494,11 @@ html[data-theme="light"] .journal-detail-img-thumb {
min-width: 0;
}
/* display:flex 会盖掉 UA [hidden];全仓复利开时隐藏单笔预算等依赖此规则 */
.env-field-row[hidden] {
display: none !important;
}
.env-field-row--restart .env-field-label {
color: #d4c4a0;
}
+21
View File
@@ -472,6 +472,7 @@ def build_env_ui_payload(
_build_field(key, label, note, schema, values)
for key, label, note in sec["fields"]
]
fields = _mark_compound_budget_hidden(fields)
groups.append({
"title": sec["title"],
"fields": fields,
@@ -480,6 +481,26 @@ def build_env_ui_payload(
return groups
def _mark_compound_budget_hidden(fields: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""全仓复利开启时标记单笔预算为 hidden(供 SSR/前端隐藏;切换开关仍可再显示)."""
compound_on = True
for f in fields:
if f.get("key") == "OKX_OPTIONS_COMPOUND_FULL_ENABLED":
compound_on = _env_truthy(str(f.get("current") or f.get("default") or "true"))
break
if not compound_on:
return fields
out: list[dict[str, Any]] = []
for f in fields:
if f.get("key") == "OKX_OPTIONS_TRADE_BUDGET_USDC":
item = dict(f)
item["hidden"] = True
out.append(item)
else:
out.append(f)
return out
def filter_updates_for_ui(exchange_key: str, updates: dict[str, str]) -> dict[str, str]:
allowed = ui_allowed_keys(exchange_key)
return {k: v for k, v in (updates or {}).items() if k in allowed}
+2 -2
View File
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=13">
<link rel="stylesheet" href="/static/instance_theme.css?v=114">
<link rel="stylesheet" href="/static/instance_theme.css?v=115">
<script src="/static/account_risk_badge.js?v=4"></script>
<script src="/static/open_submit_gate.js?v=1"></script>
<meta name="theme-color" content="#0b0d14">
@@ -170,7 +170,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj
<script>
window.__INSTANCE_DISPLAY__ = {{ display | tojson }};
</script>
<script src="/static/instance_settings_prefs.js?v=20"></script>
<script src="/static/instance_settings_prefs.js?v=21"></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>
+1 -1
View File
@@ -37,7 +37,7 @@
{% endif %}
<div class="env-form-grid">
{% for field in group.fields %}
<div class="env-field-row{% if field.restart_required %} env-field-row--restart{% endif %}" data-env-key="{{ field.key }}">
<div class="env-field-row{% if field.restart_required %} env-field-row--restart{% endif %}" data-env-key="{{ field.key }}"{% if field.hidden %} hidden style="display:none"{% endif %}>
<label class="env-field-label" for="env-f-{{ field.key }}">
{{ field.label or field.key }}
{% if field.restart_required %}<span class="env-restart-mark" title="需重启">*</span>{% endif %}
+2 -2
View File
@@ -19,7 +19,7 @@
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=13">
<link rel="stylesheet" href="/static/instance_theme.css?v=114">
<link rel="stylesheet" href="/static/instance_theme.css?v=115">
</head>
<body
@@ -2045,6 +2045,6 @@ document.addEventListener("DOMContentLoaded", function () {
});
{% endif %}
</script>
<script src="/static/instance_settings_prefs.js?v=20"></script>
<script src="/static/instance_settings_prefs.js?v=21"></script>
</body>
</html>