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

@@ -4,6 +4,7 @@ import Taro, { useReachBottom } from '@tarojs/taro';
import { listConsultations, ConsultationSession } from '../../services/consultation';
import { notificationService } from '../../services/notification';
import Loading from '../../components/Loading';
import ErrorState from '../../components/ErrorState';
import GuestGuard from '../../components/GuestGuard';
import { useAuthStore } from '../../stores/auth';
import { useElderClass } from '../../hooks/useElderClass';
@@ -36,11 +37,13 @@ export default function Messages() {
const [sessions, setSessions] = useState<ConsultationSession[]>([]);
const [notifications, setNotifications] = useState<NotificationItem[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(false);
const [page, setPage] = useState(1);
const [total, setTotal] = useState(0);
const loadData = useCallback(async (tab: MsgTab, pageNum: number = 1, isRefresh = false) => {
setLoading(true);
setError(false);
try {
if (tab === 'consultation') {
const res = await listConsultations({ page: pageNum, page_size: 20 });
@@ -63,11 +66,12 @@ export default function Messages() {
}
setPage(pageNum);
} catch {
setError(true);
if (isRefresh) {
if (tab === 'consultation') setSessions([]);
else setNotifications([]);
Taro.showToast({ title: '加载失败,下拉重试', icon: 'none' });
}
Taro.showToast({ title: '加载失败,下拉重试', icon: 'none' });
} finally {
setLoading(false);
}
@@ -139,6 +143,10 @@ export default function Messages() {
</View>
<View className='msg-content'>
{error ? (
<ErrorState onRetry={() => loadData(activeTab, 1, true)} />
) : (
<>
{/* 咨询列表 */}
{activeTab === 'consultation' && (
loading ? (
@@ -220,6 +228,8 @@ export default function Messages() {
</View>
)
)}
</>
)}
</View>
</View>
);