feat(mp): Phase 2 功能补全 — SOS+推送+趋势图tooltip+家属安全存储
- index: 添加 SOS 紧急求助悬浮按钮(仅患者可见) - alerts: 告警页面添加微信推送订阅 + critical 推送标识 - TrendChart: 添加触摸 tooltip 显示日期和数值 - family: edit_patient 改用 secureSet/secureGet 安全存储
This commit is contained in:
@@ -195,6 +195,35 @@ function GuestHome({ modeClass }: { modeClass: string }) {
|
||||
|
||||
// ─── 登录后首页 ───
|
||||
|
||||
function SOSButton() {
|
||||
const user = useAuthStore((s) => s.user);
|
||||
const isMedicalStaff = useAuthStore((s) => s.isMedicalStaff);
|
||||
const currentPatient = useAuthStore((s) => s.currentPatient);
|
||||
|
||||
if (!user || !currentPatient || isMedicalStaff()) return null;
|
||||
|
||||
const handleSOS = async () => {
|
||||
const { confirm } = await Taro.showModal({
|
||||
title: '紧急求助',
|
||||
content: '是否拨打急救电话?',
|
||||
confirmText: '拨打',
|
||||
cancelText: '取消',
|
||||
});
|
||||
if (confirm) {
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: '120',
|
||||
fail: () => Taro.showToast({ title: '拨号失败', icon: 'none' }),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<View className='sos-btn' onClick={handleSOS}>
|
||||
<Text className='sos-btn-text'>SOS</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
function HomeDashboard({ modeClass }: { modeClass: string }) {
|
||||
const {
|
||||
healthItems, indicatorCapsules, completedCount, progressPercent,
|
||||
@@ -302,6 +331,7 @@ function HomeDashboard({ modeClass }: { modeClass: string }) {
|
||||
<Text className='action-btn-text'>预约挂号</Text>
|
||||
</View>
|
||||
</View>
|
||||
<SOSButton />
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user