feat: 档案统计独立卡片、共用交易日历与四所统计页日历
内照明心统计表移至顶部卡片,右侧为日历/图表/交易记录;日历样式适配浅深主题,四所统计分析页同步展示按月盈亏日历。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user