Files
frost-zx 9e88456f73 feat: 新增阶梯提醒与请求失败告警规则
- 阶梯提醒:以「上次提醒时的价格」为基准,每偏离一个步长提醒一次并更新基准;
  方向支持每上涨/每下跌/双向,步长可填具体变动值或百分比,基准落盘 rule-state.json
- 请求失败告警:某品种连续抓取失败达到设定次数时提醒一次;抓取成功即清零,
  下一波连续失败可重新触发;支持「持续失败每 N 秒重复提醒」与生效时段
- 配置归一化接受 ladder / failure 类型,失败告警的 value 按次数取整、冷却固定为 0
- 规则弹窗补充两类规则的字段显隐、方向文案、预览与说明;重复间隔标签按类型切换
- 规则列表新增橙色「阶梯」、红色「失败告警」标签,失败告警不展示冷却
- README 补阶梯提醒与请求失败告警章节,规则类型更新为六类
2026-11-24 18:01:49 +08:00

546 lines
17 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 金价提醒 · 界面样式(浅色版)
暖白纸感底色 + 香槟金点缀,靠细描边和轻阴影分层次,避免大面积重色块。 */
:root {
--bg: #f7f5f0;
--bg-soft: #fffdf9;
--panel: #ffffff;
--panel-2: #f4f1e9;
--line: #e6e1d5;
--line-strong: #d8d2c3;
--text: #1d2127;
--text-dim: #5f6773;
--text-faint: #6b7382;
--gold: #b8862f;
--gold-soft: #8a5f13;
--gold-wash: #faf4e6;
--up: #d23c2f;
--down: #0f8a55;
--warn: #c07a12;
--radius: 14px;
--shadow-sm: 0 1px 2px rgba(28, 24, 16, .04);
--shadow-md: 0 10px 28px rgba(28, 24, 16, .07);
}
* { box-sizing: border-box; }
/* 有些元素自带 display,需要强制让 [hidden] 生效 */
[hidden] { display: none !important; }
body {
margin: 0;
min-height: 100vh;
background:
radial-gradient(1100px 520px at 88% -12%, rgba(184, 134, 47, .10), transparent 62%),
radial-gradient(900px 480px at -8% 4%, rgba(120, 150, 190, .07), transparent 58%),
var(--bg);
color: var(--text);
font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
font-size: 14px;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
code {
background: var(--gold-wash);
border: 1px solid #efe6d0;
border-radius: 5px;
padding: 1px 5px;
font-size: 12px;
color: #7a5715;
}
/* ---------------- 顶栏 ---------------- */
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 18px 28px 14px;
border-bottom: 1px solid var(--line);
background: rgba(255, 255, 255, .78);
backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
width: 42px; height: 42px;
display: grid; place-items: center;
border-radius: 12px;
background: linear-gradient(140deg, #f6dda2, #c79327 72%);
color: #3a2a06;
font-weight: 800;
font-size: 17px;
letter-spacing: .5px;
box-shadow: 0 3px 10px rgba(184, 134, 47, .28);
}
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: .5px; color: #171a1f; }
.brand-text p { margin: 0; font-size: 11px; color: var(--text-faint); letter-spacing: 1.5px; text-transform: uppercase; }
.status-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
display: inline-flex; align-items: center; gap: 7px;
padding: 5px 12px;
border: 1px solid var(--line);
border-radius: 999px;
font-size: 12px;
color: var(--text-dim);
background: #fff;
box-shadow: var(--shadow-sm);
}
.pill .dot {
width: 7px; height: 7px; border-radius: 50%;
background: var(--text-faint);
}
.pill.running .dot { background: var(--down); box-shadow: 0 0 0 3px rgba(15, 138, 85, .12); }
.pill.running { color: #0c6b44; border-color: #cbe7da; background: #f2fbf7; }
.pill.paused .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(192, 122, 18, .12); }
.pill.muted { color: var(--gold-soft); border-color: #ecdfc2; background: var(--gold-wash); }
.clock { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* ---------------- 通用按钮 ---------------- */
.btn {
border: 1px solid var(--line-strong);
background: #fff;
color: var(--text);
padding: 8px 16px;
border-radius: 10px;
font-size: 13px;
cursor: pointer;
transition: .15s ease;
white-space: nowrap;
box-shadow: var(--shadow-sm);
}
.btn:hover { background: #fffdf7; border-color: #cbb98d; transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary {
background: linear-gradient(140deg, #f3d38f, #cf9c31);
border-color: #c08b22;
color: #3a2a06;
font-weight: 600;
box-shadow: 0 4px 12px rgba(184, 134, 47, .22);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { background: #fff; }
.btn.danger { color: #b8332a; border-color: #eececb; background: #fff8f7; }
.btn.danger:hover { background: #fdf0ee; border-color: #e2b3ad; }
.btn.tiny { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.icon-btn {
border: none; background: transparent; color: var(--text-faint);
font-size: 16px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { color: var(--text); }
/* ---------------- 标签页 ---------------- */
.tabs {
display: flex;
/* 允许换行:极窄窗口下标签自动折行,不用横向滚动 */
flex-wrap: wrap;
gap: 6px;
padding: 14px 28px 0;
border-bottom: 1px solid var(--line);
background: rgba(255, 255, 255, .6);
/* 注意:这里不要写 overflow-x: auto。
一旦设了 overflow-x,overflow-y 会被一并算成 auto,
再叠加 .tab.active::after 的 bottom:-1px(超出 1px),
顶部菜单就会冒出一条多余的滚动条。 */
}
.tab {
position: relative;
border: none;
background: transparent;
color: var(--text-dim);
padding: 10px 14px 14px;
font-size: 14px;
cursor: pointer;
white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-soft); font-weight: 600; }
.tab.active::after {
content: "";
position: absolute; left: 12px; right: 12px; bottom: -1px;
height: 2px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.badge {
display: inline-block;
margin-left: 6px;
min-width: 18px;
padding: 0 5px;
border-radius: 999px;
background: #fbecea;
color: #b3352a;
font-size: 11px;
text-align: center;
}
/* ---------------- 主体 ---------------- */
main { padding: 22px 28px 60px; max-width: 1320px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.section-head {
display: flex; align-items: flex-start; justify-content: space-between;
gap: 16px; margin-bottom: 16px;
}
.section-head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; color: #14171c; }
.hint { margin: 0; color: var(--text-faint); font-size: 12.5px; }
.empty { color: var(--text-faint); text-align: center; padding: 40px 0; }
/* ---------------- 行情卡片 ---------------- */
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
gap: 14px;
}
.card {
position: relative;
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 16px 18px;
overflow: hidden;
box-shadow: var(--shadow-sm);
transition: box-shadow .18s ease, transform .18s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card::before {
content: "";
position: absolute; inset: 0 auto 0 0;
width: 3px;
background: linear-gradient(180deg, rgba(184, 134, 47, .7), rgba(184, 134, 47, .12));
}
.card.disabled { opacity: .62; }
.card.disabled:hover { transform: none; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; color: #14171c; }
.card-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.source-tag {
font-size: 10.5px; color: var(--text-faint);
border: 1px solid var(--line); border-radius: 6px;
padding: 1px 6px;
background: var(--bg-soft);
}
.price-row { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 2px; }
.price {
font-size: 30px; font-weight: 700; letter-spacing: -.5px;
font-variant-numeric: tabular-nums;
color: #0f1216;
}
.price.stale { color: var(--text-faint); font-size: 24px; }
.unit { font-size: 12px; color: var(--text-faint); }
.change-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.change.up { color: var(--up); }
.change.down { color: var(--down); }
.change.flat { color: var(--text-dim); }
.change-row .js-range { color: var(--text-faint); }
.spark { display: block; width: 100%; height: 34px; margin: 8px 0 6px; }
.meta {
display: flex; flex-wrap: wrap; gap: 4px 12px;
font-size: 11.5px; color: var(--text-faint);
font-variant-numeric: tabular-nums;
}
.meta .status { display: inline-flex; align-items: center; gap: 4px; }
.meta .status i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status.ok { color: #0c6b44; }
.status.ok i { background: var(--down); }
.status.error { color: #b3352a; }
.status.error i { background: var(--up); }
.status.pending { color: #8a5f13; }
.status.pending i { background: var(--warn); }
.status.manual { color: var(--gold-soft); }
.status.manual i { background: var(--gold); }
.status.disabled i { background: var(--text-faint); }
.card-error {
margin-top: 8px;
font-size: 11.5px;
color: #a3271f;
background: #fdf2f0;
border: 1px solid #f0cfca;
border-radius: 8px;
padding: 6px 9px;
word-break: break-all;
}
.card-foot {
display: flex; align-items: center; justify-content: space-between;
gap: 8px; margin-top: 12px; padding-top: 11px;
border-top: 1px dashed var(--line);
}
.card-foot .btn-row { display: flex; gap: 6px; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
position: absolute; inset: 0;
background: #dcd7ca;
border: 1px solid #cfc8b8;
border-radius: 999px;
cursor: pointer;
transition: .2s;
}
.switch span::before {
content: "";
position: absolute; width: 14px; height: 14px;
left: 3px; top: 3px;
background: #fff;
box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
border-radius: 50%;
transition: .2s;
}
.switch input:checked + span {
background: linear-gradient(135deg, #e7c27a, #c79230);
border-color: #b8862f;
}
.switch input:checked + span::before { background: #fffdf6; transform: translateX(18px); }
.manual-row { display: flex; gap: 6px; margin-top: 10px; }
.manual-row input {
flex: 1; min-width: 0;
background: #fff;
border: 1px solid var(--line-strong);
border-radius: 9px;
padding: 7px 10px;
font-size: 13px;
color: var(--text);
font-family: inherit;
outline: none;
}
.manual-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 134, 47, .12); }
/* ---------------- 规则列表 ---------------- */
.rule-list { display: flex; flex-direction: column; gap: 10px; }
.rule-item {
display: flex; align-items: center; gap: 14px;
padding: 14px 18px;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 12px;
box-shadow: var(--shadow-sm);
}
.rule-item.disabled { opacity: .6; }
.rule-main { flex: 1; min-width: 0; }
.rule-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-name { font-weight: 600; font-size: 14px; color: #14171c; }
.tag {
font-size: 10.5px; padding: 1px 7px; border-radius: 6px;
border: 1px solid var(--line); color: var(--text-dim);
background: var(--bg-soft);
}
.tag.threshold { color: var(--gold-soft); border-color: #e8d7b4; background: var(--gold-wash); }
.tag.change { color: #2a5b96; border-color: #cfe0f2; background: #f2f7fc; }
.tag.spread { color: #6a4b9a; border-color: #e0d4f0; background: #f7f3fc; }
/* 定时提醒:用偏绿的色,和三种价格条件规则区分开 */
.tag.schedule { color: #1f7a5c; border-color: #cfe8dd; background: #f1faf6; }
/* 阶梯提醒:橙色系,和阈值/涨跌幅区分 */
.tag.ladder { color: #a35a12; border-color: #f2ddc4; background: #fdf6ec; }
/* 请求失败告警:红色系,属于异常提示 */
.tag.failure { color: #b23b3b; border-color: #f0cccc; background: #fdf2f2; }
/* 导入配置前的摘要区块 */
.import-summary {
margin-top: 10px;
padding: 12px 14px;
border: 1px solid var(--line);
border-radius: 10px;
background: var(--panel-2, #fbfaf6);
font-size: 12.5px;
line-height: 1.9;
color: var(--text-dim);
}
.import-summary b { color: var(--text); }
.rule-cond { margin-top: 4px; font-size: 12.5px; color: var(--text-dim); }
.rule-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-faint); }
.rule-actions { display: flex; align-items: center; gap: 8px; }
/* ---------------- 设置区 ---------------- */
.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.setting-card { margin-bottom: 14px; }
.setting-card .card-head { margin-bottom: 6px; align-items: center; }
.setting-card h3 { margin: 0; font-size: 15px; color: #14171c; }
.form-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px 16px;
margin: 14px 0 4px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.field.wide { grid-column: 1 / -1; }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field.check-field { flex-direction: row; align-items: center; justify-content: space-between; }
.field input, .field select, .field textarea {
background: #fff;
border: 1px solid var(--line-strong);
border-radius: 9px;
padding: 8px 11px;
color: var(--text);
font-size: 13px;
font-family: inherit;
outline: none;
transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
border-color: var(--gold);
box-shadow: 0 0 0 3px rgba(184, 134, 47, .12);
}
.field input.narrow { width: 120px; }
.field input[type="checkbox"] {
width: 16px; height: 16px;
padding: 0; border: none; background: none;
accent-color: var(--gold);
}
input::placeholder { color: #a8a294; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
/* 不在 .field 里的裸输入框(如静默时段区间)也套用同一套皮肤 */
.row > input[type="text"], .row > input[type="number"] {
background: #fff;
border: 1px solid var(--line-strong);
border-radius: 9px;
padding: 7px 11px;
color: var(--text);
font-size: 13px;
font-family: inherit;
outline: none;
width: 150px;
}
.row > input[type="text"]:focus, .row > input[type="number"]:focus {
border-color: var(--gold);
box-shadow: 0 0 0 3px rgba(184, 134, 47, .12);
}
.label-text { color: var(--text-dim); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.check input { accent-color: var(--gold); }
.test-result { font-size: 12px; color: var(--text-faint); }
.test-result.ok { color: #0c6b44; }
.test-result.err { color: #b8332a; }
.sticky-save {
position: sticky; bottom: 0;
padding: 12px 0 6px;
background: linear-gradient(180deg, transparent, var(--bg) 45%);
}
/* ---------------- 提醒记录 ---------------- */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
padding: 13px 16px;
background: var(--panel);
border: 1px solid var(--line);
border-left: 3px solid var(--gold);
border-radius: 10px;
box-shadow: var(--shadow-sm);
}
.alert-title { font-weight: 600; font-size: 13.5px; color: #14171c; }
.alert-msg { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.alert-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--text-faint); }
.alert-meta .chan { color: var(--text-dim); }
.alert-meta .chan.ok { color: #0c6b44; }
.alert-meta .chan.err { color: #b8332a; }
/* ---------------- 弹窗 ---------------- */
.modal {
position: fixed; inset: 0; z-index: 50;
display: grid; place-items: center;
background: rgba(35, 30, 22, .38);
backdrop-filter: blur(4px);
padding: 20px;
}
.modal[hidden] { display: none; }
.modal-box {
width: min(720px, 100%);
max-height: 88vh;
overflow: auto;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 16px;
box-shadow: 0 24px 60px rgba(28, 24, 16, .18);
}
.modal-head {
display: flex; align-items: center; justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--line);
position: sticky; top: 0;
background: var(--panel);
z-index: 1;
}
.modal-head h3 { margin: 0; font-size: 16px; color: #14171c; }
.modal-body { padding: 18px 20px 6px; }
.modal-foot {
display: flex; align-items: center; justify-content: flex-end; gap: 10px;
padding: 14px 20px 18px;
border-top: 1px solid var(--line);
position: sticky; bottom: 0;
background: var(--panel);
}
.modal-foot .test-result { margin-right: auto; }
/* ---------------- 轻提示 ---------------- */
.toast-wrap {
position: fixed; right: 22px; bottom: 22px;
display: flex; flex-direction: column; gap: 8px;
z-index: 99;
}
.toast {
padding: 10px 16px;
border-radius: 10px;
background: #fff;
border: 1px solid var(--line-strong);
color: var(--text);
font-size: 13px;
box-shadow: var(--shadow-md);
animation: slideIn .2s ease;
}
.toast.ok { border-color: #bfe0d0; background: #f5fcf8; color: #0c6b44; }
.toast.err { border-color: #eec9c4; background: #fdf3f1; color: #a3271f; }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
/* ---------------- 规则弹窗:生效时段 ---------------- */
.time-range {
display: flex;
align-items: center;
gap: 8px;
}
.time-range input[type="time"] {
flex: 1 1 0;
min-width: 0;
}
.range-sep {
color: var(--text-faint);
font-size: 13px;
flex: 0 0 auto;
}
/* ---------------- 窄屏适配 ---------------- */
@media (max-width: 720px) {
.topbar { flex-direction: column; align-items: flex-start; padding: 16px; }
main { padding: 18px 16px 60px; }
.tabs { padding: 10px 16px 0; }
.price { font-size: 26px; }
.rule-item { flex-wrap: wrap; }
.form-grid { grid-template-columns: 1fr; }
}