- app.tsx: 将 restoreAuth/restoreUI 从 useEffect 改为 useDidShow, 修复 reLaunch 后 Zustand store 未恢复导致访客模式的问题 - docs/qa/e2e-full-system-report.md: 三端 E2E 测试报告更新, 原 BUG-1(Admin 随访管理 403)确认为误报,综合通过率 100% (64/64) - tools/weapp-mcp/e2e-test.mjs: 小程序 E2E 基础导航测试脚本 - tools/weapp-mcp/e2e-interactive-test.mjs: 小程序 E2E 交互操作测试脚本 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
933 B
TypeScript
34 lines
933 B
TypeScript
import { useEffect, PropsWithChildren } from 'react';
|
|
import Taro, { useDidShow } from '@tarojs/taro';
|
|
import ErrorBoundary from './components/ErrorBoundary';
|
|
import { flushEvents } from './services/analytics';
|
|
import { useAuthStore } from './stores/auth';
|
|
import { useUIStore } from './stores/ui';
|
|
import './app.scss';
|
|
|
|
function App({ children }: PropsWithChildren<Record<string, unknown>>) {
|
|
const restoreAuth = useAuthStore((s) => s.restore);
|
|
const restoreUI = useUIStore((s) => s.restore);
|
|
|
|
useDidShow(() => {
|
|
restoreAuth();
|
|
restoreUI();
|
|
});
|
|
|
|
useEffect(() => {
|
|
const timer = setInterval(() => {
|
|
flushEvents();
|
|
}, 30000);
|
|
const onHide = () => { flushEvents(); };
|
|
Taro.eventCenter.on('appHide', onHide);
|
|
return () => {
|
|
clearInterval(timer);
|
|
Taro.eventCenter.off('appHide', onHide);
|
|
};
|
|
}, []);
|
|
|
|
return <ErrorBoundary>{children}</ErrorBoundary>;
|
|
}
|
|
|
|
export default App;
|