refactor(mp): 迁移剩余 8 特殊页面到统一组件库
- 首页/健康/我的/商城/消息 TabBar 页面使用 PageShell 替代手写容器 - 登录/法律条款/关怀模式设置页使用 PageShell 替代手写容器 - 各页面卡片统一使用 ContentCard 组件 - 清理页面 SCSS 中的 min-height/background/padding 样板代码 - 66 个小程序页面全部完成统一组件迁移
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
@import '../../styles/mixins.scss';
|
||||
|
||||
.messages-page {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
// PageShell 接管 min-height, background
|
||||
padding: 20px 24px 100px;
|
||||
padding-bottom: calc(100px + env(safe-area-inset-bottom));
|
||||
}
|
||||
@@ -91,14 +90,7 @@
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 16px;
|
||||
box-shadow: $shadow-sm;
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
}
|
||||
// ContentCard 接管 background, border-radius, padding, box-shadow, active feedback
|
||||
}
|
||||
|
||||
.consult-card-muted {
|
||||
@@ -188,10 +180,7 @@
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 16px;
|
||||
box-shadow: $shadow-sm;
|
||||
// ContentCard 接管 background, border-radius, padding, box-shadow
|
||||
}
|
||||
|
||||
.notify-card-muted {
|
||||
|
||||
@@ -10,6 +10,8 @@ import GuestGuard from '../../components/GuestGuard';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import { useElderClass } from '../../hooks/useElderClass';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
import PageShell from '@/components/ui/PageShell';
|
||||
import ContentCard from '@/components/ui/ContentCard';
|
||||
import './index.scss';
|
||||
|
||||
type MsgTab = 'consultation' | 'notification';
|
||||
@@ -116,7 +118,7 @@ export default function Messages() {
|
||||
const unreadConsultCount = sessions.filter((s) => s.unread_count_patient > 0).length;
|
||||
|
||||
return (
|
||||
<View className={`messages-page ${modeClass}`}>
|
||||
<PageShell safeBottom={false} scroll={false} className={`messages-page ${modeClass}`}>
|
||||
{/* 页头 */}
|
||||
<View className='messages-header'>
|
||||
<Text className='messages-title'>消息</Text>
|
||||
@@ -160,10 +162,11 @@ export default function Messages() {
|
||||
const doctorName = session.last_message?.slice(0, 1) || '医';
|
||||
const hasUnread = session.unread_count_patient > 0;
|
||||
return (
|
||||
<View
|
||||
<ContentCard
|
||||
key={session.id}
|
||||
onPress={() => Taro.navigateTo({ url: `/pages/pkg-consultation/detail/index?id=${session.id}` })}
|
||||
padding="sm"
|
||||
className={`consult-card ${hasUnread ? '' : 'consult-card-muted'}`}
|
||||
onClick={() => Taro.navigateTo({ url: `/pages/pkg-consultation/detail/index?id=${session.id}` })}
|
||||
>
|
||||
<View className={`consult-avatar ${hasUnread ? 'consult-avatar-active' : ''}`}>
|
||||
<Text className='consult-avatar-char'>{doctorName}</Text>
|
||||
@@ -188,7 +191,7 @@ export default function Messages() {
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ContentCard>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
@@ -207,7 +210,7 @@ export default function Messages() {
|
||||
const cfg = NOTIFY_ICONS[n.type] || NOTIFY_ICONS.report;
|
||||
const isUnread = !n.read;
|
||||
return (
|
||||
<View key={n.id} className={`notify-card ${isUnread ? '' : 'notify-card-muted'}`}>
|
||||
<ContentCard key={n.id} padding="sm" activeFeedback="none" className={`notify-card ${isUnread ? '' : 'notify-card-muted'}`}>
|
||||
<View className={`notify-icon ${cfg.cls}`}>
|
||||
<Text className={`notify-icon-char ${cfg.cls}`}>{cfg.icon}</Text>
|
||||
</View>
|
||||
@@ -219,7 +222,7 @@ export default function Messages() {
|
||||
<Text className='notify-desc'>{n.desc}</Text>
|
||||
</View>
|
||||
{isUnread && <View className='notify-dot' />}
|
||||
</View>
|
||||
</ContentCard>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
@@ -228,6 +231,6 @@ export default function Messages() {
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user