fix: 审计修复 — SSE事件监听 + 软删除列表 + 页面配置
- [HIGH] 前端 SSE store 补充 alert/vital_update 事件监听 - [LOW] seed.rs 软删除列表补充 device_readings - [LOW] 小程序 device-sync 补充 index.config.ts 页面配置
This commit is contained in:
3
apps/miniprogram/src/pages/device-sync/index.config.ts
Normal file
3
apps/miniprogram/src/pages/device-sync/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '设备同步',
|
||||
});
|
||||
@@ -79,11 +79,18 @@ export const useMessageStore = create<MessageState>((set, get) => ({
|
||||
const es = new EventSource(url);
|
||||
|
||||
es.addEventListener('message', () => {
|
||||
// 收到新消息推送,立即刷新未读数和最近消息
|
||||
get().fetchUnreadCount();
|
||||
get().fetchRecentMessages();
|
||||
});
|
||||
|
||||
es.addEventListener('alert', () => {
|
||||
get().fetchUnreadCount();
|
||||
});
|
||||
|
||||
es.addEventListener('vital_update', () => {
|
||||
// 体征数据更新事件 — 预留:未来可触发趋势图刷新
|
||||
});
|
||||
|
||||
es.onerror = () => {
|
||||
// SSE 连接断开时 EventSource 会自动重连
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user