refactor(mp): 迁移剩余 8 特殊页面到统一组件库

- 首页/健康/我的/商城/消息 TabBar 页面使用 PageShell 替代手写容器
- 登录/法律条款/关怀模式设置页使用 PageShell 替代手写容器
- 各页面卡片统一使用 ContentCard 组件
- 清理页面 SCSS 中的 min-height/background/padding 样板代码
- 66 个小程序页面全部完成统一组件迁移
This commit is contained in:
iven
2026-05-16 01:55:28 +08:00
parent c6bffd4019
commit 184bd0ea03
17 changed files with 109 additions and 179 deletions

View File

@@ -2,9 +2,6 @@
@import '../../styles/mixins.scss';
.health-page {
min-height: 100vh;
background: $bg;
padding: 20px 24px 100px;
padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
@@ -23,10 +20,6 @@
/* ─── 录入区 ─── */
.input-section {
margin-bottom: 20px;
background: $card;
border-radius: $r;
padding: 20px;
box-shadow: $shadow-md;
}
.input-group {
@@ -130,11 +123,7 @@
}
.trend-empty {
background: $card;
border-radius: $r;
padding: 24px;
text-align: center;
box-shadow: $shadow-sm;
}
.trend-empty-text {
@@ -143,10 +132,7 @@
}
.trend-chart {
background: $card;
border-radius: $r;
padding: 16px;
box-shadow: $shadow-sm;
}
.trend-bars {
@@ -217,10 +203,6 @@
display: flex;
align-items: center;
gap: 12px;
background: $card;
border-radius: $r;
padding: 16px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.85;
@@ -266,11 +248,6 @@
/* ─── 健康资讯入口 ─── */
.article-entry {
background: $card;
border-radius: $r;
padding: 16px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.85;
}

View File

@@ -8,6 +8,8 @@ import Loading from '../../components/Loading';
import ErrorState from '../../components/ErrorState';
import GuestGuard from '../../components/GuestGuard';
import SegmentTabs from '../../components/SegmentTabs';
import PageShell from '@/components/ui/PageShell';
import ContentCard from '@/components/ui/ContentCard';
import { useHealthData, VITAL_TABS, type VitalType } from './useHealthData';
import './index.scss';
@@ -48,12 +50,12 @@ export default function Health() {
if (error) {
return (
<View className={`health-page ${modeClass}`}>
<PageShell padding="md" safeBottom={false} scroll={false} className={`health-page ${modeClass}`}>
<View className='health-header'>
<Text className='health-title'></Text>
</View>
<ErrorState onRetry={fetchData} />
</View>
</PageShell>
);
}
@@ -162,7 +164,7 @@ export default function Health() {
const dayLabels = ['日', '一', '二', '三', '四', '五', '六'];
return (
<View className={`health-page ${modeClass}`}>
<PageShell padding="md" safeBottom={false} scroll={false} className={`health-page ${modeClass}`}>
<View className='health-header'>
<Text className='health-title'></Text>
</View>
@@ -199,7 +201,7 @@ export default function Health() {
<SegmentTabs tabs={VITAL_TABS} activeKey={activeTab} onChange={handleTabChange} variant="pill" />
<View className='input-section'>
<ContentCard variant="elevated">
{activeTab === 'blood_pressure' && (
<View className='input-group'>
<Text className='input-label'></Text>
@@ -281,18 +283,18 @@ export default function Health() {
<View className='save-btn' onClick={handleSave}>
<Text className='save-btn-text'>{saving ? '保存中...' : '保存'}</Text>
</View>
</View>
</ContentCard>
<View className='trend-section'>
<Text className='section-title'> 7 </Text>
{trendLoading ? (
<Loading />
) : trendData.length === 0 ? (
<View className='trend-empty'>
<ContentCard padding="md">
<Text className='trend-empty-text'></Text>
</View>
</ContentCard>
) : (
<View className='trend-chart'>
<ContentCard padding="md">
<View className='trend-bars'>
{getThresholdValue(activeTab, thresholds) && (() => {
const tv = getThresholdValue(activeTab, thresholds)!;
@@ -319,16 +321,15 @@ export default function Health() {
);
})}
</View>
</View>
</ContentCard>
)}
</View>
<View
className='article-entry'
onClick={() => Taro.navigateTo({ url: '/pages/article/index' })}
<ContentCard
onPress={() => Taro.navigateTo({ url: '/pages/article/index' })}
>
<Text className='article-entry-text'> </Text>
</View>
</View>
</ContentCard>
</PageShell>
);
}