Files
hms/apps/miniprogram/src/pages/index/index.scss
iven 890c132890
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
refactor(miniprogram): 全面接入 Design Token — 68 SCSS 文件 px→var(--tk-*)
- 重写 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 变量级联自动生效,消除"打地鼠"问题。
2026-05-09 23:53:07 +08:00

474 lines
7.8 KiB
SCSS

@import '../../styles/variables.scss';
@import '../../styles/mixins.scss';
/* ═══════════════════════════════════════
登录后首页
═══════════════════════════════════════ */
.home-page {
min-height: 100vh;
background: $bg;
padding: 20px 24px 100px;
padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
/* ─── 问候区 ─── */
.greeting-section {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 24px;
}
.greeting-left {
flex: 1;
}
.greeting-text {
@include serif-number;
font-size: var(--tk-font-h1);
font-weight: 700;
color: $tx;
display: block;
margin-bottom: 4px;
}
.greeting-date {
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
}
.greeting-bell {
position: relative;
width: 44px;
height: 44px;
border-radius: 22px;
background: $pri-l;
@include flex-center;
flex-shrink: 0;
&:active {
opacity: 0.7;
}
}
.greeting-bell-icon {
font-size: var(--tk-font-body-sm);
color: $pri-d;
}
.greeting-bell-dot {
position: absolute;
top: 6px;
right: 6px;
width: 8px;
height: 8px;
border-radius: 4px;
background: $dan;
}
/* ─── 今日体征进度 ─── */
.checkin-card {
background: $card;
border-radius: $r;
box-shadow: $shadow-md;
padding: 20px;
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 16px;
&:active {
opacity: 0.9;
}
}
.checkin-left {
flex-shrink: 0;
position: relative;
}
.checkin-right {
flex: 1;
min-width: 0;
}
.checkin-title {
font-size: var(--tk-font-body-sm);
font-weight: 600;
color: $tx;
display: block;
margin-bottom: 8px;
}
.checkin-capsules {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.capsule {
font-size: var(--tk-font-micro);
padding: 3px 8px;
border-radius: $r-pill;
font-weight: 500;
&.capsule-done {
background: $acc-l;
color: $acc;
}
&.capsule-pending {
background: $surface-alt;
color: $tx3;
}
}
/* ─── 今日体征 2x2 ─── */
.vitals-section {
margin-bottom: 16px;
}
.section-title {
@include section-title;
}
.vitals-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.vital-card {
background: $card;
border-radius: $r;
padding: 14px 16px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.7;
}
}
.vital-label {
font-size: var(--tk-font-cap);
color: $tx2;
display: block;
margin-bottom: 6px;
}
.vital-value-row {
display: flex;
align-items: baseline;
margin-bottom: 6px;
}
.vital-value {
@include serif-number;
font-size: var(--tk-font-num);
font-weight: 700;
color: $tx;
line-height: 1;
}
.vital-unit {
font-size: var(--tk-font-micro);
color: var(--tk-text-secondary);
margin-left: 3px;
}
.vital-bottom {
display: flex;
align-items: center;
}
.vital-tag {
font-size: var(--tk-font-micro);
font-weight: 500;
padding: 2px 8px;
border-radius: $r-pill;
display: inline-block;
margin-top: 4px;
&.tag-ok {
background: $acc-l;
color: $acc;
}
&.tag-warn {
background: $wrn-l;
color: $wrn;
}
&.tag-empty {
background: $surface-alt;
color: $tx3;
}
}
/* ─── 智能提醒卡片 ─── */
.reminder-card {
background: linear-gradient(135deg, $pri 0%, $pri-d 100%);
border-radius: $r;
padding: 18px;
margin-bottom: 16px;
color: #fff;
}
.reminder-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.reminder-title {
font-size: var(--tk-font-cap);
font-weight: 600;
color: #fff;
}
.reminder-count {
font-size: var(--tk-font-micro);
opacity: 0.7;
color: #fff;
}
.reminder-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 0;
&:active {
opacity: 0.8;
}
}
.reminder-item-border {
border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.reminder-tag {
font-size: var(--tk-font-micro);
padding: 2px 6px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.2);
font-weight: 500;
color: #fff;
flex-shrink: 0;
}
.reminder-text {
font-size: var(--tk-font-cap);
flex: 1;
color: #fff;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.reminder-arrow {
opacity: 0.5;
color: #fff;
flex-shrink: 0;
}
/* ─── 快捷操作 ─── */
.action-section {
display: flex;
gap: 10px;
margin-top: 8px;
}
.action-btn {
flex: 1;
height: 52px;
border-radius: 14px;
@include flex-center;
&:active {
opacity: 0.85;
}
}
.action-primary {
background: $pri;
color: #fff;
box-shadow: 0 2px 8px rgba(196, 98, 58, 0.25);
}
.action-outline {
background: transparent;
color: $pri;
border: 2px solid $pri;
}
.action-btn-text {
font-size: var(--tk-font-body-sm);
font-weight: 600;
}
/* ═══════════════════════════════════════
访客首页
═══════════════════════════════════════ */
.guest-page {
min-height: 100vh;
background: $bg;
padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
/* ─── 轮播图 ─── */
.guest-swiper {
width: 100%;
height: 360px;
}
.guest-slide {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
.guest-slide-bg {
position: absolute;
inset: 0;
&--1 {
background: linear-gradient(135deg, $pri-d 0%, $pri 60%, $pri-l 100%);
}
}
.guest-slide:nth-child(2) .guest-slide-bg {
background: linear-gradient(135deg, $acc 0%, #3D5A40 60%, $acc-l 100%);
}
.guest-slide:nth-child(3) .guest-slide-bg {
background: linear-gradient(135deg, #8B6F4E 0%, $wrn 60%, $wrn-l 100%);
}
.guest-slide-content {
position: relative;
z-index: 1;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
padding: 40px 32px;
}
.guest-slide-title {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: var(--tk-font-h1);
font-weight: 700;
color: #FFFFFF;
display: block;
margin-bottom: 8px;
}
.guest-slide-desc {
font-size: var(--tk-font-body-sm);
color: rgba(255, 255, 255, 0.85);
display: block;
}
/* ─── 健康资讯 ─── */
.guest-section {
padding: 24px 24px 0;
}
.guest-section-title {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: var(--tk-font-body);
font-weight: bold;
color: $tx;
display: block;
margin-bottom: 16px;
}
.guest-articles {
display: flex;
flex-direction: column;
gap: 12px;
}
.guest-article-card {
background: $card;
border-radius: $r;
padding: 16px 18px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.85;
}
}
.guest-article-title {
font-size: var(--tk-font-body-sm);
font-weight: 600;
color: $tx;
display: block;
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.guest-article-summary {
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.guest-empty {
padding: 40px 0;
text-align: center;
}
.guest-empty-text {
font-size: var(--tk-font-cap);
color: var(--tk-text-secondary);
}
/* ─── 底部登录引导 ─── */
.guest-login-prompt {
margin: 24px 24px 0;
background: $card;
border-radius: $r;
padding: 20px;
box-shadow: $shadow-md;
display: flex;
align-items: center;
gap: 16px;
}
.guest-login-text {
flex: 1;
font-size: var(--tk-font-cap);
color: $tx2;
}
.guest-login-btn {
height: 56px;
padding: 0 28px;
background: $pri;
border-radius: $r-pill;
@include flex-center;
flex-shrink: 0;
&:active {
opacity: 0.85;
}
}
.guest-login-btn-text {
font-size: var(--tk-font-h2);
font-weight: 600;
color: #fff;
}