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,7 +10,7 @@
box-shadow: $shadow-sm;
.device-icon {
font-size: 48rpx;
font-size: var(--tk-font-h2);
margin-right: 20rpx;
}
@@ -18,14 +18,14 @@
flex: 1;
.device-name {
font-size: 28rpx;
font-size: var(--tk-font-cap);
font-weight: 600;
color: $tx;
display: block;
}
.device-status {
font-size: 24rpx;
font-size: var(--tk-font-micro);
margin-top: 4rpx;
display: block;
@@ -34,7 +34,7 @@
}
.last-sync {
font-size: 22rpx;
font-size: var(--tk-font-micro);
color: $tx3;
margin-top: 4rpx;
display: block;
@@ -46,6 +46,6 @@
background: $pri;
color: #fff;
border-radius: $r-pill;
font-size: 24rpx;
font-size: var(--tk-font-micro);
}
}

View File

@@ -21,20 +21,20 @@
.empty-state-icon-char {
font-family: Georgia, 'Times New Roman', serif;
font-size: 48px;
font-size: var(--tk-font-hero);
font-weight: 600;
color: $tx3;
}
.empty-state-text {
font-size: 30px;
font-size: var(--tk-font-num);
color: $tx2;
margin-bottom: 8px;
}
.empty-state-hint {
font-size: 24px;
color: $tx3;
font-size: var(--tk-font-h2);
color: var(--tk-text-secondary);
margin-bottom: 32px;
}
@@ -45,6 +45,6 @@
}
.empty-state-action-text {
font-size: 28px;
font-size: var(--tk-font-body-lg);
color: #fff;
}

View File

@@ -9,12 +9,12 @@
}
.error-state-icon {
font-size: 80px;
font-size: 80px; /* hero icon — kept as-is */
margin-bottom: 24px;
}
.error-state-text {
font-size: 28px;
font-size: var(--tk-font-body-lg);
color: $tx2;
margin-bottom: 32px;
text-align: center;
@@ -27,6 +27,6 @@
}
.error-state-retry-text {
font-size: 28px;
font-size: var(--tk-font-body-lg);
color: #fff;
}

View File

@@ -25,12 +25,12 @@
}
.guard-icon {
font-size: 32px;
font-size: var(--tk-font-num);
color: $tx3;
}
.guard-title {
font-size: 18px;
font-size: var(--tk-font-body-sm);
font-weight: 600;
color: $tx;
display: block;
@@ -38,8 +38,8 @@
}
.guard-desc {
font-size: 13px;
color: $tx3;
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
display: block;
margin-bottom: 24px;
}
@@ -58,7 +58,7 @@
}
.guard-btn-text {
font-size: 16px;
font-size: var(--tk-font-body-sm);
font-weight: 600;
color: #fff;
}

View File

@@ -1,5 +1,5 @@
import { View, Text } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { navigateToLogin } from '../../utils/navigate';
import './index.scss';
interface GuestGuardProps {
@@ -18,7 +18,7 @@ export default function GuestGuard({ title, desc }: GuestGuardProps) {
{desc && <Text className='guard-desc'>{desc}</Text>}
<View
className='guard-btn'
onClick={() => Taro.navigateTo({ url: '/pages/login/index' })}
onClick={navigateToLogin}
>
<Text className='guard-btn-text'></Text>
</View>

View File

@@ -25,6 +25,6 @@
}
.loading-state-text {
font-size: 26px;
color: $tx3;
font-size: var(--tk-font-h1);
color: var(--tk-text-secondary);
}

View File

@@ -17,13 +17,13 @@
.progress-ring-percent {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 22px;
font-size: var(--tk-font-body);
font-weight: bold;
line-height: 1;
}
.progress-ring-unit {
font-size: 12px;
font-size: var(--tk-font-micro);
font-weight: 600;
line-height: 1;
}

View File

@@ -39,7 +39,7 @@
justify-content: center;
background: $bd-l;
color: $tx3;
font-size: 24px;
font-size: var(--tk-font-h2);
transition: all 0.3s ease;
z-index: 1;
@@ -55,8 +55,8 @@
}
.step-label {
font-size: 22px;
color: $tx3;
font-size: var(--tk-font-body);
color: var(--tk-text-secondary);
margin-top: 8px;
text-align: center;

View File

@@ -13,8 +13,8 @@
}
.trend-chart-empty-text {
font-size: 28px;
color: $tx3;
font-size: var(--tk-font-body-lg);
color: var(--tk-text-secondary);
}
.trend-chart-skeleton {

View File

@@ -14,13 +14,13 @@
}
.week-arrow {
font-size: 28px;
font-size: var(--tk-font-body-lg);
color: $pri;
padding: 0 16px;
}
.week-label {
font-size: 24px;
font-size: var(--tk-font-h2);
color: $tx;
font-weight: bold;
}
@@ -39,13 +39,13 @@
}
.cell-weekday {
font-size: 22px;
color: $tx3;
font-size: var(--tk-font-body);
color: var(--tk-text-secondary);
display: block;
}
.cell-date {
font-size: 26px;
font-size: var(--tk-font-h1);
color: $tx;
display: block;
margin-top: 4px;