feat(mp): 小程序功能完善 — 服务层扩展 + 页面优化
- 新增 actionInbox 服务层(待办事项列表/线程查询) - consultation 服务扩展(会话详情/发送消息) - 多页面代码优化(profile/messages/health/article) - 新增 navigate 工具函数
This commit is contained in:
@@ -10,11 +10,27 @@ function App({ children }: PropsWithChildren<Record<string, unknown>>) {
|
||||
const restoreAuth = useAuthStore((s) => s.restore);
|
||||
const restoreUI = useUIStore((s) => s.restore);
|
||||
|
||||
// 首次 mount 时立即恢复认证状态(优先于 useDidShow)
|
||||
useEffect(() => {
|
||||
restoreAuth();
|
||||
restoreUI();
|
||||
}, []);
|
||||
|
||||
useDidShow(() => {
|
||||
restoreAuth();
|
||||
restoreUI();
|
||||
});
|
||||
|
||||
// 暴露全局 bridge 供 MCP/自动化测试调用
|
||||
useEffect(() => {
|
||||
(globalThis as any).__hms = {
|
||||
restoreAuth: () => { restoreAuth(); return useAuthStore.getState(); },
|
||||
restoreUI,
|
||||
getAuthState: () => useAuthStore.getState(),
|
||||
};
|
||||
return () => { delete (globalThis as any).__hms; };
|
||||
}, [restoreAuth, restoreUI]);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setInterval(() => {
|
||||
flushEvents();
|
||||
|
||||
Reference in New Issue
Block a user