diff --git a/manual_trading_hub/static/app.css b/manual_trading_hub/static/app.css index 4eff66a..56cef88 100644 --- a/manual_trading_hub/static/app.css +++ b/manual_trading_hub/static/app.css @@ -4428,45 +4428,198 @@ body.hub-page-ai #page-ai { opacity: 0.65; } -/* —— 资金概况 —— */ +/* —— 资金概况(科技感 HUD)—— */ +body.hub-page-funds .app-bg { + background: + linear-gradient(rgba(0, 212, 255, 0.045) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 212, 255, 0.045) 1px, transparent 1px), + radial-gradient(ellipse 70% 45% at 12% 0%, rgba(0, 212, 255, 0.16), transparent 58%), + radial-gradient(ellipse 55% 40% at 92% 18%, rgba(123, 97, 255, 0.14), transparent 55%), + radial-gradient(ellipse 50% 35% at 50% 100%, rgba(0, 255, 157, 0.06), transparent 60%); + background-size: 28px 28px, 28px 28px, auto, auto, auto; +} +html[data-theme="light"] body.hub-page-funds .app-bg { + background: + linear-gradient(rgba(0, 110, 154, 0.06) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 110, 154, 0.06) 1px, transparent 1px), + radial-gradient(ellipse 70% 45% at 12% 0%, rgba(0, 110, 154, 0.1), transparent 58%), + radial-gradient(ellipse 55% 40% at 92% 18%, rgba(91, 79, 199, 0.08), transparent 55%); + background-size: 28px 28px, 28px 28px, auto, auto; +} +body.hub-page-funds #page-funds { + position: relative; +} +.funds-stage { + position: relative; + border-radius: calc(var(--radius) + 4px); + border: 1px solid var(--border-soft); + background: linear-gradient(165deg, rgba(12, 20, 32, 0.72), rgba(8, 14, 26, 0.88)); + box-shadow: var(--glow), var(--shadow); + overflow: hidden; +} +html[data-theme="light"] .funds-stage { + background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(240, 246, 252, 0.96)); + box-shadow: var(--shadow); +} +.funds-stage-grid, +.funds-stage-glow, +.funds-stage-scan { + position: absolute; + inset: 0; + pointer-events: none; +} +.funds-stage-grid { + opacity: 0.35; + background: + linear-gradient(rgba(0, 212, 255, 0.07) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 212, 255, 0.07) 1px, transparent 1px); + background-size: 24px 24px; + mask-image: linear-gradient(180deg, black 0%, transparent 92%); +} +.funds-stage-glow { + background: + radial-gradient(circle at 18% 12%, rgba(0, 212, 255, 0.12), transparent 42%), + radial-gradient(circle at 82% 8%, rgba(123, 97, 255, 0.1), transparent 38%); +} +.funds-stage-scan { + height: 2px; + inset: auto 0 0 0; + background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.55), transparent); + animation: funds-scan 6s linear infinite; + opacity: 0.45; +} +@keyframes funds-scan { + 0% { transform: translateY(-320px); opacity: 0; } + 8% { opacity: 0.45; } + 92% { opacity: 0.45; } + 100% { transform: translateY(0); opacity: 0; } +} +.funds-stage-inner { + position: relative; + z-index: 1; + padding: 14px 16px 18px; +} +.funds-head { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 14px; + margin-bottom: 12px !important; +} +.funds-head h1 { + font-family: var(--display); + letter-spacing: 0.06em; +} +.funds-tag { + background: linear-gradient(135deg, rgba(0, 212, 255, 0.22), rgba(123, 97, 255, 0.18)); + border-color: rgba(0, 212, 255, 0.45); + box-shadow: 0 0 18px rgba(0, 212, 255, 0.2); +} +.funds-desc { + color: color-mix(in srgb, var(--muted) 88%, var(--accent)); + letter-spacing: 0.02em; +} +.funds-live-pill { + flex-shrink: 0; + display: inline-flex; + align-items: center; + gap: 8px; + padding: 6px 12px; + border-radius: 999px; + border: 1px solid rgba(0, 212, 255, 0.35); + background: rgba(0, 212, 255, 0.08); + font-family: var(--display); + font-size: 0.62rem; + letter-spacing: 0.14em; + color: var(--accent); +} +.funds-live-dot { + width: 7px; + height: 7px; + border-radius: 50%; + background: var(--green); + box-shadow: 0 0 10px var(--green); + animation: funds-pulse 2s ease-in-out infinite; +} +@keyframes funds-pulse { + 0%, 100% { opacity: 1; transform: scale(1); } + 50% { opacity: 0.55; transform: scale(0.88); } +} .funds-toolbar { - margin-bottom: 12px; + margin-bottom: 14px; +} +.funds-btn-refresh { + font-family: var(--display); + letter-spacing: 0.06em; + font-size: 0.72rem; } .funds-status.err { color: var(--red); } .funds-summary { display: grid; - grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; - margin-bottom: 10px; + margin-bottom: 12px; } .funds-stat-card { - background: var(--panel); + position: relative; + background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-soft); border-radius: var(--radius); - padding: 12px 14px; + padding: 14px 16px; + overflow: hidden; +} +html[data-theme="light"] .funds-stat-card { + background: rgba(255, 255, 255, 0.82); +} +.funds-stat-card::before { + content: ""; + position: absolute; + top: 0; + left: 0; + right: 0; + height: 2px; + background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); + opacity: 0.75; +} +.funds-stat-card-primary { + border-color: rgba(0, 212, 255, 0.32); + box-shadow: inset 0 0 24px rgba(0, 212, 255, 0.06); +} +.funds-stat-card-primary .funds-stat-value { + font-size: 1.55rem; + text-shadow: 0 0 20px rgba(0, 212, 255, 0.25); } .funds-stat-label { - font-size: 0.75rem; + font-family: var(--display); + font-size: 0.62rem; + letter-spacing: 0.12em; color: var(--muted); - margin-bottom: 4px; + margin-bottom: 6px; + text-transform: uppercase; } .funds-stat-value { + font-family: var(--display); font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; + letter-spacing: 0.04em; } .funds-stat-val { - font-size: 1.1rem; + font-family: var(--display); + font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; + letter-spacing: 0.04em; } .funds-stat-val.pos { color: var(--green); + text-shadow: 0 0 14px rgba(0, 255, 157, 0.25); } .funds-stat-val.neg { color: var(--red); + text-shadow: 0 0 14px rgba(255, 77, 109, 0.22); } .funds-dd-pct { font-size: 0.82rem; @@ -4474,135 +4627,216 @@ body.hub-page-ai #page-ai { font-weight: 500; } .funds-meta { - font-size: 0.78rem; + font-size: 0.72rem; + font-family: var(--mono); + color: color-mix(in srgb, var(--muted) 90%, var(--accent)); + margin: 0 0 14px; + padding: 8px 12px; + border-radius: 8px; + border: 1px dashed var(--border-soft); + background: rgba(0, 0, 0, 0.2); + letter-spacing: 0.03em; +} +html[data-theme="light"] .funds-meta { + background: rgba(255, 255, 255, 0.65); +} +.funds-chart-panel { + margin-bottom: 20px; + border: 1px solid rgba(0, 212, 255, 0.22); + border-radius: calc(var(--radius) + 2px); + background: rgba(0, 0, 0, 0.22); + box-shadow: inset 0 0 32px rgba(0, 212, 255, 0.04), 0 0 24px rgba(0, 212, 255, 0.06); + overflow: hidden; +} +html[data-theme="light"] .funds-chart-panel { + background: rgba(255, 255, 255, 0.7); + box-shadow: inset 0 0 20px rgba(0, 110, 154, 0.04); +} +.funds-chart-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + padding: 8px 12px; + border-bottom: 1px solid var(--border-soft); + background: linear-gradient(90deg, rgba(0, 212, 255, 0.08), transparent); +} +.funds-chart-tag { + font-family: var(--display); + font-size: 0.68rem; + letter-spacing: 0.16em; + color: var(--accent); +} +.funds-chart-sub { + font-size: 0.62rem; + letter-spacing: 0.1em; color: var(--muted); - margin: 0 0 12px; } .funds-chart-host { - height: 280px; - min-height: 220px; - border: 1px solid var(--border-soft); - border-radius: var(--radius); + height: 300px; + min-height: 240px; background: var(--chart-surface, var(--panel)); - margin-bottom: 18px; overflow: hidden; } +.funds-section-head { + margin-bottom: 12px; +} .funds-section-title { margin: 0 0 4px; - font-size: 0.95rem; + font-family: var(--display); + font-size: 0.88rem; font-weight: 600; + letter-spacing: 0.1em; + text-transform: uppercase; +} +.funds-section-mark { + color: var(--accent-2); + margin-right: 6px; } .funds-section-hint { - margin: 0 0 14px; - font-size: 0.75rem; + margin: 0; + font-size: 0.72rem; color: var(--muted); + letter-spacing: 0.02em; } .funds-accounts { - display: flex; - flex-wrap: wrap; - gap: 18px 22px; - justify-content: flex-start; - padding: 4px 0 8px; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); + gap: 12px; + padding: 4px 0 12px; } -.funds-ac-item { +.funds-ac-card { display: flex; flex-direction: column; - align-items: center; - gap: 8px; - width: 118px; - flex: 0 0 auto; -} -.funds-ac-circle { - position: relative; - width: 112px; - height: 112px; - padding: 0; - border: 2px solid var(--border-soft); - border-radius: 50%; - background: var(--panel); + gap: 10px; + width: 100%; + padding: 14px 16px; + border: 1px solid var(--border-soft); + border-radius: var(--radius); + background: linear-gradient(160deg, rgba(0, 0, 0, 0.34), rgba(12, 20, 32, 0.55)); + text-align: left; cursor: pointer; - overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s; + position: relative; + overflow: hidden; } -.funds-ac-circle:hover:not(:disabled) { - border-color: var(--accent, #3b82f6); - box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); - transform: translateY(-1px); +html[data-theme="light"] .funds-ac-card { + background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(236, 244, 252, 0.9)); } -.funds-ac-circle:focus-visible { - outline: 2px solid var(--accent, #3b82f6); - outline-offset: 3px; +.funds-ac-card::before { + content: ""; + position: absolute; + inset: 0 auto auto 0; + width: 3px; + height: 100%; + background: linear-gradient(180deg, var(--accent), var(--accent-2)); + opacity: 0.55; } -.funds-ac-circle.is-off { - opacity: 0.62; +.funds-ac-card:hover:not(:disabled) { + border-color: rgba(0, 212, 255, 0.45); + box-shadow: 0 0 22px rgba(0, 212, 255, 0.12), 0 0 0 1px var(--accent-dim); + transform: translateY(-2px); +} +.funds-ac-card:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} +.funds-ac-card.is-off { + opacity: 0.68; cursor: default; } -.funds-ac-circle.is-off:hover { +.funds-ac-card.is-off:hover { transform: none; box-shadow: none; border-color: var(--border-soft); } -.funds-ac-circle-chart { - position: absolute; - inset: 6px; - border-radius: 50%; - overflow: hidden; - background: var(--inset-surface); - font-size: 0.68rem; - color: var(--muted); +.funds-ac-head { display: flex; - align-items: center; - justify-content: center; - text-align: center; - line-height: 1.25; - padding: 4px; + align-items: flex-start; + justify-content: space-between; + gap: 10px; } -.funds-ac-circle-overlay { - position: absolute; - inset: 0; - border-radius: 50%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 2px; - padding: 10px; - background: radial-gradient(circle at 50% 55%, rgba(11, 14, 24, 0.55) 0%, rgba(11, 14, 24, 0.82) 68%); - pointer-events: none; -} -html[data-theme="light"] .funds-ac-circle-overlay { - background: radial-gradient(circle at 50% 55%, rgba(240, 244, 249, 0.45) 0%, rgba(240, 244, 249, 0.88) 68%); -} -.funds-ac-circle-name { - font-size: 0.72rem; - font-weight: 600; - letter-spacing: 0.02em; - max-width: 88px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} -.funds-ac-circle-amt { +.funds-ac-name { + margin: 0; + font-family: var(--display); font-size: 0.78rem; font-weight: 600; - font-variant-numeric: tabular-nums; - color: var(--text); + letter-spacing: 0.04em; + line-height: 1.35; + flex: 1; + min-width: 0; + word-break: break-all; } -.funds-ac-circle-badge { +.funds-ac-badge { + flex-shrink: 0; font-size: 0.66rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-soft); color: var(--muted); - text-align: center; - max-width: 100%; + background: var(--inset-surface); white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; } -.funds-ac-circle-badge.is-ok { +.funds-ac-badge.is-ok { color: var(--green); - border-color: rgba(34, 197, 94, 0.35); + border-color: rgba(0, 255, 157, 0.28); + background: rgba(0, 255, 157, 0.08); +} +html[data-theme="light"] .funds-ac-badge.is-ok { + border-color: rgba(10, 143, 92, 0.28); + background: rgba(10, 143, 92, 0.08); +} +.funds-ac-total { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: 10px; + padding: 8px 10px; + border-radius: 8px; + background: var(--inset-surface); + border: 1px solid var(--border-soft); +} +.funds-ac-total .k { + font-size: 0.72rem; + color: var(--muted); +} +.funds-ac-total .v { + font-family: var(--display); + font-size: 1.05rem; + font-weight: 700; + font-variant-numeric: tabular-nums; + color: var(--text); + letter-spacing: 0.03em; +} +.funds-ac-stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 8px 12px; + font-size: 0.78rem; +} +.funds-ac-stats .k { + display: block; + color: var(--muted); + font-size: 0.68rem; + margin-bottom: 2px; +} +.funds-ac-stats .v { + font-variant-numeric: tabular-nums; + font-weight: 500; +} +.funds-ac-stats .v.pos { + color: var(--green); +} +.funds-ac-stats .v.neg { + color: var(--red); +} +.funds-ac-foot { + margin-top: 2px; + padding-top: 10px; + border-top: 1px dashed var(--border-soft); + font-size: 0.72rem; + color: var(--muted); + text-align: center; } .funds-empty { color: var(--muted); @@ -4637,11 +4871,15 @@ html[data-theme="light"] .funds-ac-circle-overlay { z-index: 1; max-width: min(1200px, 96vw); margin: 0 auto; - background: var(--panel); - border: 1px solid var(--border-soft); - border-radius: var(--radius); + background: linear-gradient(165deg, rgba(12, 20, 32, 0.95), rgba(6, 10, 18, 0.98)); + border: 1px solid rgba(0, 212, 255, 0.28); + border-radius: calc(var(--radius) + 2px); padding: 16px 18px 20px; - box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28); + box-shadow: 0 0 40px rgba(0, 212, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.35); +} +html[data-theme="light"] .funds-fs-panel { + background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(240, 246, 252, 0.98)); + box-shadow: var(--shadow); } .funds-fs-head { display: flex; @@ -4654,8 +4892,10 @@ html[data-theme="light"] .funds-ac-circle-overlay { } .funds-fs-title { margin: 0; - font-size: 1.15rem; + font-family: var(--display); + font-size: 1.1rem; font-weight: 600; + letter-spacing: 0.06em; } .funds-fs-sub { margin: 4px 0 0; @@ -4703,6 +4943,22 @@ html[data-theme="light"] .funds-ac-circle-overlay { body.funds-fullscreen-open { overflow: hidden; } +@media (max-width: 720px) { + .funds-head { + flex-direction: column; + align-items: stretch; + } + .funds-live-pill { + align-self: flex-start; + } + .funds-stage-inner { + padding: 12px 12px 14px; + } + .funds-chart-host { + height: 240px; + min-height: 200px; + } +} /* —— 币种档案 —— */ .archive-toolbar { diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 913d622..9ed658f 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -654,6 +654,7 @@ el.classList.toggle("hidden", el.id !== pageId); }); document.body.classList.toggle("hub-page-ai", page === "ai"); + document.body.classList.toggle("hub-page-funds", page === "funds"); syncHubAiMobileViewport(); if (page === "monitor") startMonitorPoll(); else stopMonitorPoll(); diff --git a/manual_trading_hub/static/funds.js b/manual_trading_hub/static/funds.js index adb372a..9c66f7a 100644 --- a/manual_trading_hub/static/funds.js +++ b/manual_trading_hub/static/funds.js @@ -92,8 +92,8 @@ function chartPalette() { const light = document.documentElement.getAttribute("data-theme") === "light"; return light - ? { bg: "#f0f4f9", text: "#4a6078", border: "#b8c8d8", line: "#006e9a" } - : { bg: "#0b0e18", text: "#9aa4b8", border: "#2a3348", line: "#3b82f6" }; + ? { bg: "#eef4fa", text: "#4a6078", border: "#c5d4e4", line: "#006e9a", top: "#006e9a44" } + : { bg: "#060a14", text: "#6b8aa8", border: "#1a2840", line: "#00d4ff", top: "#00d4ff55" }; } function createAreaChart(host) { @@ -112,7 +112,7 @@ }); const s = c.addAreaSeries({ lineColor: p.line, - topColor: p.line + "44", + topColor: p.top || p.line + "44", bottomColor: p.line + "08", lineWidth: 2, priceFormat: { type: "price", precision: 2, minMove: 0.01 }, @@ -142,35 +142,11 @@ fsLineSeries = built.series; } - function renderMiniChart(host, series) { - if (!host || !window.LightweightCharts) return; - host.innerHTML = ""; - const data = seriesToChartData(series); - if (data.length < 2) { - host.textContent = "历史不足"; - return; - } - const p = chartPalette(); - const mini = LightweightCharts.createChart(host, { - layout: { background: { color: "transparent" }, textColor: p.text }, - grid: { vertLines: { visible: false }, horzLines: { visible: false } }, - rightPriceScale: { visible: false }, - timeScale: { visible: false }, - crosshair: { mode: LightweightCharts.CrosshairMode.Hidden }, - handleScroll: false, - handleScale: false, - }); - const s = mini.addAreaSeries({ - lineColor: p.line, - topColor: p.line + "55", - bottomColor: p.line + "05", - lineWidth: 1.5, - }); - s.setData(data); - mini.timeScale().fitContent(); - const w = host.clientWidth; - const h = host.clientHeight; - if (w > 0 && h > 0) mini.applyOptions({ width: w, height: h }); + function esc(s) { + return String(s || "") + .replace(/&/g, "&") + .replace(/' + - '" + - '' + + '

' + + esc(name) + + "

" + + '' + st.text + "" + - "" + "" + + '
' + + '总资金' + + '' + + total + + "" + + "
" + + '
' + + '
资金户' + + funding + + "
" + + '
交易户' + + trading + + "
" + + '
较昨日' + + deltaText + + "
" + + '
最大回撤' + + ddU + + " / " + + ddPct + + "
" + + "
" + + (monitored + ? '
点击查看资金曲线
' + : "") + + "" ); }) .join(""); - elAccounts.querySelectorAll(".funds-ac-circle").forEach(function (btn, idx) { - const ac = accounts[idx]; - const host = btn.querySelector(".funds-ac-circle-chart"); - if (ac && ac.monitored && host) { - renderMiniChart(host, ac.series || []); - } else if (host) { - host.textContent = monitoredLabel(ac); - } - if (ac && ac.monitored) { - btn.addEventListener("click", function () { - openAccountFullscreen(ac.key); - }); - } + elAccounts.querySelectorAll(".funds-ac-card:not(.is-off)").forEach(function (btn) { + btn.addEventListener("click", function () { + openAccountFullscreen(btn.getAttribute("data-key")); + }); }); } diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index e4f2963..73be92d 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -15,7 +15,7 @@ - + @@ -44,10 +44,10 @@ SYNC @@ -332,33 +332,54 @@