fix(miniprogram): 首页/健康页/详情页统一使用 Loading 组件
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { View, Text } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import Taro, { useDidShow } from '@tarojs/taro';
|
import Taro, { useDidShow } from '@tarojs/taro';
|
||||||
import { useHealthStore } from '../../stores/health';
|
import { useHealthStore } from '../../stores/health';
|
||||||
|
import Loading from '../../components/Loading';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
export default function Health() {
|
export default function Health() {
|
||||||
@@ -35,6 +36,9 @@ export default function Health() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{loading && !todaySummary ? (
|
||||||
|
<Loading />
|
||||||
|
) : (
|
||||||
<View className='health-grid'>
|
<View className='health-grid'>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<View className='health-card' key={item.label} onClick={() => goToTrend(item.indicator)}>
|
<View className='health-card' key={item.label} onClick={() => goToTrend(item.indicator)}>
|
||||||
@@ -47,6 +51,7 @@ export default function Health() {
|
|||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
<View className='health-actions'>
|
<View className='health-actions'>
|
||||||
<View className='action-card' onClick={() => goToTrend('blood_pressure_systolic')}>
|
<View className='action-card' onClick={() => goToTrend('blood_pressure_systolic')}>
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ import Taro, { useDidShow } from '@tarojs/taro';
|
|||||||
import { useAuthStore } from '../../stores/auth';
|
import { useAuthStore } from '../../stores/auth';
|
||||||
import { useHealthStore } from '../../stores/health';
|
import { useHealthStore } from '../../stores/health';
|
||||||
import EmptyState from '../../components/EmptyState';
|
import EmptyState from '../../components/EmptyState';
|
||||||
|
import Loading from '../../components/Loading';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
const { user, currentPatient, restore: restoreAuth } = useAuthStore();
|
const { user, currentPatient, restore: restoreAuth } = useAuthStore();
|
||||||
const { todaySummary, refreshToday } = useHealthStore();
|
const { todaySummary, loading, refreshToday } = useHealthStore();
|
||||||
|
|
||||||
useDidShow(() => {
|
useDidShow(() => {
|
||||||
restoreAuth();
|
restoreAuth();
|
||||||
@@ -48,15 +49,19 @@ export default function Index() {
|
|||||||
|
|
||||||
<View className='health-card'>
|
<View className='health-card'>
|
||||||
<Text className='section-title'>今日健康</Text>
|
<Text className='section-title'>今日健康</Text>
|
||||||
<View className='health-grid'>
|
{loading && !todaySummary ? (
|
||||||
{healthItems.map((item) => (
|
<Loading />
|
||||||
<View className='health-item' key={item.label}>
|
) : (
|
||||||
<Text className='health-label'>{item.label}</Text>
|
<View className='health-grid'>
|
||||||
<Text className='health-value'>{item.value}</Text>
|
{healthItems.map((item) => (
|
||||||
<Text className='health-unit'>{item.unit}</Text>
|
<View className='health-item' key={item.label}>
|
||||||
</View>
|
<Text className='health-label'>{item.label}</Text>
|
||||||
))}
|
<Text className='health-value'>{item.value}</Text>
|
||||||
</View>
|
<Text className='health-unit'>{item.unit}</Text>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className='quick-services'>
|
<View className='quick-services'>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import { View, Text } from '@tarojs/components';
|
import { View, Text } from '@tarojs/components';
|
||||||
import Taro, { useRouter } from '@tarojs/taro';
|
import Taro, { useRouter } from '@tarojs/taro';
|
||||||
import { getReportDetail, LabReport } from '../../../services/report';
|
import { getReportDetail, LabReport } from '../../../services/report';
|
||||||
|
import Loading from '../../../components/Loading';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
|
||||||
interface IndicatorItem {
|
interface IndicatorItem {
|
||||||
@@ -51,9 +52,7 @@ export default function ReportDetail() {
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<View className='detail-page'>
|
<View className='detail-page'>
|
||||||
<View className='loading-state'>
|
<Loading />
|
||||||
<Text className='loading-text'>加载中...</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user