- P3 考试/作业/成绩 mutation + 详情页 + 批改界面 + 乐观更新 + 多 Tab 同步 - P4 知识图谱 SVG 可视化 + 学情分析仪表盘 + parent-portal Remote - P5 WebSocket 通知中心 + AI 出题(SSE) + AI 教案 + AI 学情报告 - P6 可观测性硬化:Sentry + WebVitals + OTel + A11y + 性能配置 + Cookie 迁移 - P7 参考项目差距闭环:新增 35 个页面覆盖 13 个缺失模块 - attendance(考勤 4 页)/questions(题库)/textbooks(教材 2 页) - classes/[id] 详情 + classes/schedule 课表 - course-plans(2 页)/diagnostic(2 页)/error-book/practice - exams/[id]/build 组卷 + exams/[id]/analytics 考后分析 - exams/[id]/edit-rich 富文本编辑 + exams/[id]/proctoring 监考 - grades/entry 批量录入 + grades/stats 统计 + grades/analytics 分析 + grades/report-card 报告卡 - homework/submissions 列表 + assignments/[id]/submissions 批量批改 - homework/submissions/[submissionId] 单份批改 + scan-grading 扫描批改 - lesson-plans 编辑器 + library + calendar + heatmap 5 页 - elective 选修课 3 页 /leave 请假 /schedule-changes 调课 - P7 基础设施:61 GraphQL operations + 5 handlers + 13 fixtures + 11 viewports - 集成 browser.ts/server.ts 注册所有 p7 handlers(fallthrough 顺序) - viewports.ts 扩展 11 个新导航项 - 验证:tsc --noEmit 零错误 + eslint 零错误 - 文档:workline.md 新增 §5 P7 参考项目差距闭环(含完整文件清单)
123 lines
2.8 KiB
TypeScript
123 lines
2.8 KiB
TypeScript
/**
|
||
* GraphQL P4 扩展 Query - 知识图谱 + 学情分析
|
||
*
|
||
* 维护者:ai13(teacher-portal)
|
||
* 关联:graphql.ts P2/P3 扩展、workline.md §3 P4 交付物
|
||
*
|
||
* schema 尚未在 ARB-001 P2 第一版中定义,开发期通过 MSW 拦截返回 mock 响应;
|
||
* 上游就绪后由 ai03 在 teacher-bff.graphql 扩展,届时合并本文件到 graphql.ts。
|
||
*
|
||
* 查询范围(P4):
|
||
* - KnowledgeGraph:班级/科目知识点图谱(节点 + 前置依赖边)
|
||
* - ClassAnalytics:班级学情分析(均分/及格率/趋势/Top 学生/弱项)
|
||
* - StudentAnalytics:单生学情分析(趋势/弱项/强项/掌握度)
|
||
*/
|
||
|
||
import { gql } from "urql";
|
||
|
||
// ============ Types(对齐 P4 schema 设计) ============
|
||
|
||
/** 知识图谱节点(知识点) */
|
||
export interface KnowledgeNode {
|
||
id: string;
|
||
name: string;
|
||
subject: string;
|
||
description: string | null;
|
||
masteryLevel: number; // 0-100
|
||
}
|
||
|
||
/** 知识图谱边(前置依赖关系) */
|
||
export interface KnowledgeEdge {
|
||
from: string;
|
||
to: string;
|
||
type: "PREREQUISITE" | "RELATED";
|
||
}
|
||
|
||
/** 知识图谱完整结构 */
|
||
export interface KnowledgeGraphData {
|
||
nodes: KnowledgeNode[];
|
||
edges: KnowledgeEdge[];
|
||
}
|
||
|
||
/** 单生学情分析 */
|
||
export interface StudentAnalytics {
|
||
studentId: string;
|
||
studentName: string;
|
||
avgScore: number;
|
||
trend: number[]; // 最近 5 次成绩趋势
|
||
weakPoints: string[]; // 弱项知识点名称
|
||
strongPoints: string[];
|
||
masteryRate: number; // 掌握度 0-100
|
||
}
|
||
|
||
/** 班级学情分析 */
|
||
export interface ClassAnalytics {
|
||
classId: string;
|
||
className: string;
|
||
avgScore: number;
|
||
passRate: number;
|
||
avgTrend: number[];
|
||
topStudents: StudentAnalytics[];
|
||
weakPoints: string[];
|
||
}
|
||
|
||
// ============ P4 Query ============
|
||
|
||
/** 知识图谱查询(按班级 + 科目过滤) */
|
||
export const KnowledgeGraphQuery = gql`
|
||
query KnowledgeGraph($classId: ID, $subject: String) {
|
||
knowledgeGraph(classId: $classId, subject: $subject) {
|
||
nodes {
|
||
id
|
||
name
|
||
subject
|
||
description
|
||
masteryLevel
|
||
}
|
||
edges {
|
||
from
|
||
to
|
||
type
|
||
}
|
||
}
|
||
}
|
||
`;
|
||
|
||
/** 班级学情分析查询 */
|
||
export const ClassAnalyticsQuery = gql`
|
||
query ClassAnalytics($classId: ID!) {
|
||
classAnalytics(classId: $classId) {
|
||
classId
|
||
className
|
||
avgScore
|
||
passRate
|
||
avgTrend
|
||
topStudents {
|
||
studentId
|
||
studentName
|
||
avgScore
|
||
trend
|
||
weakPoints
|
||
strongPoints
|
||
masteryRate
|
||
}
|
||
weakPoints
|
||
}
|
||
}
|
||
`;
|
||
|
||
/** 单生学情分析查询 */
|
||
export const StudentAnalyticsQuery = gql`
|
||
query StudentAnalytics($studentId: ID!) {
|
||
studentAnalytics(studentId: $studentId) {
|
||
studentId
|
||
studentName
|
||
avgScore
|
||
trend
|
||
weakPoints
|
||
strongPoints
|
||
masteryRate
|
||
}
|
||
}
|
||
`;
|