dashboard(index): overview on top; trend chart smaller beside vertical four-skill levels

This commit is contained in:
Lang
2026-10-14 21:13:02 +08:00
parent 95cf53d448
commit a0bce1b5ab
+22 -5
View File
@@ -52,6 +52,14 @@ h1{margin:.2em 0;font-size:24px}
h2{font-size:14px;text-transform:uppercase;letter-spacing:.7px;color:#9aa2b1;
margin:28px 0 12px;font-weight:600;border-bottom:1px solid #232b38;padding-bottom:.35em}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.row{display:flex;gap:22px;flex-wrap:wrap;align-items:flex-start}
.row>.col{flex:1 1 300px;min-width:270px}
.row>.col.grow{flex:2 1 460px}
.cards.vert{grid-template-columns:1fr;gap:10px}
.cards.vert .card{display:flex;align-items:baseline;gap:12px;padding:12px 16px}
.cards.vert .card .k{flex:1}
.cards.vert .card .v{margin:0;font-size:22px}
.cards.vert .card .c{margin:0;font-size:11px;white-space:nowrap}
.card{background:#1b1e27;border:1px solid #2a2e3a;border-radius:10px;padding:16px}
.card .k{color:#9aa2b1;font-size:13px}
.card .v{font-size:28px;font-weight:700;margin-top:4px;color:#fff}
@@ -120,7 +128,7 @@ CHART_JS = r"""
if (!pts.length || !pts.some(p => SK.some(s => p.v[s.k] != null))) {
el.innerHTML = '<div class="muted">暂无趋势数据</div>'; return;
}
const W = 760, H = 320, L = 46, R = 18, T = 16, B = 40, ymin = 0.7, ymax = 6.3;
const W = 640, H = 210, L = 42, R = 16, T = 12, B = 30, ymin = 0.7, ymax = 6.3;
const xs = i => L + (pts.length === 1 ? (W - L - R) / 2 : i * (W - L - R) / (pts.length - 1));
const ys = v => T + (ymax - v) * (H - T - B) / (ymax - ymin);
let g = "";
@@ -195,10 +203,19 @@ def html_page(title: str, active: str, body: str, script: str, generated: str) -
# ---------- 各页 body ----------
BODY_INDEX = """
<h1>概览</h1>
<h2>四维等级</h2><div class="cards" id="skills"></div>
<h2>等级趋势</h2><div class="chart" id="chart"></div>
<h2>掌握概览</h2><div class="cards" id="overview"></div>
<h2>掌握概览</h2>
<div class="cards" id="overview"></div>
<div class="row">
<div class="col grow">
<h2>等级趋势</h2>
<div class="chart" id="chart"></div>
</div>
<div class="col">
<h2>四维等级</h2>
<div class="cards vert" id="skills"></div>
</div>
</div>
"""
BODY_ITEMS = """