fix(miniprogram): 删除重复页面 report/followup,修复 EmptyState 导入 bug
@@ -10,9 +10,7 @@ export default defineAppConfig({
|
||||
'pages/appointment/detail/index',
|
||||
'pages/article/index',
|
||||
'pages/article/detail/index',
|
||||
'pages/report/index',
|
||||
'pages/report/detail/index',
|
||||
'pages/followup/index',
|
||||
'pages/followup/detail/index',
|
||||
'pages/profile/index',
|
||||
'pages/profile/family/index',
|
||||
@@ -28,11 +26,11 @@ export default defineAppConfig({
|
||||
backgroundColor: '#FFFFFF',
|
||||
borderStyle: 'white',
|
||||
list: [
|
||||
{ pagePath: 'pages/index/index', text: '首页' },
|
||||
{ pagePath: 'pages/health/index', text: '健康' },
|
||||
{ pagePath: 'pages/appointment/index', text: '预约' },
|
||||
{ pagePath: 'pages/article/index', text: '资讯' },
|
||||
{ pagePath: 'pages/profile/index', text: '我的' },
|
||||
{ pagePath: 'pages/index/index', text: '首页', iconPath: 'assets/tabbar/home.png', selectedIconPath: 'assets/tabbar/home-active.png' },
|
||||
{ pagePath: 'pages/health/index', text: '健康', iconPath: 'assets/tabbar/health.png', selectedIconPath: 'assets/tabbar/health-active.png' },
|
||||
{ pagePath: 'pages/appointment/index', text: '预约', iconPath: 'assets/tabbar/appointment.png', selectedIconPath: 'assets/tabbar/appointment-active.png' },
|
||||
{ pagePath: 'pages/article/index', text: '资讯', iconPath: 'assets/tabbar/article.png', selectedIconPath: 'assets/tabbar/article-active.png' },
|
||||
{ pagePath: 'pages/profile/index', text: '我的', iconPath: 'assets/tabbar/profile.png', selectedIconPath: 'assets/tabbar/profile-active.png' },
|
||||
],
|
||||
},
|
||||
window: {
|
||||
|
||||
BIN
apps/miniprogram/src/assets/tabbar/appointment-active.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
apps/miniprogram/src/assets/tabbar/appointment.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
apps/miniprogram/src/assets/tabbar/article-active.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
apps/miniprogram/src/assets/tabbar/article.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
apps/miniprogram/src/assets/tabbar/health-active.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
apps/miniprogram/src/assets/tabbar/health.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
apps/miniprogram/src/assets/tabbar/home-active.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
apps/miniprogram/src/assets/tabbar/home.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
apps/miniprogram/src/assets/tabbar/profile-active.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
apps/miniprogram/src/assets/tabbar/profile.png
Normal file
|
After Width: | Height: | Size: 233 B |
@@ -1,132 +0,0 @@
|
||||
@import '../../styles/variables.scss';
|
||||
|
||||
.followup-page {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
.tab-bar {
|
||||
display: flex;
|
||||
background: $card;
|
||||
padding: 0;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 24px 0;
|
||||
position: relative;
|
||||
|
||||
&.active {
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 48px;
|
||||
height: 4px;
|
||||
background: $pri;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28px;
|
||||
color: $tx2;
|
||||
|
||||
.tab-item.active & {
|
||||
color: $pri;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.task-list {
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.task-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 28px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.task-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.task-name {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
}
|
||||
|
||||
.task-status {
|
||||
font-size: 24px;
|
||||
padding: 4px 16px;
|
||||
border-radius: 20px;
|
||||
|
||||
&.pending {
|
||||
color: $wrn;
|
||||
background: $wrn-l;
|
||||
}
|
||||
|
||||
&.completed {
|
||||
color: $acc;
|
||||
background: $acc-l;
|
||||
}
|
||||
|
||||
&.overdue {
|
||||
color: $dan;
|
||||
background: $dan-l;
|
||||
}
|
||||
}
|
||||
|
||||
.task-desc {
|
||||
font-size: 26px;
|
||||
color: $tx2;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.task-due {
|
||||
font-size: 24px;
|
||||
color: $tx3;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 120px 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28px;
|
||||
color: $tx3;
|
||||
}
|
||||
|
||||
.loading-hint {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 24px;
|
||||
color: $tx3;
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useDidShow } from '@tarojs/taro';
|
||||
import { listTasks, FollowUpTask } from '../../services/followup';
|
||||
import EmptyState from '../../components/EmptyState';
|
||||
import Loading from '../../components/Loading';
|
||||
import './index.scss';
|
||||
|
||||
const TABS = [
|
||||
{ key: 'pending', label: '待完成' },
|
||||
{ key: 'completed', label: '已完成' },
|
||||
{ key: 'overdue', label: '已过期' },
|
||||
];
|
||||
|
||||
export default function FollowUpList() {
|
||||
const [activeTab, setActiveTab] = useState('pending');
|
||||
const [tasks, setTasks] = useState<FollowUpTask[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const fetchTasks = useCallback(async (status: string) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await listTasks(status);
|
||||
setTasks(res.data || []);
|
||||
} catch {
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useDidShow(() => {
|
||||
fetchTasks(activeTab);
|
||||
}, [activeTab, fetchTasks]);
|
||||
|
||||
const handleTabChange = (key: string) => {
|
||||
setActiveTab(key);
|
||||
setTasks([]);
|
||||
fetchTasks(key);
|
||||
};
|
||||
|
||||
const goToDetail = (id: string) => {
|
||||
Taro.navigateTo({ url: `/pages/followup/detail/index?id=${id}` });
|
||||
};
|
||||
|
||||
const getStatusClass = (status: string) => {
|
||||
if (status === 'completed') return 'completed';
|
||||
if (status === 'overdue') return 'overdue';
|
||||
return 'pending';
|
||||
};
|
||||
|
||||
const getStatusLabel = (status: string) => {
|
||||
if (status === 'completed') return '已完成';
|
||||
if (status === 'overdue') return '已过期';
|
||||
return '待完成';
|
||||
};
|
||||
|
||||
return (
|
||||
<View className='followup-page'>
|
||||
{/* Tab 栏 */}
|
||||
<View className='tab-bar'>
|
||||
{TABS.map((tab) => (
|
||||
<View
|
||||
className={`tab-item ${activeTab === tab.key ? 'active' : ''}`}
|
||||
key={tab.key}
|
||||
onClick={() => handleTabChange(tab.key)}
|
||||
>
|
||||
<Text className='tab-text'>{tab.label}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
|
||||
{/* 任务列表 */}
|
||||
<View className='task-list'>
|
||||
{tasks.map((t) => (
|
||||
<View
|
||||
className='task-card'
|
||||
key={t.id}
|
||||
onClick={() => goToDetail(t.id)}
|
||||
>
|
||||
<View className='task-top'>
|
||||
<Text className='task-name'>{t.task_type}</Text>
|
||||
<Text className={`task-status ${getStatusClass(t.status)}`}>
|
||||
{getStatusLabel(t.status)}
|
||||
</Text>
|
||||
</View>
|
||||
<Text className='task-desc'>{t.description}</Text>
|
||||
<Text className='task-due'>截止日期:{t.due_date}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
|
||||
{tasks.length === 0 && !loading && (
|
||||
<EmptyState text={`暂无${(() => {
|
||||
const tab = TABS.find((t) => t.key === activeTab);
|
||||
return tab ? tab.label : '';
|
||||
})()}任务`} />
|
||||
)}
|
||||
|
||||
{loading && (
|
||||
<Loading />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -6,48 +6,50 @@ import EmptyState from '../../components/EmptyState';
|
||||
import './index.scss';
|
||||
|
||||
export default function Index() {
|
||||
const { user, restore } = useAuthStore();
|
||||
const { user, currentPatient, restore: restoreAuth } = useAuthStore();
|
||||
const { todaySummary, refreshToday } = useHealthStore();
|
||||
|
||||
useDidShow(() => {
|
||||
restore();
|
||||
restoreAuth();
|
||||
refreshToday();
|
||||
});
|
||||
|
||||
const s = todaySummary || {};
|
||||
const hour = new Date().getHours();
|
||||
const greeting = hour < 12 ? '早上好' : hour < 18 ? '下午好' : '晚上好';
|
||||
const displayName = user?.display_name || currentPatient?.name || '访客';
|
||||
|
||||
const greeting = () => {
|
||||
const h = new Date().getHours();
|
||||
if (h < 6) return '凌晨好';
|
||||
if (h < 12) return '上午好';
|
||||
if (h < 14) return '中午好';
|
||||
if (h < 18) return '下午好';
|
||||
return '晚上好';
|
||||
const quickServices = [
|
||||
{ label: '预约挂号', icon: '📅', path: '/pages/appointment/create/index' },
|
||||
{ label: '健康录入', icon: '📊', path: '/pages/health/input/index' },
|
||||
{ label: '健康趋势', icon: '📈', path: '/pages/health/trend/index' },
|
||||
{ label: '资讯文章', icon: '📰', path: '/pages/article/index' },
|
||||
];
|
||||
|
||||
const handleServiceClick = (path: string) => {
|
||||
Taro.navigateTo({ url: path });
|
||||
};
|
||||
|
||||
const healthItems = [
|
||||
{ label: '血压', value: todaySummary?.blood_pressure ? `${todaySummary.blood_pressure.systolic}/${todaySummary.blood_pressure.diastolic}` : '--/--', unit: 'mmHg' },
|
||||
{ label: '心率', value: todaySummary?.heart_rate ? `${todaySummary.heart_rate.value}` : '--', unit: 'bpm' },
|
||||
{ label: '血糖', value: todaySummary?.blood_sugar ? `${todaySummary.blood_sugar.value}` : '--', unit: 'mmol/L' },
|
||||
{ label: '体重', value: todaySummary?.weight ? `${todaySummary.weight.value}` : '--', unit: 'kg' },
|
||||
];
|
||||
|
||||
return (
|
||||
<View className='index-page'>
|
||||
{/* 问候栏 */}
|
||||
<View className='greeting-bar'>
|
||||
<View className='greeting-text'>
|
||||
<Text className='greeting-hello'>{greeting()}</Text>
|
||||
<Text className='greeting-name'>{user?.display_name || '用户'}</Text>
|
||||
<Text className='greeting-hello'>{greeting},</Text>
|
||||
<Text className='greeting-name'>{displayName}</Text>
|
||||
</View>
|
||||
<Text className='greeting-date'>
|
||||
{new Date().toLocaleDateString('zh-CN', { month: 'long', day: 'numeric', weekday: 'short' })}
|
||||
</Text>
|
||||
<Text className='greeting-date'>{new Date().toLocaleDateString('zh-CN')}</Text>
|
||||
</View>
|
||||
|
||||
{/* 今日健康卡片 */}
|
||||
<View className='health-card'>
|
||||
<Text className='section-title'>今日健康</Text>
|
||||
<View className='health-grid'>
|
||||
{[
|
||||
{ label: '血压', value: s.blood_pressure ? `${s.blood_pressure.systolic}/${s.blood_pressure.diastolic}` : '--/--', unit: 'mmHg' },
|
||||
{ label: '心率', value: s.heart_rate ? `${s.heart_rate.value}` : '--', unit: 'bpm' },
|
||||
{ label: '血糖', value: s.blood_sugar ? `${s.blood_sugar.value}` : '--', unit: 'mmol/L' },
|
||||
{ label: '体重', value: s.weight ? `${s.weight.value}` : '--', unit: 'kg' },
|
||||
].map((item) => (
|
||||
{healthItems.map((item) => (
|
||||
<View className='health-item' key={item.label}>
|
||||
<Text className='health-label'>{item.label}</Text>
|
||||
<Text className='health-value'>{item.value}</Text>
|
||||
@@ -57,38 +59,21 @@ export default function Index() {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* 快捷服务 */}
|
||||
<View className='quick-services'>
|
||||
<Text className='section-title'>快捷服务</Text>
|
||||
<View className='service-grid'>
|
||||
{[
|
||||
{ label: '录数据', icon: '📝', path: '/pages/health/index', isTab: true },
|
||||
{ label: '预约', icon: '📅', path: '/pages/appointment/index', isTab: true },
|
||||
{ label: '报告', icon: '📋', path: '/pages/report/index', isTab: false },
|
||||
{ label: '随访', icon: '💬', path: '/pages/followup/index', isTab: false },
|
||||
].map((item) => (
|
||||
<View
|
||||
className='service-item'
|
||||
key={item.label}
|
||||
onClick={() => {
|
||||
if (item.isTab) {
|
||||
Taro.switchTab({ url: item.path });
|
||||
} else {
|
||||
Taro.navigateTo({ url: item.path });
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Text className='service-icon'>{item.icon}</Text>
|
||||
<Text className='service-label'>{item.label}</Text>
|
||||
{quickServices.map((svc) => (
|
||||
<View className='service-item' key={svc.label} onClick={() => handleServiceClick(svc.path)}>
|
||||
<Text className='service-icon'>{svc.icon}</Text>
|
||||
<Text className='service-label'>{svc.label}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* 即将到来 */}
|
||||
<View className='upcoming'>
|
||||
<Text className='section-title'>即将到来</Text>
|
||||
<EmptyState text='暂无即将到来的预约' />
|
||||
<Text className='section-title'>待办事项</Text>
|
||||
<EmptyState icon='📋' text='暂无待办事项' hint='预约挂号后将在此显示' />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import Taro, { useDidShow } from '@tarojs/taro';
|
||||
import { useAuthStore } from '../../stores/auth';
|
||||
import './index.scss';
|
||||
|
||||
@@ -13,7 +12,11 @@ const MENU_ITEMS = [
|
||||
];
|
||||
|
||||
export default function Profile() {
|
||||
const { user, logout } = useAuthStore();
|
||||
const { user, restore: restoreAuth, logout } = useAuthStore();
|
||||
|
||||
useDidShow(() => {
|
||||
restoreAuth();
|
||||
});
|
||||
|
||||
const handleMenuClick = (path: string) => {
|
||||
Taro.navigateTo({ url: path });
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
@import '../../styles/variables.scss';
|
||||
|
||||
.report-page {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
padding: 24px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.report-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.report-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 28px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.report-card-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.report-type {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
}
|
||||
|
||||
.report-status {
|
||||
font-size: 24px;
|
||||
padding: 4px 16px;
|
||||
border-radius: 20px;
|
||||
|
||||
&.normal {
|
||||
color: $acc;
|
||||
background: $acc-l;
|
||||
}
|
||||
|
||||
&.abnormal {
|
||||
color: $dan;
|
||||
background: $dan-l;
|
||||
}
|
||||
}
|
||||
|
||||
.report-date {
|
||||
font-size: 26px;
|
||||
color: $tx2;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.report-note {
|
||||
font-size: 24px;
|
||||
color: $tx3;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 120px 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28px;
|
||||
color: $tx3;
|
||||
}
|
||||
|
||||
.loading-hint {
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
font-size: 24px;
|
||||
color: $tx3;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
import React, { useState, useCallback } from 'react';
|
||||
import { View, Text } from '@tarojs/components';
|
||||
import Taro, { useDidShow, usePullDownRefresh, useReachBottom } from '@tarojs/taro';
|
||||
import { listReports, LabReport } from '../../services/report';
|
||||
import EmptyState from '../../components/EmptyState';
|
||||
import Loading from '../../components/Loading';
|
||||
import './index.scss';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
export default function ReportList() {
|
||||
const [reports, setReports] = useState<LabReport[]>([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const fetchData = useCallback(async (p: number, append = false) => {
|
||||
const patientId = Taro.getStorageSync('current_patient_id') || '';
|
||||
if (!patientId) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await listReports(patientId, p);
|
||||
const list = res.data || [];
|
||||
setReports(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useDidShow(() => {
|
||||
fetchData(1);
|
||||
});
|
||||
|
||||
usePullDownRefresh(() => {
|
||||
fetchData(1).finally(() => {
|
||||
Taro.stopPullDownRefresh();
|
||||
});
|
||||
});
|
||||
|
||||
useReachBottom(() => {
|
||||
if (!loading && reports.length < total) {
|
||||
fetchData(page + 1, true);
|
||||
}
|
||||
});
|
||||
|
||||
const goToDetail = (id: string) => {
|
||||
Taro.navigateTo({ url: `/pages/report/detail/index?id=${id}` });
|
||||
};
|
||||
|
||||
const formatStatus = (report: LabReport) => {
|
||||
const indicators = report.indicators;
|
||||
if (!indicators || typeof indicators !== 'object') return '未知';
|
||||
const vals = Object.values(indicators) as Array<{ status?: string }>;
|
||||
const hasAbnormal = vals.some((v) => v.status === 'high' || v.status === 'low');
|
||||
return hasAbnormal ? '异常' : '正常';
|
||||
};
|
||||
|
||||
return (
|
||||
<View className='report-page'>
|
||||
<View className='report-list'>
|
||||
{reports.map((r) => (
|
||||
<View
|
||||
className='report-card'
|
||||
key={r.id}
|
||||
onClick={() => goToDetail(r.id)}
|
||||
>
|
||||
<View className='report-card-top'>
|
||||
<Text className='report-type'>{r.report_type}</Text>
|
||||
<Text className={`report-status ${formatStatus(r) === '正常' ? 'normal' : 'abnormal'}`}>
|
||||
{formatStatus(r)}
|
||||
</Text>
|
||||
</View>
|
||||
<Text className='report-date'>{r.report_date}</Text>
|
||||
{r.doctor_interpretation && (
|
||||
<Text className='report-note'>{r.doctor_interpretation}</Text>
|
||||
)}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
|
||||
{reports.length === 0 && !loading && (
|
||||
<EmptyState text='暂无报告记录' />
|
||||
)}
|
||||
|
||||
{loading && (
|
||||
<Loading />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||