From 446fb1a1f3dcde846bece3e511201b30c88cde65 Mon Sep 17 00:00:00 2001 From: dekun Date: Sat, 3 Oct 2026 03:28:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E8=A7=88=E5=8C=97=E4=BA=AC=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=94=B9=E4=B8=BA=E6=9B=B4=E6=98=93=E8=AF=BB=E7=9A=84?= =?UTF-8?q?=E7=BA=AF=E6=96=87=E6=9C=AC=E6=A0=B7=E5=BC=8F=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=E4=B8=8E=E6=8B=89=E5=8F=96=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=B8=80=E8=87=B4=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 | 48 ++++++++++++++++++++++++++-------------- static/hub.js | 31 +++++++++++++++++++++----- templates/dashboard.html | 6 ++--- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/static/hub.css b/static/hub.css index d0009c2..9c148fc 100644 --- a/static/hub.css +++ b/static/hub.css @@ -101,32 +101,48 @@ body.page-login .main { .overview-bj-clock { margin-left: auto; display: inline-flex; - align-items: baseline; - gap: 8px; - padding: 6px 12px; - border-radius: 999px; - border: 1px solid rgba(56, 189, 248, 0.22); - background: rgba(8, 14, 24, 0.72); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); + align-items: center; + gap: 10px; + padding: 0; + border: 0; + background: transparent; + box-shadow: none; } .overview-bj-label { - font-size: 0.72rem; - letter-spacing: 0.12em; - text-transform: uppercase; - color: var(--accent); - font-weight: 600; + font-size: 0.82rem; + letter-spacing: 0.02em; + text-transform: none; + color: var(--muted); + font-weight: 500; + white-space: nowrap; +} +.overview-bj-label::after { + content: ""; + display: inline-block; + width: 1px; + height: 12px; + margin-left: 10px; + vertical-align: -1px; + background: rgba(56, 189, 248, 0.35); } .overview-bj-time { - font-family: var(--font-display); - font-size: 0.95rem; + font-family: var(--font); + font-size: 1.05rem; font-weight: 600; - letter-spacing: 0.04em; + letter-spacing: 0.02em; color: var(--text); font-variant-numeric: tabular-nums; + white-space: nowrap; } @media (max-width: 720px) { .page-head { flex-wrap: wrap; } - .overview-bj-clock { margin-left: 0; order: 3; width: 100%; justify-content: center; } + .overview-bj-clock { + margin-left: 0; + order: 3; + width: 100%; + justify-content: flex-start; + padding-top: 2px; + } } .muted { color: var(--muted); font-size: 0.9rem; } .flash { diff --git a/static/hub.js b/static/hub.js index fe894e0..476e028 100644 --- a/static/hub.js +++ b/static/hub.js @@ -333,7 +333,7 @@ function formatBeijingNow() { try { - return new Intl.DateTimeFormat("zh-CN", { + const parts = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai", year: "numeric", month: "2-digit", @@ -342,7 +342,26 @@ minute: "2-digit", second: "2-digit", hour12: false, - }).format(new Date()); + }).formatToParts(new Date()); + const get = function (type) { + const hit = parts.find(function (p) { + return p.type === type; + }); + return hit ? hit.value : ""; + }; + return ( + get("year") + + "-" + + get("month") + + "-" + + get("day") + + " " + + get("hour") + + ":" + + get("minute") + + ":" + + get("second") + ); } catch (e) { const d = new Date(); const utc = d.getTime() + d.getTimezoneOffset() * 60000; @@ -352,9 +371,9 @@ }; return ( bj.getFullYear() + - "/" + + "-" + p(bj.getMonth() + 1) + - "/" + + "-" + p(bj.getDate()) + " " + p(bj.getHours()) + @@ -369,7 +388,9 @@ function tickBeijingClock() { const el = document.getElementById("overview-bj-time"); if (!el) return; - el.textContent = formatBeijingNow(); + const text = formatBeijingNow(); + el.textContent = text; + el.setAttribute("datetime", text.replace(" ", "T") + "+08:00"); } function boot() { diff --git a/templates/dashboard.html b/templates/dashboard.html index 4d2a9fb..5debee3 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -3,9 +3,9 @@ {% block body %}

期权持仓总览

-
+
北京时间 - --:--:-- +
@@ -13,6 +13,6 @@
{% endblock %} {% block scripts %} - + {% endblock %}