fix(mp): 空 catch 块添加 console.warn 日志(82 处)
55 个文件中 82 处空 catch 块添加模块前缀日志输出: - stores: auth/health/points (7 处) - services: request/ai-chat/health/ble/* (10 处) - hooks: useLongPolling/usePagination (3 处) - pages: 核心+子包共 35 个页面 (62 处) 保留静默的 catch: secure-storage fallback、Storage 恢复、 analytics 防洪、BLE 断连清理、用户拒绝订阅等合理忽略场景
This commit is contained in:
@@ -55,7 +55,8 @@ export function useLongPolling<T>({
|
||||
onDataRef.current(data);
|
||||
}
|
||||
failCount = 0;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[long-polling] 轮询失败:', err);
|
||||
failCount++;
|
||||
}
|
||||
if (gen !== generation.current || !mountedRef.current) return;
|
||||
|
||||
@@ -32,8 +32,8 @@ export function usePagination<T>(
|
||||
setTotal(res.total);
|
||||
setHasMore(items.length >= pageSize);
|
||||
pageRef.current += 1;
|
||||
} catch {
|
||||
// 错误由调用方处理
|
||||
} catch (err) {
|
||||
console.warn('[pagination] 加载分页数据失败:', err);
|
||||
} finally {
|
||||
loadingRef.current = false;
|
||||
setLoading(false);
|
||||
@@ -53,8 +53,8 @@ export function usePagination<T>(
|
||||
setTotal(res.total);
|
||||
setHasMore(items.length >= pageSize);
|
||||
pageRef.current = 2;
|
||||
} catch {
|
||||
// 错误由调用方处理
|
||||
} catch (err) {
|
||||
console.warn('[pagination] 加载分页数据失败:', err);
|
||||
} finally {
|
||||
loadingRef.current = false;
|
||||
setLoading(false);
|
||||
|
||||
@@ -44,7 +44,8 @@ export default function AiReportDetail() {
|
||||
try {
|
||||
const data = await getAiAnalysisDetail(id);
|
||||
setAnalysis(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ai-report] 加载分析详情失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -40,7 +40,8 @@ export default function AiReportList() {
|
||||
|
||||
setPage(p);
|
||||
setHasMore(items.length >= 20);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ai-report] 加载分析列表失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -64,7 +64,8 @@ export default function AppointmentCreate() {
|
||||
try {
|
||||
const res = await listDoctors(dept);
|
||||
setDoctors(res.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[appointment] 加载医生列表失败:', err);
|
||||
Taro.showToast({ title: '加载医生失败', icon: 'none' });
|
||||
}
|
||||
}, []);
|
||||
@@ -79,8 +80,8 @@ export default function AppointmentCreate() {
|
||||
const fmt = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
||||
const res = await calendarView(fmt(today), fmt(endDate), doctor.id);
|
||||
setSchedules(res || []);
|
||||
} catch {
|
||||
// 日历加载失败不阻塞
|
||||
} catch (err) {
|
||||
console.warn('[appointment] 加载日历排班失败:', err);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ export default function AppointmentDetail() {
|
||||
await cancelAppointment(appointment.id, appointment.version);
|
||||
Taro.showToast({ title: '已取消预约', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1500);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[appointment] 取消预约失败:', err);
|
||||
Taro.showToast({ title: '取消失败', icon: 'none' });
|
||||
} finally {
|
||||
setCancelling(false);
|
||||
|
||||
@@ -47,7 +47,8 @@ export default function AppointmentList() {
|
||||
}
|
||||
setTotal(res.total);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[appointment] 加载预约列表失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -34,7 +34,8 @@ export default function ArticleDetail() {
|
||||
const fetcher = user ? getArticleDetail(id) : getPublicArticleDetail(id);
|
||||
const data = await fetcher;
|
||||
setArticle(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[article] 加载文章详情失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -54,7 +54,8 @@ export default function ArticleList() {
|
||||
setArticles(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[article] 加载文章列表失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -67,7 +68,8 @@ export default function ArticleList() {
|
||||
try {
|
||||
const cats = await listCategories();
|
||||
setCategories(cats || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[article] 加载分类失败:', err);
|
||||
setCategories([]);
|
||||
}
|
||||
await fetchData(1);
|
||||
|
||||
@@ -36,7 +36,8 @@ export default function ConsultationCreate() {
|
||||
const items = (res.data || []).map((d: any) => ({ id: d.id, name: d.name }));
|
||||
setDoctorList(items);
|
||||
setDoctorsLoaded(true);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 加载医生列表失败:', err);
|
||||
Taro.showToast({ title: '加载医生列表失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
@@ -58,7 +59,8 @@ export default function ConsultationCreate() {
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({ url: `/pages/pkg-consultation/detail/index?id=${session.id}` });
|
||||
}, 500);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 创建会话失败:', err);
|
||||
Taro.showToast({ title: '创建失败,请重试', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -29,7 +29,8 @@ function getQueryParams(): Record<string, string> {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 解析查询参数失败:', err);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,8 @@ export default function Consultation() {
|
||||
}
|
||||
setTotal(resp.total || 0);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 加载会话列表失败:', err);
|
||||
if (isRefresh) {
|
||||
setSessions([]);
|
||||
setTotal(0);
|
||||
|
||||
@@ -148,7 +148,8 @@ export default function Health() {
|
||||
Taro.showToast({ title: '保存成功', icon: 'success' });
|
||||
refreshToday(true);
|
||||
loadTrend(activeTab);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 保存体征数据失败:', err);
|
||||
Taro.showToast({ title: '保存失败', icon: 'none' });
|
||||
} finally {
|
||||
setSaving(false);
|
||||
@@ -200,7 +201,7 @@ export default function Health() {
|
||||
await submitSuggestionFeedback(s.id, 'adopt');
|
||||
Taro.showToast({ title: '已采纳', icon: 'success' });
|
||||
fetchData();
|
||||
} catch { Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
} catch (err) { console.warn('[health] AI建议反馈失败:', err); Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
}}>
|
||||
<Text className='ai-feedback-btn-text'>采纳</Text>
|
||||
</View>
|
||||
@@ -209,7 +210,7 @@ export default function Health() {
|
||||
await submitSuggestionFeedback(s.id, 'ignore');
|
||||
Taro.showToast({ title: '已忽略', icon: 'success' });
|
||||
fetchData();
|
||||
} catch { Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
} catch (err) { console.warn('[health] AI建议反馈失败:', err); Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
}}>
|
||||
<Text className='ai-feedback-btn-text'>忽略</Text>
|
||||
</View>
|
||||
@@ -217,7 +218,7 @@ export default function Health() {
|
||||
try {
|
||||
await submitSuggestionFeedback(s.id, 'consult');
|
||||
safeNavigateTo('/pages/consultation/index');
|
||||
} catch { Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
} catch (err) { console.warn('[health] AI建议反馈失败:', err); Taro.showToast({ title: '操作失败', icon: 'none' }); }
|
||||
}}>
|
||||
<Text className='ai-feedback-btn-text'>咨询医生</Text>
|
||||
</View>
|
||||
|
||||
@@ -44,7 +44,8 @@ export function useHealthData() {
|
||||
};
|
||||
const points = await fetchTrend(indicatorMap[type], '7d');
|
||||
setTrendData(points);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 加载趋势数据失败:', err);
|
||||
setTrendData([]);
|
||||
} finally {
|
||||
setTrendLoading(false);
|
||||
@@ -55,7 +56,8 @@ export function useHealthData() {
|
||||
try {
|
||||
const items = await listPendingSuggestions();
|
||||
setAiSuggestions(items.slice(0, 3));
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 加载 AI 建议失败:', err);
|
||||
setAiSuggestions([]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -75,7 +75,8 @@ function GuestHome({ modeClass }: { modeClass: string }) {
|
||||
if (articleData.status === 'fulfilled' && articleData.value?.data?.length > 0) {
|
||||
setArticles(articleData.value.data);
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[home] 加载首页数据失败:', err);
|
||||
setBanners(FALLBACK_SLIDES);
|
||||
Taro.showToast({ title: '内容加载失败', icon: 'none' });
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export function useHomeData() {
|
||||
const res = await notificationService.getUnreadCount() as { data?: { count?: number } | number };
|
||||
const d = res.data;
|
||||
setUnreadCount(typeof d === 'object' && d ? (d.count ?? 0) : 0);
|
||||
} catch { /* ignore */ }
|
||||
} catch (err) { console.warn('[home] 获取未读消息数失败:', err); }
|
||||
};
|
||||
|
||||
const loadReminders = async (patientId: string) => {
|
||||
@@ -110,7 +110,8 @@ export function useHomeData() {
|
||||
}
|
||||
}
|
||||
setReminders(items.slice(0, 3));
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[home] 加载提醒列表失败:', err);
|
||||
setReminders([]);
|
||||
} finally {
|
||||
setRemindersLoading(false);
|
||||
|
||||
@@ -64,7 +64,8 @@ export default function Login() {
|
||||
} else {
|
||||
Taro.showToast({ title: '账号或密码错误', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[login] 登录失败:', err);
|
||||
Taro.showToast({ title: '登录失败,请重试', icon: 'none' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -62,7 +62,8 @@ export default function Mall() {
|
||||
}
|
||||
setTotal(res.total);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[mall] 加载商品列表失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -82,7 +82,8 @@ export default function Messages() {
|
||||
setMessages(updated);
|
||||
scrollToBottom(updated);
|
||||
saveLocalHistory(updated);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ai-chat] 发送消息失败:', err);
|
||||
const errMsg: AiChatMessage = {
|
||||
id: genId(),
|
||||
role: 'assistant',
|
||||
|
||||
@@ -71,7 +71,8 @@ export default function ConsultationDetail() {
|
||||
messagesRef.current = msgs;
|
||||
scrollViewRef.current = `msg-${msgs.length}`;
|
||||
setDataLoaded(true);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -97,7 +98,8 @@ export default function ConsultationDetail() {
|
||||
scrollViewRef.current = `msg-${next.length}`;
|
||||
return next;
|
||||
});
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consultation] 发送失败:', err);
|
||||
Taro.showToast({ title: '发送失败', icon: 'none' });
|
||||
setInputText(text);
|
||||
} finally {
|
||||
|
||||
@@ -39,7 +39,8 @@ export default function AlertDetail() {
|
||||
try {
|
||||
const data = await getAlert(alertId);
|
||||
setAlert(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -55,7 +56,8 @@ export default function AlertDetail() {
|
||||
const updated = await acknowledgeAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已确认', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
@@ -69,7 +71,8 @@ export default function AlertDetail() {
|
||||
const updated = await dismissAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已忽略', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
@@ -83,7 +86,8 @@ export default function AlertDetail() {
|
||||
const updated = await resolveAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已恢复', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
|
||||
@@ -71,7 +71,8 @@ export default function AlertList() {
|
||||
});
|
||||
setAlerts(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -113,7 +113,8 @@ export default function DialysisCreate() {
|
||||
ultrafiltration_volume: r.ultrafiltration_volume != null ? String(r.ultrafiltration_volume) : '',
|
||||
complication_notes: r.complication_notes || '',
|
||||
});
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -167,7 +168,8 @@ export default function DialysisCreate() {
|
||||
Taro.showToast({ title: '创建成功', icon: 'success' });
|
||||
}
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 操作失败:', err);
|
||||
Taro.showToast({ title: isEdit ? '更新失败' : '创建失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -30,7 +30,8 @@ export default function DialysisDetail() {
|
||||
try {
|
||||
const r = await getDialysisRecord(id);
|
||||
setRecord(r);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -46,7 +47,8 @@ export default function DialysisDetail() {
|
||||
const updated = await reviewDialysisRecord(id, record.version);
|
||||
setRecord(updated);
|
||||
Taro.showToast({ title: '审核完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 审核失败:', err);
|
||||
Taro.showToast({ title: '审核失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -60,7 +62,8 @@ export default function DialysisDetail() {
|
||||
const updated = await updateDialysisRecord(id, { status: 'completed' }, record.version);
|
||||
setRecord(updated);
|
||||
Taro.showToast({ title: '已标记完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -79,7 +82,8 @@ export default function DialysisDetail() {
|
||||
await deleteDialysisRecord(id, record.version);
|
||||
Taro.showToast({ title: '已删除', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 删除失败:', err);
|
||||
Taro.showToast({ title: '删除失败', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ export default function DialysisList() {
|
||||
setRecords(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -89,7 +90,8 @@ export default function DialysisList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -97,7 +97,8 @@ export default function PrescriptionCreate() {
|
||||
await createDialysisPrescription(payload);
|
||||
Taro.showToast({ title: '创建成功', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 创建处方失败:', err);
|
||||
Taro.showToast({ title: '创建失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -28,7 +28,8 @@ export default function PrescriptionDetail() {
|
||||
try {
|
||||
const data = await getDialysisPrescription(id);
|
||||
setRx(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -49,7 +50,8 @@ export default function PrescriptionDetail() {
|
||||
const updated = await updateDialysisPrescription(id, { status: 'inactive' }, rx.version);
|
||||
setRx(updated);
|
||||
Taro.showToast({ title: '已停用', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -68,7 +70,8 @@ export default function PrescriptionDetail() {
|
||||
await deleteDialysisPrescription(id, rx.version);
|
||||
Taro.showToast({ title: '已删除', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 删除失败:', err);
|
||||
Taro.showToast({ title: '删除失败', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ export default function PrescriptionList() {
|
||||
setPrescriptions(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -85,7 +86,8 @@ export default function PrescriptionList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -26,7 +26,8 @@ export default function ReportDetail() {
|
||||
const r = await getLabReport(patientId, reportId);
|
||||
setReport(r);
|
||||
setDoctorNotes(r.doctor_notes || '');
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -45,7 +46,8 @@ export default function ReportDetail() {
|
||||
});
|
||||
setReport(updated);
|
||||
Taro.showToast({ title: '审核完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 审核失败:', err);
|
||||
Taro.showToast({ title: '审核失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -35,7 +35,8 @@ export default function ReportList() {
|
||||
const res = await listLabReports(currentPatientId, { page: 1, page_size: 50 });
|
||||
setReports(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -64,7 +65,8 @@ export default function ReportList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -75,7 +75,8 @@ export default function ActionInboxPage() {
|
||||
} else {
|
||||
setItems((prev) => [...prev, ...list]);
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[action-inbox] 加载待办列表失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -103,7 +104,8 @@ export default function ActionInboxPage() {
|
||||
const data = await getActionThread(item.source_ref);
|
||||
setThreadData(data);
|
||||
setShowDetail(true);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[action-inbox] 加载待办详情失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
@@ -119,7 +121,8 @@ export default function ActionInboxPage() {
|
||||
Taro.showToast({ title: '操作成功', icon: 'success' });
|
||||
setShowDetail(false);
|
||||
fetchItems(1, FILTER_MAP[activeFilter], true);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[action-inbox] 执行操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,7 +67,8 @@ export default function ConsultationDetail() {
|
||||
messagesRef.current = msgs;
|
||||
scrollViewRef.current = `msg-${msgs.length}`;
|
||||
dataLoadedRef.current = true;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-consult] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -93,7 +94,8 @@ export default function ConsultationDetail() {
|
||||
scrollViewRef.current = `msg-${next.length}`;
|
||||
return next;
|
||||
});
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-consult] 发送失败:', err);
|
||||
Taro.showToast({ title: '发送失败', icon: 'none' });
|
||||
setInputText(text);
|
||||
} finally {
|
||||
@@ -111,7 +113,8 @@ export default function ConsultationDetail() {
|
||||
await closeSession(sessionId, session?.version ?? 0);
|
||||
Taro.showToast({ title: '已关闭', icon: 'success' });
|
||||
loadData();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-consult] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ export default function ConsultationList() {
|
||||
status: activeTab || undefined,
|
||||
});
|
||||
setSessions(res.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-consult] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -46,7 +46,8 @@ export default function FollowUpDetail() {
|
||||
]);
|
||||
setTask(t);
|
||||
setRecords(r.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-followup] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -74,7 +75,8 @@ export default function FollowUpDetail() {
|
||||
setMedicalAdvice('');
|
||||
setNextDate('');
|
||||
loadData();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-followup] 提交失败:', err);
|
||||
Taro.showToast({ title: '提交失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -87,7 +89,8 @@ export default function FollowUpDetail() {
|
||||
await updateFollowUpTask(taskId, { status: 'in_progress' }, task.version);
|
||||
Taro.showToast({ title: '已开始', icon: 'success' });
|
||||
loadData();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-followup] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,7 +48,8 @@ export default function FollowUpList() {
|
||||
});
|
||||
setTasks(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-followup] 加载随访列表失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -57,8 +57,8 @@ export default function DoctorHome() {
|
||||
try {
|
||||
const data = await getDashboard();
|
||||
setDashboard(data);
|
||||
} catch {
|
||||
// 静默失败
|
||||
} catch (err) {
|
||||
console.warn('[doctor] 加载工作台数据失败:', err);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ export default function PatientDetail() {
|
||||
]);
|
||||
setPatient(p);
|
||||
setSummary(s);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-patient] 加载患者详情失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -38,7 +38,8 @@ export default function PatientList() {
|
||||
setPatients(prev => isRefresh ? list : [...prev, ...list]);
|
||||
setTotal(res.total || 0);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-patients] 加载患者列表失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -57,7 +57,8 @@ export default function PatientAlerts() {
|
||||
}
|
||||
setTotal(res.total);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[alert] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -45,7 +45,8 @@ export default function Trend() {
|
||||
try {
|
||||
const data = await getTrend(indicator, range);
|
||||
setPoints(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[trend] 加载数据失败:', err);
|
||||
setError(true);
|
||||
setPoints([]);
|
||||
} finally {
|
||||
|
||||
@@ -46,7 +46,8 @@ export default function PointsDetail() {
|
||||
}
|
||||
setTotal(res.total);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[mall] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -53,7 +53,8 @@ export default function ExchangeConfirm() {
|
||||
let found: PointsProduct | null = null;
|
||||
try {
|
||||
found = await getProduct(productId);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[exchange] 单商品接口失败,降级列表查找:', err);
|
||||
const productRes = await listProducts({ page: 1, page_size: 100 });
|
||||
found = productRes.data.find((p) => p.id === productId) || null;
|
||||
}
|
||||
@@ -64,7 +65,8 @@ export default function ExchangeConfirm() {
|
||||
}
|
||||
setProduct(found);
|
||||
await refreshPoints();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[exchange] 加载兑换页面失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1500);
|
||||
} finally {
|
||||
|
||||
@@ -57,7 +57,8 @@ export default function MallOrders() {
|
||||
}
|
||||
setTotal(res.total);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[orders] 加载订单列表失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -33,14 +33,15 @@ export default function ProductDetail() {
|
||||
try {
|
||||
const data = await getProduct(productId);
|
||||
setProduct(data);
|
||||
} catch {
|
||||
// 降级:从列表接口查找
|
||||
} catch (err) {
|
||||
console.warn('[product] 单商品接口失败,降级列表查找:', err);
|
||||
try {
|
||||
const { listProducts } = await import('../../../services/points');
|
||||
const res = await listProducts({ page: 1, page_size: 100 });
|
||||
const found = res.data.find((p) => p.id === productId);
|
||||
if (found) setProduct(found);
|
||||
} catch {
|
||||
} catch (fallbackErr) {
|
||||
console.warn('[product] 降级列表查找也失败:', fallbackErr);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -49,7 +49,8 @@ export default function ConsentList() {
|
||||
setConsents(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consent] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -75,7 +76,8 @@ export default function ConsentList() {
|
||||
const updated = await revokeConsent(consent.id, consent.version);
|
||||
setConsents((prev) => prev.map((c) => c.id === updated.id ? updated : c));
|
||||
Taro.showToast({ title: '已撤回', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[consent] 撤回失败:', err);
|
||||
Taro.showToast({ title: '撤回失败', icon: 'none' });
|
||||
} finally {
|
||||
setRevoking(null);
|
||||
|
||||
@@ -45,7 +45,8 @@ export default function Diagnoses() {
|
||||
setRecords(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[diagnosis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -29,7 +29,8 @@ export default function DialysisPrescriptionDetail() {
|
||||
try {
|
||||
const data = await getDialysisPrescription(id);
|
||||
setRx(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[prescription] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -41,7 +41,8 @@ export default function DialysisPrescriptionList() {
|
||||
setPrescriptions(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[prescription] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -35,7 +35,8 @@ export default function DialysisRecordDetail() {
|
||||
try {
|
||||
const data = await getDialysisRecord(id);
|
||||
setRecord(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -47,7 +47,8 @@ export default function DialysisRecordList() {
|
||||
setRecords(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -27,7 +27,8 @@ export default function EventsPage() {
|
||||
try {
|
||||
const res = await pointsApi.listOfflineEvents({ page: 1, page_size: 50, status: 'published' });
|
||||
setEvents(res.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[event] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -58,7 +58,8 @@ export default function FamilyAdd() {
|
||||
Taro.showToast({ title: '添加成功', icon: 'success' });
|
||||
}
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[family] 操作失败:', err);
|
||||
Taro.hideLoading();
|
||||
Taro.showToast({ title: editId ? '修改失败' : '添加失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -34,7 +34,8 @@ export default function FamilyList() {
|
||||
try {
|
||||
const res = await listPatients();
|
||||
setPatients(res.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[family] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -58,7 +58,8 @@ export default function FollowUpDetail() {
|
||||
try { await (Taro.requestSubscribeMessage as any)({ tmplIds: [tmplId] }); } catch { /* 用户拒绝 */ }
|
||||
}
|
||||
setContent('');
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[followup] 提交失败:', err);
|
||||
Taro.showToast({ title: '提交失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -30,7 +30,8 @@ export default function MyFollowUps() {
|
||||
try {
|
||||
const res = await listTasks(status);
|
||||
setTasks(res.data || []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[followup] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -39,7 +39,8 @@ export default function HealthRecords() {
|
||||
setRecords(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health-records] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -28,7 +28,8 @@ export default function MedicationReminder() {
|
||||
try {
|
||||
const res = await listReminders();
|
||||
setReminders(res.data ?? []);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[medication] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -44,7 +45,8 @@ export default function MedicationReminder() {
|
||||
version: r.version,
|
||||
});
|
||||
fetchReminders();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[medication] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
@@ -59,7 +61,8 @@ export default function MedicationReminder() {
|
||||
await deleteReminder(r.id, r.version);
|
||||
Taro.showToast({ title: '已删除', icon: 'success' });
|
||||
fetchReminders();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[medication] 删除失败:', err);
|
||||
Taro.showToast({ title: '删除失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
@@ -90,7 +93,8 @@ export default function MedicationReminder() {
|
||||
setShowForm(false);
|
||||
Taro.showToast({ title: '添加成功', icon: 'success' });
|
||||
fetchReminders();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[medication] 添加失败:', err);
|
||||
Taro.showToast({ title: '添加失败', icon: 'none' });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,7 +48,8 @@ export default function Notifications() {
|
||||
setItems((prev) => (isRefresh ? list : [...prev, ...list]));
|
||||
setTotal(res.total || 0);
|
||||
setPage(pageNum);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[notification] 加载数据失败:', err);
|
||||
setError('加载失败');
|
||||
if (isRefresh) setItems([]);
|
||||
} finally {
|
||||
|
||||
@@ -35,7 +35,8 @@ export default function ReportDetail() {
|
||||
try {
|
||||
const data = await getReportDetail(patientId, id);
|
||||
setReport(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[report] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -34,7 +34,8 @@ export default function MyReports() {
|
||||
setReports(append ? (prev) => [...prev, ...list] : list);
|
||||
setTotal(res.total);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[reports] 加载报告列表失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -79,7 +79,8 @@ export function getLocalHistory(): AiChatMessage[] {
|
||||
try {
|
||||
const raw = wx.getStorageSync('ai_chat_history');
|
||||
return raw ? JSON.parse(raw) : [];
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ai-chat] 读取本地聊天历史失败:', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -88,5 +89,5 @@ export function getLocalHistory(): AiChatMessage[] {
|
||||
export function saveLocalHistory(messages: AiChatMessage[]): void {
|
||||
try {
|
||||
wx.setStorageSync('ai_chat_history', JSON.stringify(messages.slice(-100)));
|
||||
} catch { /* ignore */ }
|
||||
} catch (err) { console.warn('[ai-chat] 保存本地聊天历史失败:', err); }
|
||||
}
|
||||
|
||||
@@ -236,8 +236,8 @@ export class BLEManager {
|
||||
serviceId: svc.uuid,
|
||||
characteristicId: charUUID,
|
||||
});
|
||||
} catch {
|
||||
// 某些特征值可能不支持读取
|
||||
} catch (err) {
|
||||
console.warn('[ble] 读取特征值失败:', err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,8 +347,8 @@ export class BLEManager {
|
||||
try {
|
||||
const uploaded = await uploadFn(batch);
|
||||
return uploaded;
|
||||
} catch {
|
||||
// 失败时放回
|
||||
} catch (err) {
|
||||
console.warn('[ble] 上传待处理读数失败:', err);
|
||||
this.dataBuffer.push(batch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ export class DataBuffer {
|
||||
let raw: string;
|
||||
try {
|
||||
raw = Taro.getStorageSync(key) as string;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ble-buffer] 读取 Storage 失败:', err);
|
||||
break;
|
||||
}
|
||||
if (!raw) break;
|
||||
@@ -96,7 +97,8 @@ export class DataBuffer {
|
||||
}
|
||||
total += parsed.length;
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ble-buffer] 解析 Storage 数据失败:', err);
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
@@ -145,8 +147,8 @@ export class DataBuffer {
|
||||
const key = `${this.config.storageKeyPrefix}_${this.currentBucketIndex}`;
|
||||
try {
|
||||
Taro.setStorageSync(key, JSON.stringify(this.buckets[this.currentBucketIndex]));
|
||||
} catch {
|
||||
// Storage 写入失败不影响主流程
|
||||
} catch (err) {
|
||||
console.warn('[ble-buffer] 持久化当前桶失败:', err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +159,8 @@ export class DataBuffer {
|
||||
let raw: string;
|
||||
try {
|
||||
raw = Taro.getStorageSync(key) as string;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ble-buffer] 清理 Storage 读取失败:', err);
|
||||
break;
|
||||
}
|
||||
if (!raw) break;
|
||||
|
||||
@@ -85,7 +85,8 @@ export class DataSyncScheduler {
|
||||
const raw = Taro.getStorageSync(this.config.storageKey) as string;
|
||||
if (!raw) return null;
|
||||
return JSON.parse(raw) as SyncRecord;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ble-sync] 数据加载失败:', err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,8 @@ export class DataSyncScheduler {
|
||||
private saveRecord(record: SyncRecord): void {
|
||||
try {
|
||||
Taro.setStorageSync(this.config.storageKey, JSON.stringify(record));
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[ble-sync] Storage 操作失败:', err);
|
||||
// Storage 写入失败不影响主流程
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ export async function getHealthThresholds(): Promise<HealthThreshold[]> {
|
||||
const data = await api.get<HealthThreshold[]>('/health/critical-value-thresholds/public');
|
||||
Taro.setStorageSync(THRESHOLD_CACHE_KEY, { data, ts: Date.now() });
|
||||
return data;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 数据加载失败:', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@ async function doRefresh(): Promise<boolean> {
|
||||
invalidateHeadersCache();
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// token 刷新失败
|
||||
} catch (err) {
|
||||
console.warn('[request] Token 刷新失败:', err);
|
||||
}
|
||||
isLoggingOut = true;
|
||||
secureRemove('access_token');
|
||||
|
||||
@@ -154,7 +154,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
secureSet('wechat_openid', resp.openid);
|
||||
set({ loading: false });
|
||||
return false;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[auth] 微信登录失败:', err);
|
||||
set({ loading: false });
|
||||
return false;
|
||||
}
|
||||
@@ -183,7 +184,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
// 登录成功后自动加载患者档案(如果有的话)
|
||||
get().loadPatients();
|
||||
return true;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[auth] 账号密码登录失败:', err);
|
||||
set({ loading: false });
|
||||
return false;
|
||||
}
|
||||
@@ -239,8 +241,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
if (patients.length > 0 && !get().currentPatient) {
|
||||
get().setCurrentPatient(patients[0]);
|
||||
}
|
||||
} catch {
|
||||
// 患者列表加载失败不阻塞流程
|
||||
} catch (err) {
|
||||
console.warn('[auth] 患者列表加载失败:', err);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ export const useHealthStore = create<HealthState>((set, get) => ({
|
||||
|| undefined;
|
||||
const data = await healthApi.getTodaySummary(patientId);
|
||||
set({ todaySummary: data, todaySummaryFetchedAt: Date.now(), loading: false, _refreshingToday: false });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 刷新今日摘要失败:', err);
|
||||
set({ loading: false, _refreshingToday: false });
|
||||
}
|
||||
},
|
||||
@@ -69,7 +70,8 @@ export const useHealthStore = create<HealthState>((set, get) => ({
|
||||
return { trendData: updated };
|
||||
});
|
||||
return points;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[health] 获取趋势数据失败:', err);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
@@ -28,7 +28,8 @@ export const usePointsStore = create<PointsState>((set, get) => ({
|
||||
pointsApi.getCheckinStatus(),
|
||||
]);
|
||||
set({ account, checkinStatus, loading: false, lastFetched: Date.now() });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[points] 刷新积分数据失败:', err);
|
||||
set({ loading: false });
|
||||
}
|
||||
},
|
||||
@@ -42,7 +43,8 @@ export const usePointsStore = create<PointsState>((set, get) => ({
|
||||
const account = await pointsApi.getAccount();
|
||||
set({ account });
|
||||
return true;
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[points] 签到失败:', err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user