SpecialX
|
1a9377222c
|
feat(app): add error/loading boundaries and update dashboard routes
- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes
- Add dashboard-error-fallback and dashboard-loading-skeleton components
- Add student/learning page, parent/leave routes, teacher textbook components
- Update existing app routes across auth, dashboard, and API endpoints
- Update proxy middleware and next-auth type declarations
|
2026-06-23 17:38:28 +08:00 |
|
SpecialX
|
bf056399c6
|
feat(error-book): implement error book module with SM2 spaced repetition
- Add SM2 algorithm implementation with tests for spaced repetition review scheduling
- Add data-access, schema, types, and server actions for error book CRUD
- Add components: add dialog, class overview, filters, item card, stats cards, review buttons, top wrong questions
- Add error-book routes for admin, teacher, parent, and student roles
- Add i18n messages (en, zh-CN) for error book module
|
2026-06-23 17:36:42 +08:00 |
|
SpecialX
|
276577b66c
|
feat(messaging,announcements): 前端 UI 集成星标/草稿/置顶/已读回执
- 消息星标:MessageList 卡片星标按钮(乐观更新+回滚)、MessageDetail 头部星标切换
- 消息草稿:MessageCompose 自动保存(2s 防抖)+ 手动保存按钮 + 状态指示器 + 发送后清理草稿
- 公告置顶:AnnouncementCard 管理端置顶按钮、AnnouncementDetail 置顶切换、置顶 Badge
- 公告已读回执:用户端详情页自动标记已读 + 已读/未读 Badge、管理端已读人数显示
- i18n:新增 announcements.meta.readCount 翻译键
|
2026-06-23 17:24:26 +08:00 |
|
SpecialX
|
696346dc08
|
fix(ai): V3 长期问题修复+规则合规+竞品对标
## P1 安全加固
- 原子化每日限额(tryConsumeDailyQuota)解决 TOCTOU 竞态
- 流式端点补齐 Zod 校验 + rate limit + 服务端强制 systemPrompt
- 配额回退机制(refundDailyQuota):过滤/失败不扣配额
- PII 最小化:移除 AI prompt 中的学生姓名
## P1 数据一致性
- 修复 capability 埋点缺失 child_summary/study_path 类型
- 创建 data-access.ts:真实统计聚合替代硬编码零
- 修复 generateChildSummary/recommendStudyPath 的 capability 标记
## P2 可靠性
- AI 调用重试机制(withRetry 指数退避,429/5xx,2 次重试)
- 30s 超时配置
- 流式 controller 安全 enqueue(防已关闭抛错)
- localStorage 防抖持久化(500ms,流式过程中跳过)
## P2 TypeScript/规则合规
- 移除 as 断言(VariantType 类型守卫、Permission 类型、StreamErrorKey)
- 补齐返回类型标注(POST/getStatusFromError/DashboardLayout)
- 拆分 use-ai-chat-stream hook(190→107 行,函数体≤80 行)
- 抽取 stream-utils.ts(SSE 解析/错误映射/消息工具)
- Tailwind 任意值添加注释说明(max-w-[80%] 聊天气泡)
## P3 竞品对标
- 苏格拉底式辅导强化(对标 Khanmigo):
- SOCRATIC_TUTOR_SYSTEM_PROMPT 3 级提示升级
- 强化 STUDENT_BLOCKED_PATTERNS 正则(中英文答案拦截)
- validateSocraticOutput 服务端校验(问号结尾+连续陈述句限制)
- socratic_warning SSE 事件类型
- 知识图谱集成(对标 Squirrel AI):
- StudyPathInput 新增 knowledgeGraph/textbookId 字段
- recommendStudyPathAction 自动从 textbooks 模块获取图谱+掌握度
- STUDY_PATH_SYSTEM_PROMPT 增加前置依赖链规则
- WEAKNESS_ANALYSIS_SYSTEM_PROMPT 增加 rootCause 字段
## 架构文档同步
- 004 更新 AI 模块章节(V3 标记/新导出/依赖关系/安全机制/文件清单)
- 005 更新 modules.ai 节点(dependsOn/exports/dataAccess/streamUtils/dependencyMatrix)
|
2026-06-23 09:39:18 +08:00 |
|
SpecialX
|
2c0f81391b
|
feat(dashboard): 实现所有长期问题修复(P2-1/P2-5/P2-7/P2-9)
P2-9: TeacherSchedule 重复渲染优化
- 将移动端(lg:hidden)和桌面端(hidden lg:block)的双实例渲染改为单实例
- 使用 CSS flex order + grid col-start/row-start 实现响应式布局重排序
- 消除服务端 HTML 负载翻倍问题
P2-5: StudentTodayScheduleCard 时间过时修复
- 新增 useCurrentTime hook(src/shared/hooks/use-current-time.ts)
- 每分钟自动更新当前时间,useMemo 依赖 [items, now] 确保徽章不过时
- SSR 安全:初始渲染用 new Date(),挂载后 setInterval 更新
P2-1: 流式/Suspense 架构改造
- 新增 getAdminDashboardStreams(streams.ts):返回各独立数据源的未解析 Promise
- Admin dashboard:7 个分区组件用 React use() 独立消费 Promise,各 Suspense 边界独立流式渲染
- Teacher/Student/Parent dashboard:传入未解析 Promise,视图用 use() 消费,启用 Suspense 流式
- 页面外壳(标题 + 快捷操作)立即渲染,数据到达后各分区按各自速度填充
P2-7: 组件测试 + 路由测试修复
- 修复 dashboard-routing.test.ts:移除误导性的 permissions 字段(实际用 resolvePermissions(roles))
- 新增 fallback 路由测试(未知角色 → teacher dashboard)
- 新增 DashboardSection 组件测试(6 个测试:骨架屏变体 + 错误边界 + 正常渲染)
- 新增 useCurrentTime hook 测试(3 个测试:初始值 + 间隔更新 + 清理)
同步更新:
- docs/architecture/005_architecture_data.json 新增 7 个流式组件 + useCurrentTime hook + getAdminDashboardStreams 条目
|
2026-06-23 09:04:40 +08:00 |
|
SpecialX
|
e2e0487a3b
|
feat(attendance,elective): 实现所有 P2 长期改进项
P2 修复(来自审计报告):
- 2.4.4: Server Action 错误消息 i18n 化(attendance/elective 全部 Action)
- 2.5.3: 抽取 AttendancePageLayout 组件复用(admin/teacher 页面)
- 2.5.4: 抽取 ElectivePageLayout 组件复用(admin/teacher 列表页)
- 2.6.3: 考勤月历键盘导航(tabIndex + 方向键 + Home/End + role=grid)
- 2.8.2: getStudentAttendanceSummary 分页优化(SQL 聚合统计 + LIMIT 分页)
- 2.8.3: resolveCourseDisplayNames 缓存优化(React cache 去重)
- 2.1.4: elective data-access 跨模块依赖接口抽象(resolvers.ts 可注入)
P2 建议项:
- 选课时间冲突检测(parseSchedule + isScheduleConflict 纯函数 + checkScheduleConflict)
- 学分上限校验(MAX_CREDIT_PER_TERM + checkCreditLimit)
- 考勤/选课数据导出 Excel(export.ts + API 路由扩展)
新增文件:
- src/modules/attendance/components/attendance-page-layout.tsx
- src/modules/elective/components/elective-page-layout.tsx
- src/modules/elective/resolvers.ts
- src/modules/attendance/export.ts
- src/modules/elective/export.ts
校验:
- npm run lint 通过(exit 0)
- npx tsc --noEmit attendance/elective/parent 相关零错误
|
2026-06-23 09:02:41 +08:00 |
|
SpecialX
|
4da9194a5e
|
feat(ai): V2 深度增强 — SSE 流式/全局助手/内容安全/多角色覆盖
对标 Khanmigo/Duolingo Max/Squirrel AI/Century Tech 实现:
- SSE 流式响应:createAiChatCompletionStream AsyncGenerator + /api/ai/chat/stream SSE 端点 + useAiChatStream hook(AbortController 停止生成 + localStorage 持久化)
- Markdown 渲染:AiMarkdownRenderer(react-markdown + remark-gfm + 代码块/表格/列表 + hover 复制按钮)
- 全局 AI 助手:AiAssistantWidget 浮动按钮 + Sheet 侧抽屉 + usePathname 路由推断上下文(7 类场景系统提示)+ dashboard layout 全局注入 AiClientProvider
- 内容安全:content-safety.ts 多层过滤(输入/输出安全过滤 + 每日限制 student 50/teacher 200/parent 30/admin 500 + 学生苏格拉底模式),COPPA/FERPA K12 合规
- 多角色 AI 覆盖:家长端 AiChildSummary(学情摘要)+ 管理员端 AiUsageDashboard(使用监控)+ 学生端 AiStudyPath(个性化学习路径)
- i18n 修复:8 处错误键引用 + zh-CN/en ai.json 全面扩展
- 架构文档 004/005 同步更新
|
2026-06-23 01:34:37 +08:00 |
|
SpecialX
|
a60105455e
|
feat(exams,homework,parent): V3 审计深度修复 — 批量批改/考试分析/提交反馈/家长视图/移动端优化
V3-5: exam-actions.tsx 集成 useExamHomeworkFeatures hook,按角色控制菜单项可见性
V3-7: 批量批改 — 新增 batchAutoGradeSubmissions data-access + Server Action + HomeworkBatchGradingView 组件
V3-8: 考试分析仪表盘 — 新增 getExamAnalytics stats-service + ExamAnalyticsDashboard 组件 + /teacher/exams/[id]/analytics 路由
V3-9: 提交后即时反馈页 — 新增 HomeworkSubmissionResult 组件 + /student/learning/assignments/[id]/result 路由
V3-11: 家长考试详情 — 新增 ChildExamDetail 组件 + getStudentExamResults data-access + child-detail-panel exams Tab
V3-12: 移动端触控优化 — 题目导航与考试操作按钮 44px 最小触控目标
修复: instrumentation.ts 适配器补全 questionCount/averageScore/overdueCount 字段
修复: exam-homework-port.ts 类型导入对齐 ExamWithQuestionsForHomework
修复: trend-line-chart.tsx 数据类型允许 undefined(classAverage 可选场景)
同步更新 004/005 架构文档
|
2026-06-23 01:06:27 +08:00 |
|
SpecialX
|
21c5eba96c
|
feat(ai): 新增 AI 模块并集成至备课/错题集/试卷/改题四大业务场景
- 新增 src/modules/ai 独立模块,遵循三层架构(actions → services → shared/lib/ai)
- 通过 AiClientProvider + useAiClient 实现 React Context 依赖注入,业务组件零直接 import
- 6 个 Server Actions 均调用 requirePermission() 权限校验,返回 ActionState<T>
- withAiTracking 统一埋点,覆盖 chat/similar_question/grading_assist/lesson_content/question_variant/weakness_analysis
- 集成场景:作业批改 AiGradingAssist、错题集 AiErrorBookAnalysis、备课 AiLessonContentGenerator、试卷 AiQuestionVariantGenerator
- 全量 i18n(en/zh-CN ai.json),Error Boundary + Skeleton 边界处理
- 同步架构图 004/005,新增审计报告 ai-module-audit-report.md
|
2026-06-23 00:52:39 +08:00 |
|
SpecialX
|
15aa84b72c
|
refactor(school,classes): 完成 school/grade/class 审计全量改进项
P0-1/P0-2: 删除 grade-management 死模块,年级 CRUD 统一由 school 模块负责
P0-3: classes/actions.ts 从 974 行拆分为 6 个职责文件 + barrel re-export
P0-5: 13 个页面 i18n 全量接入(grades/departments/academic-year/classes/insights)
P1-1: 角色硬编码改为 hasAdminScope/hasTeacherScope/hasStudentScope 基于 dataScope.type
P1-3: 新增 SchoolErrorBoundary + SchoolListSkeleton/SchoolCardSkeleton,4 个页面包裹 Error Boundary
P1-4: classes/types.ts 跨领域类型添加归属决策注释
P1-5: schools-view.tsx 拆分为组合模式(SchoolFormDialog + SchoolDeleteDialog + SchoolListToolbar)
P1-6: 新增 getSchoolsForUser/getGradesForUser 权限感知查询函数
P2-1: 抽取 useSchoolData hook,对话框状态管理与 UI 分离
同步更新架构图文档 004/005
|
2026-06-22 18:54:01 +08:00 |
|
SpecialX
|
1fe30984b6
|
refactor(announcements,messaging,notifications): V1+V2 审计重构 — i18n 命名空间独立 + 通知标题 i18n 化 + 服务端过滤 + 编排下沉 + 表单错误展示 + 架构图同步
V1 改进(已完成):
- P0-4/P1-4/P1-5: 通知组件和 CRUD Action 从 messaging 迁移至 notifications 模块
- P1-5: 新增 getMessagesPageData / getAdminAnnouncementsPageData 编排函数
- P1-6: announcements schema 添加 superRefine 条件校验
- P1-7: 新增 useMessageSearch hook(防抖 + 请求竞态取消)+ 客户端分页 UI
- P1-9: deleteMessage 事务化
- P2-11: 全模块 trackEvent 埋点
- 全模块 i18n 接入 + Error Boundary + a11y 改进
V2 改进(本次完成):
- V2-P0-1: 通知 i18n 命名空间独立(notifications.json),useTranslations 从 "messages" 切换到 "notifications"
- V2-P0-2: 公告/消息通知标题 i18n 化,Server Action 中使用 getTranslations 生成通知标题
- V2-P1-1: AnnouncementList 纯服务端过滤,移除客户端 useState/useMemo
- V2-P1-2: MessageList 客户端过滤仅在初始数据时执行,搜索结果由服务端按 tab 过滤
- V2-P1-3: 消息详情页编排下沉,新增 getMessageDetailPageData 编排函数
- V2-P1-4: 表单服务端校验错误展示(fieldErrors + aria-invalid)
- V2-P2-1: 轮询间隔常量化(POLL_INTERVAL_MS)
- V2-P2-2: 架构图同步(004 + 005)
|
2026-06-22 18:43:12 +08:00 |
|
SpecialX
|
682d385ee2
|
fix(dashboard): v3 审计修复 — 数据完整性、i18n、类型安全、死代码清理
P0 修复(严重):
- admin ContentRow 标签与值错配(stats.users→textbooks 等 6 处)
- admin/error.tsx 硬编码中文替换为 useTranslations
- UserGrowthChart 空数据时渲染 EmptyState(userGrowth/homeworkTrend 永远为空数组)
P1 修复(高):
- 新增 admin/dashboard 和 student/dashboard 的 loading.tsx + error.tsx
- 抽取 DashboardLoadingSkeleton 和 DashboardErrorFallback 共享组件,消除 5 套重复文件
- formatDate/formatLongDate 传入用户 locale(admin/teacher/student 共 6 个组件)
- 移除死代码:getCachedAdminDashboard、AvatarImage src={undefined}、TeacherStats isLoading prop
- filterTodaySchedule 改为泛型函数,消除 as 类型断言
- 辅助函数 getStatus/getDueUrgency 新增显式返回类型
- UserGrowthChart 新增 labelKey prop 区分用户增长/作业提交趋势标签
P2 修复(中):
- 4 个组件从客户端转为服务端组件(DashboardGreetingHeader、TeacherQuickActions、TeacherDashboardHeader、StudentDashboardHeader)
- Student dashboard 空状态新增 CTA(viewSchedule、viewAll)
- TeacherHomeworkCard 图标按钮新增 aria-label
- TeacherTodoCard 排序逻辑重写为可读的 if/return 模式
同步更新:
- docs/architecture/005_architecture_data.json 新增 DashboardLoadingSkeleton、DashboardErrorFallback 条目
- 新增 docs/architecture/audit/dashboard-audit-report-v3.md 审计报告
- dashboard.json 新增 6 个 i18n 键(textbooks/chapters/questions/exams/totalAssignments/totalSubmissions)
|
2026-06-22 18:36:46 +08:00 |
|
SpecialX
|
f62b8c0f86
|
refactor(attendance,elective): 审计第二轮 — 全量完成 P0/P1 改进项
P0 修复:
- 页面层 i18n 全量补齐(admin/teacher/parent/student × attendance/elective)
- types.ts 状态标签常量迁移至 constants.ts(i18n key + Badge variant)
- 修复 getTranslations 导入路径(next-intl → next-intl/server)
P1 改进:
- 解耦 parent 模块对 attendance 类型的直接依赖(本地 view-model 类型)
- 导出纯函数(computeStats/buildWarnings/buildLotteryRankCase 等)
- 统一空状态为 EmptyState 组件
- 清理死代码读 Action(attendance 5 个 + elective 3 个)
- 预留监控埋点接口(trackEvent 13 个新事件名)
- 补齐骨架屏 loading.tsx(8 个页面)
- AlertDialog 替换 window.confirm(student-selection-view)
- a11y 改进(aria-label/role/键盘导航)
修复:
- AttendanceStatus 从 constants.ts 重导出,消除 types/constants 双源混乱
- buildWarnings 的 Translator 类型改用 ReturnType<typeof useTranslations>
|
2026-06-22 17:33:29 +08:00 |
|
SpecialX
|
5f3a1a4662
|
refactor(grades,diagnostic): 完成成绩和学情诊断模块审计 P1+P2 改进项
P1-1: 抽取 stats-service.ts,将 8 个统计计算纯函数从 data-access 层分离
P1-5: 创建 WidgetBoundary 组件 + 补齐 teacher 路由 loading.tsx/error.tsx (14 文件)
P1-6: 同步架构图文档 004/005,新增 stats-service 与 widget-boundary 节点
P2-1: 补充 a11y ARIA 属性(5 图表 role=img + aria-label,2 表格 caption,3 列表 role=list,3 按钮 aria-label)
P2-3: 修复班级报告 studentId 字段语义错误(schema 改为可空 + 迁移 + 代码适配)
P2-4: 修复 grade_managed scope 返回空数据(改为子查询 classes 表按 gradeId 过滤)
P2-5: 新增 /parent/diagnostic/ 页面(多子女学情诊断聚合 + loading + error)
P2-6: 统一 SearchParams 工具(student/grades 和 management/grade/insights 改用 @/shared/lib/search-params)
|
2026-06-22 17:07:32 +08:00 |
|
SpecialX
|
10c668f36a
|
feat(school,classes): 学校/年级/班级模块审计修复 — 权限校验 + i18n + 架构图同步
- 新增审计报告 docs/architecture/audit/school-grade-class-audit-report.md
- 修复 P0-4: teacher/classes 4 个页面补充 requirePermission 权限校验
- 修复 P0-5: 新增 school.json i18n 文件(zh-CN/en)并接入 schools-view 组件
- 同步架构图 004:补充 grade-management 死模块记录与 teacher/classes 权限修复说明
|
2026-06-22 16:44:02 +08:00 |
|
SpecialX
|
22d3f07fcf
|
feat(textbooks): 教材模块审计重构 — 跨模块解耦 + 权限 + i18n + 错误边界 + 纯函数抽取
P0 修复:
- 解耦跨模块 UI 依赖:knowledge-point-dialogs 不再直接 import questions,
改为 renderQuestionCreator render prop 由页面注入
- 接入 usePermission Hook 替换 canEdit 硬编码
- 全模块 i18n 改造:新增 en/zh-CN 翻译文件,替换所有硬编码文案
- Server Action 资源归属校验:新增 verifyChapterBelongsToTextbook/
verifyKnowledgePointBelongsToTextbook,在 reorder/update/delete/create 中校验
P1 改进:
- 补齐 Error Boundary:4 个 error.tsx + TextbookSectionErrorBoundary 区块包裹
- 抽取纯函数到 utils.ts/graph-layout.ts/constants.ts 并补单测(26 用例全通过)
- 消除重复组件:删除 knowledge-point-panel/create-knowledge-point-dialog
- 修复类型断言:chapter.children! → 守卫式访问
- 图谱 a11y:添加 role/aria-label/aria-pressed
- 统一删除确认:confirm() → AlertDialog
- 数据范围过滤:getTextbooksWithScope 支持学生端按年级过滤
P2 预留:
- TextbookAnalytics 埋点接口 + Provider + Hook
同步 005 架构数据 JSON:补充 getTextbooksWithScope/verify*/ChapterTreeNode 等
|
2026-06-22 16:25:59 +08:00 |
|
SpecialX
|
45ee1ae43c
|
refactor(grades,diagnostic): 成绩和学情诊断模块审计修复
P0-1: 10 个页面补充 requirePermission 权限校验
P0-2: diagnostic/data-access-reports.ts 移除直查 users 表,改用 getUserNamesByIds
P0-3: 新增 grade/grades/diagnostic 三组 i18n 翻译文件(zh-CN/en)
P0-4: 新增 /management/grade 重定向页面
P1-2: 抽取 toNumber/normalize/buildScopeClassFilter 到 lib/grade-utils.ts
P1-3: 为 12 个 Action 新增 Zod safeParse 校验(schema.ts +12 查询 schema)
P1-4: 修复 as 断言违规,改用类型守卫函数
P2-2: 移除 diagnostic 组件中 Tailwind 任意值
同步更新架构图文档 004 和 005
|
2026-06-22 16:23:34 +08:00 |
|
SpecialX
|
20691f53ce
|
feat(lesson-preparation): 备课模块审计重构 — 跨模块解耦 + i18n + 纯函数抽取 + 错误边界
P0-1 跨模块直查修复:publish-service 不再直查 examQuestions 表,新增 exams/data-access.addExamQuestions 接口,复用 classes/data-access.getStudentIdsByClassIds
P0-2 i18n 接入:新增 zh-CN/en 翻译文件,注册 lessonPreparation 命名空间,17 个组件改造为 useTranslations/getTranslations
P1 纯函数抽取:lib/document-migration.ts(类型守卫替代 as 断言)、lib/node-summary.ts(翻译函数注入)、lib/rf-mappers.ts
P1 错误边界+骨架屏:新增 LessonPlanErrorBoundary 和 4 个 Skeleton 组件
P1 Block 注册表:新增 config/block-registry.tsx(BlockRenderer 组件),node-edit-panel 重构为配置驱动渲染
P1 其他修复:exercise-block 改用 router.refresh(),node-editor/lesson-node 复用 lib/ 纯函数
架构图同步:更新 004 和 005 文档
Refs: docs/architecture/audit/lesson-preparation-audit-report.md
|
2026-06-22 16:17:58 +08:00 |
|
SpecialX
|
4833930834
|
feat(attendance,elective): 考勤与选修课模块审计重构 — P0 修复 + i18n + Error Boundary
审计报告:docs/architecture/audit/attendance-elective-audit-report.md
P0 修复:
- attendance: getAttendanceStats 统计失真(仅基于前 20 条记录)改为 SQL 聚合查询
- attendance: getClassStudentsForAttendance 跨模块直查 classEnrollments 改为调用 classes data-access
- attendance: update/delete Action 新增资源归属校验(assertRecordOwnership)
- elective: update/delete/openSelection/closeSelection/runLottery Action 新增资源归属校验(assertCourseOwnership)
i18n 接入:
- 新增 attendance/elective 命名空间(zh-CN + en)
- attendance-stats-cards 接入 useTranslations
- elective-course-list/form 接入 useTranslations
类型安全(P1):
- elective-course-form: 移除 as 断言,改用类型守卫 isSelectionMode
- elective-course-list: 移除 null as never 类型逃逸,改用泛型
Error Boundary:
- 新增 admin/teacher attendance error.tsx
- 新增 admin/student elective error.tsx
架构图同步:
- 004: 修正 attendance/elective/parent 章节的导出函数、文件清单、已知问题
- 005: 修正 actions 的 usedBy(标记无调用方的死代码)、新增 issues 字段、更新依赖矩阵
|
2026-06-22 16:17:00 +08:00 |
|
SpecialX
|
5d42495480
|
feat(settings): 设置与个人信息模块审计重构 — i18n + 服务注入解耦 + Error Boundary + 流式渲染
- 新增 SettingsService 接口 + Context 注入,组件层不再直接 import users/messaging actions
- 新增 resolveRoleSettingsConfig 配置驱动角色路由,删除 parent/student/teacher-settings-view 冗余文件
- 新增 SettingsSectionErrorBoundary,每个 TabsContent + profile 角色概览区块均包裹
- 新增 ProfileStudentOverview/ProfileTeacherOverview 异步 Server Component + 骨架屏,支持流式渲染
- 抽取 buildStudentOverviewData 等纯函数到 lib/student-overview-data.ts,便于单元测试
- 新增 settings.json 翻译文件(zh-CN + en),所有组件改用 useTranslations/getTranslations
- 重构 profile/page.tsx:i18n 适配 + Suspense 分区加载 + 业务逻辑抽离
- 同步更新架构图 004/005
|
2026-06-22 16:15:36 +08:00 |
|
SpecialX
|
21c7e65fee
|
feat(exam-homework): add audit report, i18n, error boundaries, and permission hardening
- Add comprehensive audit report for exam and homework module
- Create exam-homework i18n message files (zh-CN + en) and register namespace
- Add permission check to gradeHomeworkSubmissionAction to prevent horizontal privilege escalation
- Add Error Boundary + loading.tsx for 5 key pages (exam build/proctoring, homework assignment/submissions, student assignment)
- Refactor exam-columns to createExamColumns(t) factory for i18n support
- Refactor exam-data-table to manage columns internally via useTranslations
- Replace hardcoded strings with i18n keys in all exam/homework components and pages
- Add getHomeworkSubmissionForGrading data-access for secure grading flow
|
2026-06-22 16:08:39 +08:00 |
|
SpecialX
|
fde711ce46
|
feat(announcements,messaging): 公告与消息模块审计重构 — i18n + Error Boundary + a11y
- 新增审计报告 docs/architecture/audit/announcements-messages-audit-report.md
- 新增中英双语 i18n 字典 announcements.json / messages.json(11/13 个命名空间)
- 重构所有 announcements 和 messaging 组件接入 next-intl(useTranslations)
- 所有页面 page.tsx 使用 generateMetadata + getTranslations 替代硬编码 metadata
- 新增 7 个 error.tsx 错误边界(4 公告 + 3 消息),统一 EmptyState + i18n + 重试
- a11y 改进:announcement-card / message-list / notification-dropdown 添加 aria-label
- 同步架构图 004 和 005:i18n.messages 清单 + 已知问题修复记录
|
2026-06-22 16:02:07 +08:00 |
|
SpecialX
|
868ac5f9cf
|
feat(dashboard): 仪表盘模块审计重构 — 权限校验 + i18n + 逻辑抽离
基于 dashboard-audit-report.md 审计结论,对仪表盘模块进行 P0/P1 级修复:
- 新增 4 个 dashboard 权限点(DASHBOARD_ADMIN/TEACHER/STUDENT/PARENT_READ),补充到 permissions.ts 和角色-权限映射
- 新建 actions.ts:4 个 Server Action 均调用 requirePermission() 校验权限,消除 admin 页面零鉴权、teacher/student/parent 仅 requireAuth 的安全隐患
- 根重定向页 /dashboard 改用 resolvePermissions() + 权限点判断,不再 role === xxx 硬编码
- 新建 lib/dashboard-utils.ts:抽取 toWeekday / countStudentAssignments / sortUpcomingAssignments / filterTodaySchedule / computeTeacherMetrics / getGreetingKey 纯函数,与 UI 分离,便于单测
- 新建 messages/{zh-CN,en}/dashboard.json 翻译文件,i18n request.ts 加载 dashboard 命名空间;所有视图组件接入 useTranslations / getTranslations,消除中英混杂硬编码
- 重构 4 个角色 page.tsx:通过 actions 获取数据,generateMetadata 使用 i18n
- 同步更新架构图 004 / 005 文档(dashboard exports / permissions / 文件清单)
|
2026-06-22 15:50:56 +08:00 |
|
SpecialX
|
30f4983d49
|
feat(student): 完成 student 模块 v4 剩余修复
- P1-4.2: 新增班级详情页 courses/[classId],展示教师/学校/教室信息与课表
- P2-2.5: 今日课表卡片高亮当前/下一节课(useMemo 实时计算)
- P2-3.9: 作业作答进度网格支持点击跳转题目(scrollIntoView)
- P2-3.10: 作业复习视图显示正确答案(选择/判断/文本题)
- P2-4.4: 课程列表支持按班级名/教师/学校搜索
- P2-5.2: 成绩页新增趋势折线图组件 GradeTrendCard
- P2-9.2/9.3: 诊断报告新增历史记录卡片与弱点练习入口
- P2-10.2: 选课列表支持搜索与选课模式筛选
- P2-11.3: 修复教材阅读页全屏溢出
- P3-1.5: 面包屑保留首个角色段作为根上下文
- P3-7.3: 课表项支持点击跳转至班级详情页(ScheduleList href)
|
2026-06-22 14:08:34 +08:00 |
|
SpecialX
|
a4d096a6fc
|
fix: patch P0 security vulnerabilities and critical UX issues across 6 modules
Security: Add admin/layout.tsx auth guard; Add requirePermission() to 12 admin pages
Dashboard: Fix StudentStatsGrid rendering; Fix teacher greeting; Add loading/error boundaries; Fix col-span; Add metadata
Announcements: Fix audience filtering; Add user detail page; Trigger notifications on publish; Pass classes data; Add loading.tsx
Messages: Implement soft delete; Add unread badge with polling; Add notification dropdown polling; Add keyword search; Add quiet hours DND
Management: Add loading/error for 9 admin routes; Fix admin-classes-view to use Select for school/grade
Profile/Settings: Add loading/error; Fix parent role routing; Create ParentSettingsView; Integrate AiProviderSettingsCard; Add Tab URL persistence; Add logout confirm; Add avatar; Fix Progress arbitrary class
Schema: Add senderDeletedAt/receiverDeletedAt to messages; Add quietHours to notificationPreferences; Add uniqueIndex import
Docs: Update architecture docs 004/005
|
2026-06-22 13:57:31 +08:00 |
|
SpecialX
|
5ff7ab9e72
|
fix(teacher): 统一详情页返回路径与中英文文案 (P1-3+P2-1)
P1-3: empty-state 默认按钮 variant 改为 outline 并新增 variant prop;button.tsx 导出 ButtonProps;统一 5 个详情页返回路径为 ghost+ArrowLeft+文字标签;course-plan-detail raw a 改为 Link。P2-1: formatLongDate 默认 locale 改为 zh-CN,weekday 改为 short;返回按钮文案中文化;course-plan-detail 全量中文化;grades/analytics 标题中文化。验证:tsc 0 错误,lint 0 错误,架构图 004/005 已同步。
|
2026-06-22 13:52:26 +08:00 |
|
SpecialX
|
c45b3488c5
|
feat(admin): 补全 admin 模块核心功能与产品体验优化
修复 v4 报告中的 13 个产品体验问题:新增用户管理列表页和系统设置页,重组导航菜单并补充缺失入口,增加角色切换机制,Dashboard 增加快捷操作和 recharts 趋势图表,考勤增加统计概览,排课增加课表网格视图,统一 Toast 操作反馈,同步更新架构文档
|
2026-06-22 13:38:07 +08:00 |
|
SpecialX
|
978d9a8309
|
feat: 新增备课模块并修复全模块 P0/P1/P2 缺陷
Security / deep-security-scan (push) Failing after 20m5s
DR Drill / dr-drill (push) Failing after 1m31s
CI / scheduled-backup (push) Failing after 1m31s
CI / backup-verify (push) Has been skipped
CI / weekly-dr-drill (push) Failing after 0s
CI / build-deploy (push) Has been cancelled
CI / security-scan (push) Has been cancelled
主要变更:
- 新增 lesson-preparation 模块: 备课编辑器、节点编辑、AI 建议、知识点选择、版本历史、作业发布
- 新增 shared 通用组件: charts/question-bank-filters/schedule-list/ui (chip-nav/filter-bar/page-header/stat-card/stat-item)
- 新增 student/admin 端 loading.tsx 与 error.tsx, 优化加载与错误态体验
- 新增 teacher/lesson-plans 页面 (列表/新建/编辑)
- 新增 drizzle 迁移 0002_tiny_lionheart 及 snapshot
- 新增 textbooks/schema.ts 与 exams/utils/normalize-structure.ts
- 修复 Tiptap v3 SSR hydration 崩溃 (rich-text-block immediatelyRender: false)
- 重构多模块 data-access/actions/组件, 修复权限校验与类型规范
- 同步架构文档 004/005 反映新增模块、导出、依赖关系
- 归档 bugs/* 测试报告与 e2e 测试脚本 (admin/parent/student/teacher web_test)
|
2026-06-22 01:06:16 +08:00 |
|
SpecialX
|
d8962aba96
|
refactor: fix remaining P2 architecture issues
Fix P2-6: proxy.ts now uses Permissions constants instead of hardcoded strings
Fix P2-7: useA11yId file no longer exists (use-aria-live.ts already in hooks/)
Fix P2-8: schema.ts section numbering reordered to continuous 1-24
Fix P2-11: announcements dead code void wasPublished already removed
Fix P2-17: app-sidebar.tsx uses hasRole() instead of permission-based role inference
Fix P2-18: scheduling/actions.ts removes trailing re-export of data-access; 4 pages now import directly from data-access
Sync architecture docs 004 and 005
|
2026-06-20 01:00:06 +08:00 |
|
SpecialX
|
49291fcc31
|
refactor: fix all P0/P1/P2 bugs and architecture issues
Bug fixes (from bugs/ directory):
- Fix cross-module DB queries in 9 modules (homework, grades, parent, diagnostic, elective, proctoring, notifications, scheduling, classes) by routing through data-access functions
- Fix shared/lib <-> auth circular dependency via new session.ts module
- Fix divide-by-zero guard in grades data-access
- Fix audit export data truncation (paginated fetch for full datasets)
- Fix missing transactions in homework grading and elective lottery
- Fix missing revalidatePath in course-plans actions
- Fix frontend permission checks using requirePermission instead of requireAuth
- Fix dashboard role routing using session.user.roles
- Fix student auth pattern (migrate getDemoStudentUser to users module)
- Fix ActionState return type handling in components
Code quality fixes:
- Remove 60+ as type assertions (replace with type guards)
- Remove non-null assertions (use optional chaining or explicit checks)
- Convert dynamic imports to static imports (grades, diagnostic)
- Add React.cache() wrapping for read functions
- Parallelize independent queries with Promise.all
- Add explicit return types to 30+ arrow functions
- Replace any with unknown + type guards
- Fix import type for type-only imports
- Add Zod validation schemas for classes and diagnostic modules
- Extract duplicate code (normalizeRoleName, normalizeBcryptHash, logger IP extraction)
- Add console.error to silent catch blocks
- Fix permission naming consistency (exam:proctor_read -> exam:proctor:read)
Architecture doc sync:
- Update 004_architecture_impact_map.md and 005_architecture_data.json
- Update management-modules-audit.md for P0-7 cross-module fix
Moved deleted proctoring event route to deletes/ folder.
|
2026-06-19 05:13:34 +08:00 |
|
SpecialX
|
b86255f0ea
|
feat(P2): 实现选课管理、考试监考、学情诊断三大功能模块
## 新增功能模块
### 1. 选课管理(elective)
- 新增表:electiveCourses、courseSelections
- 新增权限:ELECTIVE_MANAGE/ELECTIVE_READ/ELECTIVE_SELECT
- 支持先到先得 + 抽签两种选课模式
- admin/teacher/student 三端页面
### 2. 考试监考(proctoring)
- exams 表扩展:examMode/durationMinutes/antiCheatEnabled 等字段
- 新增表:examProctoringEvents
- 新增权限:EXAM_PROCTOR/EXAM_PROCTOR_READ
- 教师监考面板 + 学生端防作弊监控
- API:/api/proctoring/event 接收事件上报
### 3. 学情诊断报告(diagnostic)
- 新增表:knowledgePointMastery、learningDiagnosticReports
- 新增权限:DIAGNOSTIC_MANAGE/DIAGNOSTIC_READ
- 基于提交答案自动计算知识点掌握度
- 生成个人/班级诊断报告(强项/弱项/建议)
- 雷达图可视化
## 其他改动
- 项目规则:单文件行数限制从 300 行调整为企业级规范(组件≤500/Actions≤800/硬上限1000)
- scripts/seed.ts:消除全部 any 类型,定义内部类型,0 lint 错误
- 架构文档 004/005 同步更新三个新模块
- 迁移文件 0001_heavy_sage.sql 生成
## 验证
- npx tsc --noEmit:0 错误
- npm run lint:0 错误 0 警告
|
2026-06-17 19:12:51 +08:00 |
|
SpecialX
|
3b6272c99d
|
feat: 完成 P1 全部功能 + 修复 proxy 导出 + 切换 MySQL 端口至 14013
## P1 功能(20 项)
- 站内消息系统、家长仪表盘、学生考勤管理
- Excel 导入导出、用户批量导入、成绩导出
- 排课规则+自动排课+课表调整
- 成绩趋势+对比分析、密码安全策略、速率限制
- 数据变更日志、文件预览+存储策略、全文检索
- 依赖审计集成 CI、数据库定时备份、E2E 测试完善
- 通知偏好管理
## 基础设施修复
- src/proxy.ts: 将 middleware 导出重命名为 proxy(Next.js 16 要求)
- .env: MySQL 端口从 13002 切换至 14013
- scripts/create-db.ts: 新增数据库初始化脚本
## 架构文档同步
- 004_architecture_impact_map.md 和 005_architecture_data.json
完整记录所有新增表、模块、路由、权限、依赖关系
|
2026-06-17 13:44:37 +08:00 |
|
SpecialX
|
125f7ec54c
|
refactor: RBAC权限系统重构 + UI组件拆分 + 测试修复 + 架构文档
CI / build-deploy (push) Has been cancelled
- RBAC: 新增30个权限点、DataScope行级权限、requirePermission守卫,所有57+ Server Action接入权限校验
- UI拆分: exam-form(1623行→11文件)、textbook-reader(744行→7文件),均降至300行以内
- 测试: 新增5个单元测试文件(19用例),修复4个集成测试文件(38用例全部通过)
- 架构文档: 新增架构影响地图(004/005)、标准功能清单(006)、差距审计报告(007)
- 项目规则: 架构图优先规则,改码必同步图
- 安全: rehype-sanitize净化、AES加密API Key、权限路由守卫
- 无障碍: skip-link、aria-label、prefers-reduced-motion
- 性能: next/font优化、next/image、代码分割
|
2026-06-16 23:38:33 +08:00 |
|
SpecialX
|
99f116cb64
|
=test_update_homework_tests_and_work_log
CI / build-deploy (push) Has been cancelled
|
2026-03-19 13:16:49 +08:00 |
|
SpecialX
|
eb08c0ab68
|
sync-docs-and-fixes
|
2026-03-03 17:32:26 +08:00 |
|
SpecialX
|
ac859ee560
|
Update-remaining-files
|
2026-02-24 16:07:15 +08:00 |
|
SpecialX
|
bb4555f611
|
feat: enhance textbook reader with anchor text support and improve knowledge point management
|
2026-01-16 10:22:16 +08:00 |
|
SpecialX
|
9bfc621d3f
|
feat(classes): optimize teacher dashboard ui and implement grade management
|
2026-01-14 13:59:11 +08:00 |
|
SpecialX
|
ade8d4346c
|
feat(dashboard): optimize teacher dashboard ui and layout
- Refactor layout: move Needs Grading to main column, Homework to sidebar
- Enhance TeacherStats: replace static counts with actionable metrics (Needs Grading, Active Assignments, Avg Score, Submission Rate)
- Update RecentSubmissions: table view with quick grade actions and late status
- Update TeacherSchedule: vertical timeline view with scroll hints
- Update TeacherHomeworkCard: compact list view
- Integrate Recharts: add TeacherGradeTrends chart and shared chart component
- Update documentation
|
2026-01-12 11:38:27 +08:00 |
|
SpecialX
|
15fcf2bc78
|
BUG FIX && 权限验证
|
2026-01-09 14:10:04 +08:00 |
|
SpecialX
|
57807def37
|
完整性更新
现在已经实现了大部分基础功能
|
2026-01-08 11:14:03 +08:00 |
|
SpecialX
|
0da2eac0b4
|
强制buildSSR
|
2025-12-31 14:01:12 +08:00 |
|
SpecialX
|
13e91e628d
|
Merge exams grading into homework
Redirect /teacher/exams/grading* to /teacher/homework/submissions; remove exam grading UI/actions/data-access; add homework student workflow and update design docs.
|
2025-12-31 11:59:03 +08:00 |
|
SpecialX
|
f8e39f518d
|
feat(teacher): 题库模块(QuestionBank)
工作内容
- 新增 /teacher/questions 页面,支持 Suspense/空状态/加载态
- 题库 CRUD Server Actions:创建/更新/递归删除子题,变更后 revalidatePath
- getQuestions 支持 q/type/difficulty/knowledgePointId 筛选与分页返回 meta
- UI:表格列/筛选器/创建编辑弹窗,content JSON 兼容组卷
- 更新中文设计文档:docs/design/004_question_bank_implementation.md
|
2025-12-30 19:04:22 +08:00 |
|
SpecialX
|
f7ff018490
|
feat: exam actions and data safety fixes
|
2025-12-30 17:48:22 +08:00 |
|
SpecialX
|
e7c902e8e1
|
Module Update
|
2025-12-30 14:42:30 +08:00 |
|