From 5935b5449e7d071ca330af78e9a7e3f84ee8ce7e Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 24 May 2026 08:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AFui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manual_trading_hub/hub.py | 2 +- manual_trading_hub/static/app.css | 17 +++++++++ manual_trading_hub/static/app.js | 52 +++++++++++++++++++--------- manual_trading_hub/static/index.html | 5 +-- 4 files changed, 57 insertions(+), 19 deletions(-) diff --git a/manual_trading_hub/hub.py b/manual_trading_hub/hub.py index 43af05d..8f0de6c 100644 --- a/manual_trading_hub/hub.py +++ b/manual_trading_hub/hub.py @@ -43,7 +43,7 @@ HUB_BRIDGE_TOKEN = (os.getenv("HUB_BRIDGE_TOKEN") or os.getenv("CONTROL_TOKEN") _trust_raw = (os.getenv("HUB_TRUST_LAN", "true") or "").strip().lower() HUB_TRUST_LAN = _trust_raw not in ("0", "false", "no", "off") DIR = Path(__file__).resolve().parent -HUB_BUILD = "20260525-fullscreen" +HUB_BUILD = "20260525-fs-fix" def _is_local(host: str | None) -> bool: diff --git a/manual_trading_hub/static/app.css b/manual_trading_hub/static/app.css index 966c016..71be242 100644 --- a/manual_trading_hub/static/app.css +++ b/manual_trading_hub/static/app.css @@ -515,7 +515,24 @@ body.hub-fullscreen-open { padding: 16px 20px 24px; } +.exchange-fullscreen.hidden { + display: none !important; +} + +.exchange-fullscreen-backdrop { + position: fixed; + inset: 0; + z-index: 0; + border: none; + padding: 0; + margin: 0; + background: transparent; + cursor: pointer; +} + .exchange-fullscreen-panel { + position: relative; + z-index: 1; max-width: 820px; margin: 0 auto; } diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 4904acd..2252e95 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -224,25 +224,29 @@ if (expandedExchangeId && fs && fsInner) { const row = rows.find((r) => String(r.id) === String(expandedExchangeId)); if (row) { - fsInner.innerHTML = renderFullscreenExchange(row); - fs.classList.remove("hidden"); - fs.setAttribute("aria-hidden", "false"); - document.body.classList.add("hub-fullscreen-open"); - bindMonitorInteractions(fsInner); - fsInner.querySelectorAll(".btn-expand-back").forEach((btn) => { - btn.onclick = (ev) => { - ev.stopPropagation(); - closeExchangeFullscreen(); - renderMonitorGrid(lastMonitorRows); - }; - }); + try { + fsInner.innerHTML = renderFullscreenExchange(row); + fs.classList.remove("hidden"); + fs.setAttribute("aria-hidden", "false"); + document.body.classList.add("hub-fullscreen-open"); + bindMonitorInteractions(fsInner); + fsInner.querySelectorAll(".btn-expand-back").forEach((btn) => { + btn.onclick = (ev) => { + ev.stopPropagation(); + closeExchangeFullscreen(); + renderMonitorGrid(lastMonitorRows); + }; + }); + } catch (err) { + console.error("renderFullscreenExchange", err); + closeExchangeFullscreen(); + showToast("全屏渲染失败: " + err, true); + } } else { closeExchangeFullscreen(); } - } else if (fs) { - fs.classList.add("hidden"); - fs.setAttribute("aria-hidden", "true"); - document.body.classList.remove("hub-fullscreen-open"); + } else { + closeExchangeFullscreen(); } } @@ -749,6 +753,21 @@ } } + function initFullscreen() { + const backdrop = document.getElementById("exchange-fullscreen-backdrop"); + if (backdrop) { + backdrop.onclick = () => { + closeExchangeFullscreen(); + renderMonitorGrid(lastMonitorRows); + }; + } + const fs = document.getElementById("exchange-fullscreen"); + if (fs && !expandedExchangeId) { + fs.classList.add("hidden"); + fs.setAttribute("aria-hidden", "true"); + } + } + function initTpslModal() { const backdrop = document.getElementById("tpsl-modal-backdrop"); const cancel = document.getElementById("tpsl-cancel"); @@ -1067,6 +1086,7 @@ }; initTpslModal(); + initFullscreen(); initAuth().then((ok) => { if (!ok) return; diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index 6e00352..f317615 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -7,7 +7,7 @@ - + @@ -57,6 +57,7 @@
- +