2026-03-12 13:05:20 +08:00
|
|
|
import { getApi } from './generated';
|
|
|
|
|
import type {
|
|
|
|
|
TeacherCourseControllerFindAllParams,
|
|
|
|
|
TeacherCourseControllerGetAllStudentsParams,
|
|
|
|
|
TeacherCourseControllerGetClassStudentsParams,
|
|
|
|
|
TeacherCourseControllerGetLessonTrendParams,
|
|
|
|
|
TeacherCourseControllerGetTeacherSchedulesParams,
|
|
|
|
|
TeacherCourseControllerGetTeacherTimetableParams,
|
|
|
|
|
TeacherFeedbackControllerFindAllParams,
|
|
|
|
|
TeacherTaskControllerGetMonthlyStatsParams,
|
|
|
|
|
LessonControllerFindAllParams,
|
|
|
|
|
} from './generated/model';
|
|
|
|
|
|
|
|
|
|
// ============= API 客户端实例 =============
|
|
|
|
|
const api = getApi();
|
|
|
|
|
|
|
|
|
|
// ============= 类型定义(保持向后兼容) =============
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 教师课程 API ====================
|
|
|
|
|
|
|
|
|
|
export interface TeacherCourseQueryParams {
|
|
|
|
|
page?: number;
|
|
|
|
|
pageSize?: number;
|
|
|
|
|
grade?: string;
|
|
|
|
|
keyword?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TeacherCourse {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
pictureBookName?: string;
|
|
|
|
|
coverImagePath?: string;
|
|
|
|
|
gradeTags: string[];
|
|
|
|
|
domainTags: string[];
|
|
|
|
|
duration: number;
|
|
|
|
|
avgRating: number;
|
|
|
|
|
usageCount: number;
|
|
|
|
|
publishedAt: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 教师班级信息(更新:新增角色字段)
|
|
|
|
|
export interface TeacherClass {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
grade: string;
|
|
|
|
|
studentCount: number;
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
myRole: 'MAIN' | 'ASSIST' | 'CARE'; // 我在该班级的角色
|
|
|
|
|
isPrimary: boolean; // 是否班主任
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 班级教师信息
|
|
|
|
|
export interface TeacherClassTeacher {
|
|
|
|
|
teacherId: number;
|
|
|
|
|
teacherName: string;
|
|
|
|
|
teacherPhone?: string;
|
|
|
|
|
role: 'MAIN' | 'ASSIST' | 'CARE';
|
|
|
|
|
isPrimary: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取教师可用的课程列表
|
|
|
|
|
export function getTeacherCourses(params: TeacherCourseQueryParams): Promise<{
|
|
|
|
|
items: TeacherCourse[];
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
const findAllParams: TeacherCourseControllerFindAllParams = {
|
|
|
|
|
page: params.page,
|
|
|
|
|
pageSize: params.pageSize,
|
|
|
|
|
grade: params.grade,
|
|
|
|
|
keyword: params.keyword,
|
|
|
|
|
};
|
|
|
|
|
return api.teacherCourseControllerFindAll(findAllParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取课程详情
|
|
|
|
|
export function getTeacherCourse(id: number): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherCourseControllerFindOne(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取教师的班级列表
|
|
|
|
|
export function getTeacherClasses(): Promise<TeacherClass[]> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherCourseControllerGetClasses() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取教师所有学生列表(跨班级)
|
|
|
|
|
export function getTeacherStudents(params?: { page?: number; pageSize?: number; keyword?: string }): Promise<{
|
|
|
|
|
items: Array<{
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
gender?: string;
|
|
|
|
|
birthDate?: string;
|
|
|
|
|
classId: number;
|
|
|
|
|
class?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
grade: string;
|
|
|
|
|
};
|
|
|
|
|
parentName?: string;
|
|
|
|
|
parentPhone?: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
}>;
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
const findAllParams: TeacherCourseControllerGetAllStudentsParams = {
|
|
|
|
|
page: params?.page,
|
|
|
|
|
pageSize: params?.pageSize,
|
|
|
|
|
keyword: params?.keyword,
|
|
|
|
|
};
|
|
|
|
|
return api.teacherCourseControllerGetAllStudents(findAllParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取班级学生列表
|
|
|
|
|
export function getTeacherClassStudents(classId: number, params?: { page?: number; pageSize?: number; keyword?: string }): Promise<{
|
|
|
|
|
items: Array<{
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
gender?: string;
|
|
|
|
|
birthDate?: string;
|
|
|
|
|
parentName?: string;
|
|
|
|
|
parentPhone?: string;
|
|
|
|
|
lessonCount?: number;
|
|
|
|
|
readingCount?: number;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
}>;
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
class?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
grade: string;
|
|
|
|
|
studentCount: number;
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
};
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
const classStudentsParams: TeacherCourseControllerGetClassStudentsParams = {
|
|
|
|
|
page: params?.page,
|
|
|
|
|
pageSize: params?.pageSize,
|
|
|
|
|
keyword: params?.keyword,
|
|
|
|
|
};
|
|
|
|
|
return api.teacherCourseControllerGetClassStudents(String(classId), classStudentsParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取班级教师列表
|
|
|
|
|
export function getClassTeachers(classId: number): Promise<TeacherClassTeacher[]> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherCourseControllerGetClassTeachers(String(classId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== 授课记录 API ====================
|
|
|
|
|
|
|
|
|
|
export interface CreateLessonDto {
|
|
|
|
|
courseId: number;
|
|
|
|
|
classId: number;
|
|
|
|
|
plannedDatetime?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface FinishLessonDto {
|
|
|
|
|
overallRating?: string;
|
|
|
|
|
participationRating?: string;
|
|
|
|
|
completionNote?: string;
|
|
|
|
|
actualDuration?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface StudentRecordDto {
|
|
|
|
|
focus?: number;
|
|
|
|
|
participation?: number;
|
|
|
|
|
interest?: number;
|
|
|
|
|
understanding?: number;
|
|
|
|
|
notes?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取授课记录列表
|
|
|
|
|
export function getLessons(params?: {
|
|
|
|
|
page?: number;
|
|
|
|
|
pageSize?: number;
|
|
|
|
|
status?: string;
|
|
|
|
|
courseId?: number;
|
|
|
|
|
}): Promise<{
|
|
|
|
|
items: any[];
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
const lessonParams: LessonControllerFindAllParams = {
|
|
|
|
|
page: params?.page,
|
|
|
|
|
pageSize: params?.pageSize,
|
|
|
|
|
status: params?.status,
|
|
|
|
|
courseId: params?.courseId,
|
|
|
|
|
};
|
|
|
|
|
return api.lessonControllerFindAll(lessonParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取单个授课记录详情
|
|
|
|
|
export function getLesson(id: number): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerFindOne(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 创建授课记录(备课)
|
|
|
|
|
export function createLesson(data: CreateLessonDto): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerCreate(data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 开始上课
|
|
|
|
|
export function startLesson(id: number): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerStart(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 结束上课
|
|
|
|
|
export function finishLesson(id: number, data: FinishLessonDto): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerFinish(String(id), data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 取消课程
|
|
|
|
|
export function cancelLesson(id: number): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerCancel(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存学生评价记录
|
|
|
|
|
export function saveStudentRecord(
|
|
|
|
|
lessonId: number,
|
|
|
|
|
studentId: number,
|
|
|
|
|
data: StudentRecordDto
|
|
|
|
|
): Promise<any> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerSaveStudentRecord(String(lessonId), String(studentId), data) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取课程所有学生记录
|
|
|
|
|
export interface StudentWithRecord {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
gender?: string;
|
|
|
|
|
record: {
|
|
|
|
|
id: number;
|
|
|
|
|
focus?: number;
|
|
|
|
|
participation?: number;
|
|
|
|
|
interest?: number;
|
|
|
|
|
understanding?: number;
|
|
|
|
|
notes?: string;
|
|
|
|
|
} | null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface StudentRecordsResponse {
|
|
|
|
|
lesson: {
|
|
|
|
|
id: number;
|
|
|
|
|
status: string;
|
|
|
|
|
className: string;
|
|
|
|
|
};
|
|
|
|
|
students: StudentWithRecord[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getStudentRecords(lessonId: number): Promise<StudentRecordsResponse> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerGetStudentRecords(String(lessonId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 批量保存学生评价记录
|
|
|
|
|
export function batchSaveStudentRecords(
|
|
|
|
|
lessonId: number,
|
|
|
|
|
records: Array<{ studentId: number } & StudentRecordDto>
|
|
|
|
|
): Promise<{ count: number; records: any[] }> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerBatchSaveStudentRecords(String(lessonId), { records: records as any }) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== 教师首页 API ====================
|
|
|
|
|
|
|
|
|
|
export interface DashboardData {
|
|
|
|
|
stats: {
|
|
|
|
|
classCount: number;
|
|
|
|
|
studentCount: number;
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
courseCount: number;
|
|
|
|
|
};
|
|
|
|
|
todayLessons: Array<{
|
|
|
|
|
id: number;
|
|
|
|
|
courseId: number;
|
|
|
|
|
courseName: string;
|
|
|
|
|
pictureBookName?: string;
|
|
|
|
|
classId: number;
|
|
|
|
|
className: string;
|
|
|
|
|
plannedDatetime: string;
|
|
|
|
|
status: string;
|
|
|
|
|
duration: number;
|
|
|
|
|
}>;
|
|
|
|
|
recommendedCourses: Array<{
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
pictureBookName?: string;
|
|
|
|
|
coverImagePath?: string;
|
|
|
|
|
duration: number;
|
|
|
|
|
usageCount: number;
|
|
|
|
|
avgRating: number;
|
|
|
|
|
gradeTags: string[];
|
|
|
|
|
}>;
|
|
|
|
|
weeklyStats: {
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
studentParticipation: number;
|
|
|
|
|
avgRating: number;
|
|
|
|
|
totalDuration: number;
|
|
|
|
|
};
|
|
|
|
|
recentActivities: Array<{
|
|
|
|
|
id: number;
|
|
|
|
|
type: string;
|
|
|
|
|
description: string;
|
|
|
|
|
time: string;
|
|
|
|
|
}>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getTeacherDashboard = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetDashboard() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTodayLessons = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetTodayLessons() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getRecommendedCourses = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetRecommendedCourses() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getWeeklyStats = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetWeeklyStats() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 教师统计趋势 ====================
|
|
|
|
|
|
|
|
|
|
export interface TeacherLessonTrendItem {
|
|
|
|
|
month: string;
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
avgRating: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TeacherCourseUsageItem {
|
|
|
|
|
name: string;
|
|
|
|
|
value: number;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getTeacherLessonTrend = (months?: number) => {
|
|
|
|
|
const params: TeacherCourseControllerGetLessonTrendParams = { months };
|
|
|
|
|
return api.teacherCourseControllerGetLessonTrend(params) as any;
|
|
|
|
|
};
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTeacherCourseUsage = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetCourseUsage() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 课程反馈 API ====================
|
|
|
|
|
|
|
|
|
|
export interface FeedbackDto {
|
|
|
|
|
designQuality?: number;
|
|
|
|
|
participation?: number;
|
|
|
|
|
goalAchievement?: number;
|
|
|
|
|
stepFeedbacks?: any;
|
|
|
|
|
pros?: string;
|
|
|
|
|
suggestions?: string;
|
|
|
|
|
activitiesDone?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface LessonFeedback {
|
|
|
|
|
id: number;
|
|
|
|
|
lessonId: number;
|
|
|
|
|
teacherId: number;
|
|
|
|
|
designQuality?: number;
|
|
|
|
|
participation?: number;
|
|
|
|
|
goalAchievement?: number;
|
|
|
|
|
stepFeedbacks?: any;
|
|
|
|
|
pros?: string;
|
|
|
|
|
suggestions?: string;
|
|
|
|
|
activitiesDone?: any;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
teacher?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
lesson?: {
|
|
|
|
|
id: number;
|
|
|
|
|
startDatetime?: string;
|
|
|
|
|
course: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
pictureBookName?: string;
|
|
|
|
|
};
|
|
|
|
|
class: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 提交课程反馈
|
|
|
|
|
export function submitFeedback(lessonId: number, data: FeedbackDto): Promise<LessonFeedback> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerSubmitFeedback(String(lessonId), data) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取课程反馈
|
|
|
|
|
export function getFeedback(lessonId: number): Promise<LessonFeedback | null> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.lessonControllerGetFeedback(String(lessonId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== 学校端反馈 API ====================
|
|
|
|
|
|
|
|
|
|
export interface FeedbackQueryParams {
|
|
|
|
|
page?: number;
|
|
|
|
|
pageSize?: number;
|
|
|
|
|
teacherId?: number;
|
|
|
|
|
courseId?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface FeedbackStats {
|
|
|
|
|
totalFeedbacks: number;
|
|
|
|
|
avgDesignQuality: number;
|
|
|
|
|
avgParticipation: number;
|
|
|
|
|
avgGoalAchievement: number;
|
|
|
|
|
courseStats: Record<number, { count: number; avgRating: number }>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取学校端反馈列表
|
|
|
|
|
export function getSchoolFeedbacks(params: FeedbackQueryParams): Promise<{
|
|
|
|
|
items: LessonFeedback[];
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
// Note: This might be in school controller, check backend
|
|
|
|
|
return api.teacherFeedbackControllerFindAll({
|
|
|
|
|
page: params.page,
|
|
|
|
|
pageSize: params.pageSize,
|
|
|
|
|
teacherId: params.teacherId,
|
|
|
|
|
courseId: params.courseId,
|
|
|
|
|
} as TeacherFeedbackControllerFindAllParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取反馈统计
|
|
|
|
|
export function getFeedbackStats(): Promise<FeedbackStats> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherFeedbackControllerGetStats() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取教师自己的反馈列表
|
|
|
|
|
export function getTeacherFeedbacks(params: FeedbackQueryParams): Promise<{
|
|
|
|
|
items: LessonFeedback[];
|
|
|
|
|
total: number;
|
|
|
|
|
page: number;
|
|
|
|
|
pageSize: number;
|
|
|
|
|
}> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherFeedbackControllerFindAll({
|
|
|
|
|
page: params.page,
|
|
|
|
|
pageSize: params.pageSize,
|
|
|
|
|
teacherId: params.teacherId,
|
|
|
|
|
courseId: params.courseId,
|
|
|
|
|
} as TeacherFeedbackControllerFindAllParams) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取教师自己的反馈统计
|
|
|
|
|
export function getTeacherFeedbackStats(): Promise<FeedbackStats> {
|
2026-03-12 13:05:20 +08:00
|
|
|
return api.teacherFeedbackControllerGetStats() as any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== 课程进度追踪 API ====================
|
|
|
|
|
|
|
|
|
|
export interface LessonProgress {
|
|
|
|
|
id: number;
|
|
|
|
|
lessonIds: number[];
|
|
|
|
|
completedLessonIds: number[];
|
|
|
|
|
currentLessonId?: number;
|
|
|
|
|
currentStepId?: number;
|
|
|
|
|
progressData: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SaveLessonProgressDto {
|
|
|
|
|
lessonIds?: number[];
|
|
|
|
|
completedLessonIds?: number[];
|
|
|
|
|
currentLessonId?: number;
|
|
|
|
|
currentStepId?: number;
|
|
|
|
|
progressData?: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存课程进度
|
|
|
|
|
export function saveLessonProgress(lessonId: number, data: SaveLessonProgressDto): Promise<LessonProgress> {
|
|
|
|
|
const progressData = {
|
|
|
|
|
...data,
|
|
|
|
|
lessonIds: data.lessonIds?.map(String),
|
|
|
|
|
completedLessonIds: data.completedLessonIds?.map(String),
|
|
|
|
|
currentLessonId: data.currentLessonId?.toString(),
|
|
|
|
|
currentStepId: data.currentStepId?.toString(),
|
|
|
|
|
};
|
|
|
|
|
return api.lessonControllerSaveProgress(String(lessonId), progressData as any) as any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取课程进度
|
|
|
|
|
export function getLessonProgress(lessonId: number): Promise<LessonProgress> {
|
|
|
|
|
return api.lessonControllerGetProgress(String(lessonId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ==================== 排课管理 API ====================
|
|
|
|
|
|
|
|
|
|
export interface TeacherSchedule {
|
|
|
|
|
id: number;
|
|
|
|
|
classId: number;
|
|
|
|
|
className: string;
|
|
|
|
|
courseId: number;
|
|
|
|
|
courseName: string;
|
|
|
|
|
teacherId?: number;
|
|
|
|
|
scheduledDate?: string;
|
|
|
|
|
scheduledTime?: string;
|
|
|
|
|
weekDay?: number;
|
|
|
|
|
repeatType: 'NONE' | 'DAILY' | 'WEEKLY';
|
|
|
|
|
source: 'SCHOOL' | 'TEACHER';
|
|
|
|
|
status: 'ACTIVE' | 'CANCELLED';
|
|
|
|
|
note?: string;
|
|
|
|
|
hasLesson: boolean;
|
|
|
|
|
lessonId?: number;
|
|
|
|
|
lessonStatus?: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CreateTeacherScheduleDto {
|
|
|
|
|
classId: number;
|
|
|
|
|
courseId: number;
|
|
|
|
|
scheduledDate?: string;
|
|
|
|
|
scheduledTime?: string;
|
|
|
|
|
weekDay?: number;
|
|
|
|
|
repeatType?: 'NONE' | 'DAILY' | 'WEEKLY';
|
|
|
|
|
repeatEndDate?: string;
|
|
|
|
|
note?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TeacherTimetableItem {
|
|
|
|
|
date: string;
|
|
|
|
|
weekDay: number;
|
|
|
|
|
schedules: TeacherSchedule[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getTeacherSchedules = (params?: {
|
|
|
|
|
startDate?: string;
|
|
|
|
|
endDate?: string;
|
|
|
|
|
status?: string;
|
|
|
|
|
page?: number;
|
|
|
|
|
pageSize?: number;
|
2026-03-12 13:05:20 +08:00
|
|
|
}) => {
|
|
|
|
|
const scheduleParams: TeacherCourseControllerGetTeacherSchedulesParams = {
|
|
|
|
|
startDate: params?.startDate,
|
|
|
|
|
endDate: params?.endDate,
|
|
|
|
|
};
|
|
|
|
|
return api.teacherCourseControllerGetTeacherSchedules(scheduleParams) as any;
|
|
|
|
|
};
|
2026-02-26 15:22:26 +08:00
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getTeacherTimetable = (params: { startDate: string; endDate: string }) => {
|
|
|
|
|
const timetableParams: TeacherCourseControllerGetTeacherTimetableParams = {
|
|
|
|
|
startDate: params.startDate,
|
|
|
|
|
endDate: params.endDate,
|
|
|
|
|
};
|
|
|
|
|
return api.teacherCourseControllerGetTeacherTimetable(timetableParams) as any;
|
|
|
|
|
};
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTodayTeacherSchedules = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerGetTodaySchedules() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const createTeacherSchedule = (data: CreateTeacherScheduleDto) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerCreateTeacherSchedule(data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const updateTeacherSchedule = (id: number, data: Partial<CreateTeacherScheduleDto> & { status?: string }) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerUpdateTeacherSchedule(String(id), data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const cancelTeacherSchedule = (id: number) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherCourseControllerCancelTeacherSchedule(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 阅读任务 API ====================
|
|
|
|
|
|
|
|
|
|
export interface TeacherTask {
|
|
|
|
|
id: number;
|
|
|
|
|
tenantId: number;
|
|
|
|
|
title: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
taskType: 'READING' | 'ACTIVITY' | 'HOMEWORK';
|
|
|
|
|
targetType: 'CLASS' | 'STUDENT';
|
|
|
|
|
status: 'DRAFT' | 'PUBLISHED' | 'ARCHIVED';
|
|
|
|
|
relatedCourseId?: number;
|
|
|
|
|
startDate: string;
|
|
|
|
|
endDate: string;
|
|
|
|
|
createdBy: number;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
course?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
targetCount?: number;
|
|
|
|
|
completionCount?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TaskCompletion {
|
|
|
|
|
id: number;
|
|
|
|
|
taskId: number;
|
|
|
|
|
studentId: number;
|
|
|
|
|
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED';
|
|
|
|
|
completedAt?: string;
|
|
|
|
|
feedback?: string;
|
|
|
|
|
parentFeedback?: string;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
student: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
gender?: string;
|
|
|
|
|
class?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CreateTeacherTaskDto {
|
|
|
|
|
title: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
taskType: 'READING' | 'ACTIVITY' | 'HOMEWORK';
|
|
|
|
|
targetType: 'CLASS' | 'STUDENT';
|
|
|
|
|
targetIds: number[];
|
|
|
|
|
relatedCourseId?: number;
|
|
|
|
|
startDate: string;
|
|
|
|
|
endDate: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface UpdateTaskCompletionDto {
|
|
|
|
|
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED';
|
|
|
|
|
feedback?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getTeacherTasks = () =>
|
|
|
|
|
api.teacherTaskControllerFindAll() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTeacherTask = (id: number) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerFindOne(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getTeacherTaskCompletions = (taskId: number) =>
|
|
|
|
|
api.teacherTaskControllerGetCompletions(String(taskId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const createTeacherTask = (data: CreateTeacherTaskDto) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerCreate(data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const updateTeacherTask = (id: number, data: Partial<CreateTeacherTaskDto> & { status?: string }) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerUpdate(String(id), data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const deleteTeacherTask = (id: number) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerDelete(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const updateTaskCompletion = (taskId: number, studentId: number, data: UpdateTaskCompletionDto) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerUpdateCompletion(String(taskId), String(studentId), data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const sendTaskReminder = (taskId: number) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerSendReminder(String(taskId)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 任务模板 API ====================
|
|
|
|
|
|
|
|
|
|
export interface TaskTemplate {
|
|
|
|
|
id: number;
|
|
|
|
|
tenantId: number;
|
|
|
|
|
name: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
taskType: 'READING' | 'ACTIVITY' | 'HOMEWORK';
|
|
|
|
|
relatedCourseId?: number;
|
|
|
|
|
defaultDuration: number;
|
|
|
|
|
isDefault: boolean;
|
|
|
|
|
status: string;
|
|
|
|
|
createdBy: number;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
course?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
pictureBookName?: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CreateTaskTemplateDto {
|
|
|
|
|
name: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
taskType: 'READING' | 'ACTIVITY' | 'HOMEWORK';
|
|
|
|
|
relatedCourseId?: number;
|
|
|
|
|
defaultDuration?: number;
|
|
|
|
|
isDefault?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface CreateTaskFromTemplateDto {
|
|
|
|
|
templateId: number;
|
|
|
|
|
targetIds: number[];
|
|
|
|
|
targetType: 'CLASS' | 'STUDENT';
|
|
|
|
|
startDate?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getTaskTemplates = () =>
|
|
|
|
|
api.teacherTaskControllerFindAllTemplates() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTaskTemplate = (id: number) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerFindOneTemplate(String(id)) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getDefaultTaskTemplate = (taskType: string) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerGetDefaultTemplate(taskType) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const createTaskFromTemplate = (data: CreateTaskFromTemplateDto) =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerCreateFromTemplate(data as any) as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
// ==================== 任务统计 API ====================
|
|
|
|
|
|
|
|
|
|
export interface TaskStats {
|
|
|
|
|
totalTasks: number;
|
|
|
|
|
publishedTasks: number;
|
|
|
|
|
completedTasks: number;
|
|
|
|
|
inProgressTasks: number;
|
|
|
|
|
pendingCount: number;
|
|
|
|
|
totalCompletions: number;
|
|
|
|
|
completionRate: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TaskStatsByType {
|
|
|
|
|
[key: string]: {
|
|
|
|
|
total: number;
|
|
|
|
|
completed: number;
|
|
|
|
|
rate: number;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface TaskStatsByClass {
|
|
|
|
|
classId: number;
|
|
|
|
|
className: string;
|
|
|
|
|
grade: string;
|
|
|
|
|
total: number;
|
|
|
|
|
completed: number;
|
|
|
|
|
rate: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface MonthlyTaskStats {
|
|
|
|
|
month: string;
|
|
|
|
|
tasks: number;
|
|
|
|
|
completions: number;
|
|
|
|
|
completed: number;
|
|
|
|
|
rate: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getTaskStats = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerGetStats() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTaskStatsByType = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerGetStatsByType() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
|
|
|
|
export const getTaskStatsByClass = () =>
|
2026-03-12 13:05:20 +08:00
|
|
|
api.teacherTaskControllerGetStatsByClass() as any;
|
2026-02-26 15:22:26 +08:00
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
export const getMonthlyTaskStats = (months?: number) => {
|
|
|
|
|
const params: TeacherTaskControllerGetMonthlyStatsParams = { months: String(months ?? 6) };
|
|
|
|
|
return api.teacherTaskControllerGetMonthlyStats(params) as any;
|
|
|
|
|
};
|