From 45464a6089fb07c72d0290dad86e0c4c586ba85a Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 2 Oct 2026 16:07:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E8=A7=88=EF=BC=9A=E5=B9=B3=E4=BB=93?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=A7=BB=E5=88=B0=E6=93=8D=E4=BD=9C=E5=88=97?= =?UTF-8?q?=EF=BC=8C=E8=A1=A8=E6=A0=BC=E5=B1=85=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- static/hub.css | 19 +++++++++------ static/hub.js | 63 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/static/hub.css b/static/hub.css index a7e4cce..e0d88f9 100644 --- a/static/hub.css +++ b/static/hub.css @@ -207,7 +207,6 @@ button, .btn { cursor: not-allowed; filter: none; } -.pos-brief-main { min-width: 0; } .panel { background: var(--panel); border: 1px solid var(--line); @@ -227,7 +226,9 @@ button, .btn { .inst-row { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; } .overview-table-wrap { overflow-x: auto; - margin-top: 12px; + margin: 12px auto 0; + width: fit-content; + max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); @@ -235,9 +236,17 @@ button, .btn { backdrop-filter: blur(10px); } .overview-table { - width: 100%; + width: auto; + min-width: 720px; border-collapse: collapse; font-size: 0.88rem; + margin: 0 auto; +} +body.page-dashboard #overview-status { + text-align: center; +} +body.page-dashboard .page-head { + justify-content: center; } .overview-table th, .overview-table td { @@ -266,10 +275,6 @@ button, .btn { } .pos-brief li { margin: 2px 0; - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; } .card-grid { display: grid; diff --git a/static/hub.js b/static/hub.js index a7e4089..a5ece38 100644 --- a/static/hub.js +++ b/static/hub.js @@ -24,39 +24,19 @@ .replace(/"/g, """); } - function positionSummary(brief, instanceId, online) { + function positionSummary(brief) { const list = brief || []; if (!list.length) return '暂无持仓'; const items = list.slice(0, 8).map(function (p) { const id = p.inst_id || ""; const sheets = escapeHtml(String(p.sheets != null ? p.sheets : "—")); - const invalid = !!(p.bid_invalid || (p.bid_px == null && (p.bid_sz == null || p.bid_sz === ""))); - const reason = (p.bid_invalid_reason || "买一无效,禁止平仓").toString(); - let closeBtn = ""; - if (online && id) { - if (invalid) { - closeBtn = - ''; - } else { - closeBtn = - ''; - } - } return ( - "
  • " + + "
  • " + escapeHtml(id) + " · " + sheets + "张 · " + fmtPnlHtml(p.pnl_usdt) + - "" + - closeBtn + "
  • " ); }); @@ -67,6 +47,42 @@ return ""; } + function closeActionButtons(brief, instanceId, online) { + if (!online) return ""; + const list = (brief || []).filter(function (p) { + return !!(p && p.inst_id); + }); + if (!list.length) return ""; + return list + .slice(0, 8) + .map(function (p) { + const id = p.inst_id || ""; + const invalid = !!( + p.bid_invalid || + (p.bid_px == null && (p.bid_sz == null || p.bid_sz === "")) + ); + const reason = (p.bid_invalid_reason || "买一无效,禁止平仓").toString(); + const tip = list.length > 1 ? id + " · 买一限价全平" : "买一限价全平"; + if (invalid) { + return ( + '' + ); + } + return ( + '' + ); + }) + .join(""); + } + function fmtBidPx(v) { if (v == null || v === "") return "—"; const n = Number(v); @@ -148,7 +164,7 @@ fmtPnlHtml(pnl) + "" + "" + - positionSummary(brief, row.id, online) + + positionSummary(brief) + "" + "" + bidLiquiditySummary(brief) + @@ -163,6 +179,7 @@ '' + + closeActionButtons(brief, row.id, online) + "" + "" );