feat: 档案统计独立卡片、共用交易日历与四所统计页日历

内照明心统计表移至顶部卡片,右侧为日历/图表/交易记录;日历样式适配浅深主题,四所统计分析页同步展示按月盈亏日历。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-30 08:17:53 +08:00
parent 6b872b1f43
commit 14dbf25798
16 changed files with 681 additions and 245 deletions
+31
View File
@@ -664,6 +664,36 @@ function switchStatsSegment(){
q.set("stats_segment", key);
const qs = q.toString();
history.replaceState(null, "", qs ? (window.location.pathname + "?" + qs) : window.location.pathname);
if(statsCalendarWidget) statsCalendarWidget.load();
}
let statsCalendarWidget = null;
function initStatsCalendarWidget(){
const grid = document.getElementById("stats-calendar");
if(!grid || !window.TradeStatsCalendar) return;
statsCalendarWidget = new TradeStatsCalendar({
gridEl: grid,
titleEl: document.getElementById("stats-cal-title"),
prevBtn: document.getElementById("stats-cal-prev"),
nextBtn: document.getElementById("stats-cal-next"),
apiUrl: "/api/stats/calendar",
showSick: false,
buildQuery: function(year, month){
const q = new URLSearchParams();
q.set("year", String(year));
q.set("month", String(month));
const sel = document.getElementById("stats-segment-select");
if(sel) q.set("segment", sel.value || "all");
return q;
},
parseResponse: function(data){
if(data && data.ok === false) return {};
return (data && data.days) || {};
}
});
statsCalendarWidget.ensureMonth(new Date());
statsCalendarWidget.load();
}
function initStatsSegmentFromUrl(){
@@ -700,6 +730,7 @@ attachListWindowToExports();
toggleListWindowCustom();
bindListWindowDateAutoCustom();
initStatsSegmentFromUrl();
initStatsCalendarWidget();
if(document.getElementById("journal-list")) loadJournals();
if(document.getElementById("review-list")) loadReviews();
const reviewToggle = document.getElementById("review-mode-toggle");
+8
View File
@@ -452,6 +452,14 @@
</select>
</label>
</div>
<div id="stats-calendar-wrap" class="trade-cal-wrap stats-calendar-wrap">
<div class="trade-cal-head">
<button type="button" id="stats-cal-prev" class="btn" title="上一月"></button>
<span id="stats-cal-title" class="trade-cal-title"></span>
<button type="button" id="stats-cal-next" class="btn" title="下一月"></button>
</div>
<div id="stats-calendar" class="trade-cal-grid-host" role="grid" aria-label="交易日历"></div>
</div>
{% for seg in stats_bundle.segments %}
<div class="stats-segment-block stats-segment-panel" data-stats-segment="{{ seg.key }}"{% if not loop.first %} style="display:none"{% endif %}>
{{ period_stats("日统计", seg.day) }}
+2
View File
@@ -8,6 +8,7 @@
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=2">
<link rel="stylesheet" href="/static/instance_theme.css?v=18">
<link rel="stylesheet" href="/static/trade_stats_calendar.css?v=1">
<script src="/static/account_risk_badge.js?v=4"></script>
<meta name="theme-color" content="#0b0d14">
<title>{{ exchange_display }} · 加密货币 | 交易监控复盘系统</title>
@@ -120,6 +121,7 @@
<script src="/static/manual_order_rr_preview.js?v=5"></script>
<script src="/static/strategy_roll.js?v=5"></script>
<script src="/static/key_monitor_form.js?v=2"></script>
<script src="/static/trade_stats_calendar.js?v=1"></script>
{% include 'embed_boot_scripts.html' %}
<script src="/static/instance_embed.js?v=4"></script>
</body>