fix(mp): 小程序页面优化 + E2E 测试报告更新

- 小程序各页面优化和修复
- 更新联调报告和 E2E 测试报告
- 更新 miniprogram wiki
This commit is contained in:
iven
2026-05-15 23:03:21 +08:00
parent ced1c0ad0c
commit c06e986090
24 changed files with 905 additions and 441 deletions

View File

@@ -5,7 +5,9 @@ import { useAuthStore } from '../../stores/auth';
import { useElderClass } from '../../hooks/useElderClass';
import { findThreshold, inputVitalSign, type HealthThreshold } from '../../services/health';
import Loading from '../../components/Loading';
import ErrorState from '../../components/ErrorState';
import GuestGuard from '../../components/GuestGuard';
import SegmentTabs from '../../components/SegmentTabs';
import { useHealthData, VITAL_TABS, type VitalType } from './useHealthData';
import './index.scss';
@@ -28,8 +30,8 @@ export default function Health() {
const currentPatient = useAuthStore((s) => s.currentPatient);
const modeClass = useElderClass();
const {
user, todaySummary, loading, activeTab, trendData, trendLoading,
aiSuggestions, thresholds, handleTabChange, loadTrend, refreshToday,
user, todaySummary, loading, error, activeTab, trendData, trendLoading,
aiSuggestions, thresholds, handleTabChange, loadTrend, refreshToday, fetchData,
} = useHealthData();
const [systolic, setSystolic] = useState('');
@@ -44,6 +46,17 @@ export default function Health() {
return <GuestGuard title='请先登录' desc='登录后即可记录和查看健康数据' />;
}
if (error) {
return (
<View className={`health-page ${modeClass}`}>
<View className='health-header'>
<Text className='health-title'></Text>
</View>
<ErrorState onRetry={fetchData} />
</View>
);
}
const getWarnStatus = (type: VitalType): string | null => {
if (type === 'blood_pressure') {
const sys = parseFloat(systolic);
@@ -184,24 +197,7 @@ export default function Health() {
</View>
)}
<View className='vital-tabs'>
{VITAL_TABS.map((tab) => {
const hasData = tab.key === 'blood_pressure' ? !!todaySummary?.blood_pressure
: tab.key === 'heart_rate' ? !!todaySummary?.heart_rate
: tab.key === 'blood_sugar' ? !!todaySummary?.blood_sugar
: !!todaySummary?.weight;
return (
<View
key={tab.key}
className={`vital-tab ${activeTab === tab.key ? 'vital-tab-active' : ''}`}
onClick={() => handleTabChange(tab.key)}
>
<Text className='vital-tab-text'>{tab.label}</Text>
{!hasData && <View className='vital-tab-dot' />}
</View>
);
})}
</View>
<SegmentTabs tabs={VITAL_TABS} activeKey={activeTab} onChange={handleTabChange} variant="pill" />
<View className='input-section'>
{activeTab === 'blood_pressure' && (