fix(miniprogram): 首页/健康页/详情页统一使用 Loading 组件

This commit is contained in:
iven
2026-04-24 12:27:16 +08:00
parent f75bc191e6
commit 54a0e393ac
3 changed files with 22 additions and 13 deletions

View File

@@ -3,11 +3,12 @@ import Taro, { useDidShow } from '@tarojs/taro';
import { useAuthStore } from '../../stores/auth';
import { useHealthStore } from '../../stores/health';
import EmptyState from '../../components/EmptyState';
import Loading from '../../components/Loading';
import './index.scss';
export default function Index() {
const { user, currentPatient, restore: restoreAuth } = useAuthStore();
const { todaySummary, refreshToday } = useHealthStore();
const { todaySummary, loading, refreshToday } = useHealthStore();
useDidShow(() => {
restoreAuth();
@@ -48,15 +49,19 @@ export default function Index() {
<View className='health-card'>
<Text className='section-title'></Text>
<View className='health-grid'>
{healthItems.map((item) => (
<View className='health-item' key={item.label}>
<Text className='health-label'>{item.label}</Text>
<Text className='health-value'>{item.value}</Text>
<Text className='health-unit'>{item.unit}</Text>
</View>
))}
</View>
{loading && !todaySummary ? (
<Loading />
) : (
<View className='health-grid'>
{healthItems.map((item) => (
<View className='health-item' key={item.label}>
<Text className='health-label'>{item.label}</Text>
<Text className='health-value'>{item.value}</Text>
<Text className='health-unit'>{item.unit}</Text>
</View>
))}
</View>
)}
</View>
<View className='quick-services'>