feat: 账号卡片余额趋势折线图 + 时间窗口切换(all/1h/1d/1w/1mo/1yr) - api: history 接口支持 window 参数与窗口内均匀降采样;新增批量 /api/history - ui: 阈值进度条替换为 SVG 迷你折线图(状态色 + 阈值虚线),卡片级窗口切换器 - test: 窗口过滤、降采样、批量历史用例,共 54 个

This commit is contained in:
2026-08-05 00:32:22 +08:00
parent edf19e121b
commit 1475821519
5 changed files with 504 additions and 27 deletions
+180
View File
@@ -407,3 +407,183 @@ label { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom:
* { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
.account-card { opacity: 1; transform: none; }
}
/* ===== 账号监控:筛选栏 ===== */
.filter-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
margin-bottom: 16px;
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
font-family: inherit;
font-size: 12px;
font-weight: 500;
padding: 5px 13px;
border-radius: 999px;
border: 1px solid var(--border-strong);
background: var(--bg-elev);
color: var(--text-2);
cursor: pointer;
transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out);
}
.pill:hover { color: var(--text); border-color: var(--text-3); }
.pill:active { transform: scale(0.96); }
.pill.active { background: var(--accent); border-color: transparent; color: #fff; }
.pill.warn.active { background: var(--warn); }
.pill.err.active { background: var(--err); }
.pill.pending.active { background: var(--text-2); }
.pill.disabled.active { background: var(--text-3); }
.filter-select { width: auto; min-width: 130px; }
/* ===== 账号卡片:重构 ===== */
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .card-title { flex: 1; min-width: 0; }
.card-head .badge-pill { margin-left: auto; flex-shrink: 0; }
.balance-vs {
margin-left: auto;
font-size: 11px;
color: var(--text-3);
white-space: nowrap;
}
.card-meta { display: flex; flex-direction: column; gap: 3px; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-item svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.card-error {
display: flex;
align-items: center;
gap: 5px;
font-size: 11px;
color: var(--err);
background: var(--err-soft);
padding: 4px 8px;
border-radius: 6px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.card-error svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
/* 阈值条(新名,旧 .threshold-bar 保留) */
.threshold-track {
height: 4px;
border-radius: 2px;
background: var(--bg-elev-2);
overflow: hidden;
}
/* 操作区 */
.card-actions { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.card-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.card-actions .btn svg {
width: 13px; height: 13px;
stroke: currentColor; fill: none; stroke-width: 2;
stroke-linecap: round; stroke-linejoin: round;
flex-shrink: 0;
}
.icon-btn { padding: 6px; line-height: 0; }
.icon-btn.danger:hover { color: var(--err); background: var(--err-soft); }
/* 检查按钮 loading 态 */
.check-btn.loading { pointer-events: none; opacity: 0.75; }
.spinner {
width: 11px; height: 11px;
border: 2px solid currentColor;
border-top-color: transparent;
border-radius: 50%;
display: inline-block;
animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 启用/停用开关 */
.switch {
position: relative;
width: 36px; height: 20px;
flex-shrink: 0;
margin-left: auto;
cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
position: absolute; inset: 0;
background: var(--bg-elev-2);
border: 1px solid var(--border-strong);
border-radius: 999px;
transition: background 180ms ease, border-color 180ms ease;
}
.switch .slider::before {
content: "";
position: absolute;
width: 14px; height: 14px;
border-radius: 50%;
left: 2px; top: 2px;
background: #fff;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
transition: transform 180ms var(--ease-out);
}
.switch input:checked + .slider { background: var(--ok); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch:active .slider::before { transform: scale(0.9); }
.switch input:checked:active + .slider::before { transform: translateX(16px) scale(0.9); }
/* 筛选空结果 */
.empty-filter {
text-align: center;
color: var(--text-3);
padding: 48px 0;
font-size: 13px;
}
/* 余额历史迷你折线图 */
.spark-wrap {
background: var(--bg-elev-2);
border-radius: 6px;
padding: 6px 8px 4px;
overflow: hidden;
}
.sparkline {
display: block;
width: 100%;
height: 30px;
}
.spark-title {
font-size: 10px;
color: var(--text-3);
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.window-switch {
display: flex;
gap: 2px;
justify-content: flex-end;
margin-top: 3px;
}
.win-btn {
font-family: inherit;
font-size: 9.5px;
font-weight: 600;
letter-spacing: 0.02em;
padding: 1px 5px;
border-radius: 4px;
border: none;
background: transparent;
color: var(--text-3);
cursor: pointer;
transition: color 120ms ease, background 120ms ease, transform 100ms var(--ease-out);
}
.win-btn:hover { color: var(--text); background: var(--bg-elev-2); }
.win-btn:active { transform: scale(0.92); }
.win-btn.active { color: var(--accent); background: var(--accent-soft); }
/* 禁用卡片:原因提示保留可读性 */
.account-card.disabled .balance-value { color: var(--text-3); }
.account-card.pending { border-color: var(--border-strong); }