feat(admin): Implement operational monitoring MVP and login optimization
Summary: - Add SimpleLog table for activity tracking (admin_schema) - Implement ActivityService with fire-and-forget pattern - Add stats API endpoints (overview/live-feed/user-overview/cleanup) - Complete activity logging for 7 modules (SYSTEM/AIA/PKB/ASL/DC/RVW/IIT) - Update Admin Dashboard with DAU/DAT metrics and live feed - Fix user module permission display logic - Fix login redirect to /ai-qa instead of homepage - Replace top navigation LOGO with brand image - Fix PKB workspace layout CSS conflict (rename to .pa-chat-container) New files: - backend/src/common/services/activity.service.ts - backend/src/modules/admin/controllers/statsController.ts - backend/src/modules/admin/routes/statsRoutes.ts - frontend-v2/src/modules/admin/api/statsApi.ts - docs/03-.../04-operational-monitoring-mvp-plan.md - docs/03-.../04-operational-monitoring-mvp-implementation.md Tested: All features verified locally
This commit is contained in:
@@ -39,13 +39,22 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
||||
await authApi.refreshAccessToken();
|
||||
const freshUser = await authApi.getCurrentUser();
|
||||
setUser(freshUser);
|
||||
authApi.saveUser(freshUser); // 保存最新用户信息
|
||||
} catch {
|
||||
// 刷新失败,清除状态
|
||||
authApi.clearTokens();
|
||||
setUser(null);
|
||||
}
|
||||
} else {
|
||||
setUser(savedUser);
|
||||
// Token 有效,但仍需获取最新用户信息(确保 modules 等字段是最新的)
|
||||
try {
|
||||
const freshUser = await authApi.getCurrentUser();
|
||||
setUser(freshUser);
|
||||
authApi.saveUser(freshUser); // 更新本地存储
|
||||
} catch {
|
||||
// 获取失败,使用本地缓存
|
||||
setUser(savedUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -102,7 +102,11 @@ const TopNavigation = () => {
|
||||
className="flex items-center gap-3 cursor-pointer"
|
||||
onClick={() => navigate('/')}
|
||||
>
|
||||
<div className="text-2xl">🏥</div>
|
||||
<img
|
||||
src="/logo.jpg"
|
||||
alt="AI临床研究平台"
|
||||
className="h-[52px] w-auto"
|
||||
/>
|
||||
<span className="text-xl font-bold text-blue-600">AI临床研究平台</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user