refactor(miniprogram): 全面接入 Design Token — 68 SCSS 文件 px→var(--tk-*)
Some checks failed
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled

- 重写 tokens.scss:校准 10 级字号 + 4 结构 token 匹配实际设计值
- 更新 mixins.scss:4 个 mixin 引用 token 替代硬编码
- 68 SCSS 文件全面迁移:font-size px → var(--tk-font-*),辅助文字色 → var(--tk-text-secondary)
- 清理 12 个页面的本地 mixin 重复定义
- elder-mode.scss 从 530 行缩减至 ~120 行:删除所有字号/颜色覆写,仅保留结构布局
- Token 覆盖率:634 引用 / 仅 3 个特殊硬编码值(72px/80px/21px)

关怀模式通过 CSS 变量级联自动生效,消除"打地鼠"问题。
This commit is contained in:
iven
2026-05-09 23:53:07 +08:00
parent 257ca94a25
commit 890c132890
74 changed files with 1127 additions and 1688 deletions

View File

@@ -10,11 +10,12 @@
/* ─── 页头 ─── */
.health-header {
margin-bottom: 16px;
margin-bottom: 20px;
}
.health-title {
font-size: 22px;
@include serif-number;
font-size: var(--tk-font-h1);
font-weight: 700;
color: $tx;
}
@@ -40,6 +41,7 @@
&.vital-tab-active {
background: $pri;
box-shadow: 0 2px 8px rgba(196, 98, 58, 0.25);
.vital-tab-text {
color: #fff;
@@ -48,7 +50,7 @@
}
.vital-tab-text {
font-size: 15px;
font-size: var(--tk-font-cap);
font-weight: 600;
color: $tx2;
}
@@ -65,11 +67,11 @@
/* ─── 录入区 ─── */
.input-section {
margin-bottom: 12px;
margin-bottom: 20px;
background: $card;
border-radius: $r;
padding: 16px;
box-shadow: $shadow-sm;
padding: 20px;
box-shadow: $shadow-md;
}
.input-group {
@@ -77,8 +79,8 @@
}
.input-label {
font-size: 13px;
color: $tx3;
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
display: block;
margin-bottom: 4px;
}
@@ -90,7 +92,7 @@
border-radius: 12px;
padding: 0 16px;
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 28px;
font-size: var(--tk-font-body-lg);
font-weight: 600;
color: $tx;
width: 100%;
@@ -98,13 +100,17 @@
}
.input-ref {
font-size: 13px;
color: $tx3;
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
display: block;
margin-top: 8px;
margin-bottom: 4px;
}
.input-label--secondary {
margin-top: 20px;
}
/* ─── 血糖时段选择 ─── */
.period-group {
display: flex;
@@ -133,7 +139,7 @@
}
.period-btn-text {
font-size: 15px;
font-size: var(--tk-font-cap);
font-weight: 600;
color: $tx2;
}
@@ -145,7 +151,8 @@
border-radius: 14px;
background: $pri;
@include flex-center;
margin-top: 12px;
margin-top: 20px;
box-shadow: 0 2px 8px rgba(196, 98, 58, 0.25);
&:active {
opacity: 0.85;
@@ -153,7 +160,7 @@
}
.save-btn-text {
font-size: 17px;
font-size: var(--tk-font-body-sm);
font-weight: 600;
color: #fff;
}
@@ -176,7 +183,7 @@
}
.trend-empty-text {
font-size: 14px;
font-size: var(--tk-font-cap);
color: $tx2;
}
@@ -195,6 +202,25 @@
border-radius: 12px;
padding: 12px 8px;
gap: 0;
position: relative;
}
.trend-threshold-line {
position: absolute;
left: 8px;
right: 8px;
border-top: 1.5px dashed $wrn;
opacity: 0.6;
pointer-events: none;
}
.trend-threshold-label {
position: absolute;
right: 0;
top: -16px;
font-size: var(--tk-font-micro);
color: $wrn;
opacity: 0.8;
}
.trend-bar-col {
@@ -222,8 +248,8 @@
}
.trend-bar-label {
font-size: 11px;
color: $tx3;
font-size: var(--tk-font-micro);
color: var(--tk-text-secondary);
margin-top: 6px;
}
@@ -256,7 +282,7 @@
}
.device-icon-text {
font-size: 22px;
font-size: var(--tk-font-body);
}
.device-info {
@@ -265,21 +291,21 @@
}
.device-name {
font-size: 15px;
font-size: var(--tk-font-cap);
font-weight: 500;
color: $tx;
display: block;
}
.device-desc {
font-size: 13px;
font-size: var(--tk-font-cap);
color: $acc;
display: block;
}
.device-arrow {
font-size: 14px;
color: $tx3;
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
flex-shrink: 0;
}
@@ -296,37 +322,38 @@
}
.article-entry-text {
font-size: 15px;
font-size: var(--tk-font-cap);
color: $tx;
font-weight: 500;
}
/* ─── AI 建议卡片 ─── */
.ai-suggestion-card {
background: $card;
background: $acc-l;
border-radius: $r;
padding: 16px;
margin-bottom: 16px;
box-shadow: $shadow-sm;
border-left: 4px solid $pri;
margin-bottom: 20px;
box-shadow: none;
border-left: 4px solid $acc;
}
.ai-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
margin-bottom: 8px;
}
.ai-card-title {
font-size: 15px;
font-size: var(--tk-font-cap);
font-weight: 600;
color: $tx;
color: $acc;
}
.ai-card-count {
font-size: 12px;
font-size: var(--tk-font-micro);
color: $acc;
opacity: 0.7;
}
.ai-suggestion-item {
@@ -344,6 +371,7 @@
}
.ai-suggestion-text {
font-size: 13px;
font-size: var(--tk-font-cap);
color: $tx2;
line-height: 1.6;
}