refactor(mp): 迁移剩余 8 特殊页面到统一组件库
- 首页/健康/我的/商城/消息 TabBar 页面使用 PageShell 替代手写容器 - 登录/法律条款/关怀模式设置页使用 PageShell 替代手写容器 - 各页面卡片统一使用 ContentCard 组件 - 清理页面 SCSS 中的 min-height/background/padding 样板代码 - 66 个小程序页面全部完成统一组件迁移
This commit is contained in:
@@ -7,6 +7,8 @@ import { useUIStore } from '../../stores/ui';
|
||||
import { navigateToLogin } from '../../utils/navigate';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
import Loading from '../../components/Loading';
|
||||
import PageShell from '@/components/ui/PageShell';
|
||||
import ContentCard from '@/components/ui/ContentCard';
|
||||
import './index.scss';
|
||||
|
||||
interface MenuItem {
|
||||
@@ -123,10 +125,10 @@ export default function Profile() {
|
||||
const displayInitial = (user?.display_name || user?.username || '用').charAt(0);
|
||||
|
||||
return (
|
||||
<View className={`profile-page ${modeClass}`}>
|
||||
<PageShell padding="md" safeBottom={false} scroll={false} className={`profile-page ${modeClass}`}>
|
||||
{/* 用户信息卡片 */}
|
||||
{isGuest ? (
|
||||
<View className='profile-user-card' onClick={navigateToLogin}>
|
||||
<ContentCard variant="elevated" onPress={navigateToLogin}>
|
||||
<View className='profile-avatar profile-avatar--guest'>
|
||||
<Text className='profile-avatar-char'>?</Text>
|
||||
</View>
|
||||
@@ -135,10 +137,10 @@ export default function Profile() {
|
||||
<Text className='profile-phone'>点击登录,开启健康管理之旅</Text>
|
||||
</View>
|
||||
<Text className='profile-arrow'>›</Text>
|
||||
</View>
|
||||
</ContentCard>
|
||||
) : (
|
||||
<>
|
||||
<View className='profile-user-card'>
|
||||
<ContentCard variant="elevated">
|
||||
<View className='profile-avatar'>
|
||||
<Text className='profile-avatar-char'>{displayInitial}</Text>
|
||||
</View>
|
||||
@@ -149,21 +151,21 @@ export default function Profile() {
|
||||
</Text>
|
||||
</View>
|
||||
<Text className='profile-arrow'>›</Text>
|
||||
</View>
|
||||
</ContentCard>
|
||||
|
||||
{/* 积分 + 打卡 */}
|
||||
{pointsLoading ? (
|
||||
<Loading />
|
||||
) : (
|
||||
<View className='profile-stats-row'>
|
||||
<View className='stat-card'>
|
||||
<ContentCard padding="sm">
|
||||
<Text className='stat-value stat-pri'>{(pointsAccount?.balance ?? 0).toLocaleString()}</Text>
|
||||
<Text className='stat-label'>健康积分</Text>
|
||||
</View>
|
||||
<View className='stat-card'>
|
||||
</ContentCard>
|
||||
<ContentCard padding="sm">
|
||||
<Text className='stat-value stat-acc'>{checkinInfo?.consecutive_days ?? 0}<Text className='stat-unit'>天</Text></Text>
|
||||
<Text className='stat-label'>连续打卡</Text>
|
||||
</View>
|
||||
</ContentCard>
|
||||
</View>
|
||||
)}
|
||||
</>
|
||||
@@ -173,7 +175,7 @@ export default function Profile() {
|
||||
{groups.map((group) => (
|
||||
<View className='menu-group' key={group.title}>
|
||||
<Text className='menu-group-title'>{group.title}</Text>
|
||||
<View className='menu-group-card'>
|
||||
<ContentCard padding="none">
|
||||
{group.items.map((item, idx) => (
|
||||
<View
|
||||
className='menu-item'
|
||||
@@ -188,7 +190,7 @@ export default function Profile() {
|
||||
<Text className='menu-arrow'>›</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</ContentCard>
|
||||
</View>
|
||||
))}
|
||||
|
||||
@@ -202,6 +204,6 @@ export default function Profile() {
|
||||
<Text className='logout-text'>退出登录</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user