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

@@ -1,6 +1,7 @@
import { View, Text } from '@tarojs/components';
import Taro, { useDidShow } from '@tarojs/taro';
import { useHealthStore } from '../../stores/health';
import Loading from '../../components/Loading';
import './index.scss';
export default function Health() {
@@ -35,6 +36,9 @@ export default function Health() {
</View>
</View>
{loading && !todaySummary ? (
<Loading />
) : (
<View className='health-grid'>
{items.map((item) => (
<View className='health-card' key={item.label} onClick={() => goToTrend(item.indicator)}>
@@ -47,6 +51,7 @@ export default function Health() {
</View>
))}
</View>
)}
<View className='health-actions'>
<View className='action-card' onClick={() => goToTrend('blood_pressure_systolic')}>

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'>

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { View, Text } from '@tarojs/components';
import Taro, { useRouter } from '@tarojs/taro';
import { getReportDetail, LabReport } from '../../../services/report';
import Loading from '../../../components/Loading';
import './index.scss';
interface IndicatorItem {
@@ -51,9 +52,7 @@ export default function ReportDetail() {
if (loading) {
return (
<View className='detail-page'>
<View className='loading-state'>
<Text className='loading-text'>...</Text>
</View>
<Loading />
</View>
);
}