feat(mp): 微信模板消息订阅统一封装
- 新增 requestSubscribe() 统一订阅函数,消除页面内类型断言重复
- 用药页面新增 requestSubscribeMessage 订阅(MEDICATION_REMINDER 模板)
- 告警页面改用 requestSubscribe('CRITICAL_HEALTH_ALERT')
- wechat-templates 新增 MEDICATION_REMINDER 模板 ID 环境变量
This commit is contained in:
@@ -3,6 +3,7 @@ import { View, Text, Input, Picker } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { usePageData } from '@/hooks/usePageData';
|
||||
import { getCachedPatientId } from '@/services/request';
|
||||
import { requestSubscribe } from '@/services/wechat-templates';
|
||||
import EmptyState from '../../../components/EmptyState';
|
||||
import {
|
||||
listReminders,
|
||||
@@ -36,7 +37,14 @@ export default function MedicationReminder() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
usePageData(fetchReminders, { throttleMs: 5000, enablePullDown: true });
|
||||
usePageData(
|
||||
async () => {
|
||||
await fetchReminders();
|
||||
// 请求用药提醒推送订阅
|
||||
requestSubscribe('MEDICATION_REMINDER');
|
||||
},
|
||||
{ throttleMs: 5000, enablePullDown: true },
|
||||
);
|
||||
|
||||
const handleToggle = async (r: MedicationReminder) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user