2026-03-12 13:05:20 +08:00
|
|
|
|
import { getApi } from './generated';
|
2026-02-28 16:41:39 +08:00
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
|
// ============= 类型定义(保持向后兼容) =============
|
2026-02-28 16:41:39 +08:00
|
|
|
|
|
|
|
|
|
|
export interface SchoolCourse {
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
tenantId: number;
|
|
|
|
|
|
sourceCourseId: number;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
createdBy: number;
|
|
|
|
|
|
changesSummary?: string;
|
|
|
|
|
|
usageCount: number;
|
|
|
|
|
|
status: string;
|
|
|
|
|
|
createdAt: string;
|
|
|
|
|
|
updatedAt?: string;
|
2026-03-12 13:05:20 +08:00
|
|
|
|
// 保存位置和审核状态
|
|
|
|
|
|
saveLocation?: string;
|
|
|
|
|
|
reviewStatus?: string;
|
|
|
|
|
|
reviewedBy?: number;
|
|
|
|
|
|
reviewedAt?: string;
|
|
|
|
|
|
reviewComment?: string;
|
|
|
|
|
|
// 课程配置字段
|
|
|
|
|
|
themeId?: number;
|
|
|
|
|
|
gradeTags?: string;
|
|
|
|
|
|
domainTags?: string;
|
|
|
|
|
|
duration?: number;
|
|
|
|
|
|
coverImagePath?: string;
|
|
|
|
|
|
coreContent?: string;
|
|
|
|
|
|
introSummary?: string;
|
|
|
|
|
|
introHighlights?: string;
|
|
|
|
|
|
introGoals?: string;
|
|
|
|
|
|
introSchedule?: string;
|
|
|
|
|
|
introKeyPoints?: string;
|
|
|
|
|
|
introMethods?: string;
|
|
|
|
|
|
introEvaluation?: string;
|
|
|
|
|
|
introNotes?: string;
|
|
|
|
|
|
scheduleRefData?: string;
|
|
|
|
|
|
environmentConstruction?: string;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
sourceCourse?: {
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
coverImagePath?: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
};
|
|
|
|
|
|
lessons?: SchoolCourseLesson[];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface SchoolCourseLesson {
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
schoolCourseId: number;
|
|
|
|
|
|
sourceLessonId: number;
|
|
|
|
|
|
lessonType: string;
|
2026-03-12 13:05:20 +08:00
|
|
|
|
// 基本信息字段
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
duration: number;
|
|
|
|
|
|
// 资源文件
|
|
|
|
|
|
videoPath?: string;
|
|
|
|
|
|
videoName?: string;
|
|
|
|
|
|
pptPath?: string;
|
|
|
|
|
|
pptName?: string;
|
|
|
|
|
|
pdfPath?: string;
|
|
|
|
|
|
pdfName?: string;
|
|
|
|
|
|
// 课程配置
|
2026-02-28 16:41:39 +08:00
|
|
|
|
objectives?: string;
|
|
|
|
|
|
preparation?: string;
|
|
|
|
|
|
extension?: string;
|
|
|
|
|
|
reflection?: string;
|
|
|
|
|
|
changeNote?: string;
|
|
|
|
|
|
stepsData?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface SchoolCourseReservation {
|
|
|
|
|
|
id: number;
|
|
|
|
|
|
schoolCourseId: number;
|
|
|
|
|
|
teacherId: number;
|
|
|
|
|
|
classId: number;
|
|
|
|
|
|
scheduledDate: string;
|
|
|
|
|
|
scheduledTime?: string;
|
|
|
|
|
|
status: string;
|
|
|
|
|
|
note?: string;
|
|
|
|
|
|
createdAt: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface CreateSchoolCourseData {
|
|
|
|
|
|
sourceCourseId: number;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
changesSummary?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface UpdateSchoolCourseData {
|
|
|
|
|
|
name?: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
changesSummary?: string;
|
|
|
|
|
|
status?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface CreateReservationData {
|
|
|
|
|
|
teacherId: number;
|
|
|
|
|
|
classId: number;
|
|
|
|
|
|
scheduledDate: string;
|
|
|
|
|
|
scheduledTime?: string;
|
|
|
|
|
|
note?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
|
// ============= API 客户端实例 =============
|
|
|
|
|
|
|
|
|
|
|
|
const api = getApi();
|
|
|
|
|
|
|
2026-02-28 16:41:39 +08:00
|
|
|
|
// ==================== 学校端 API ====================
|
|
|
|
|
|
|
|
|
|
|
|
// 获取校本课程包列表
|
|
|
|
|
|
export function getSchoolCourseList() {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerFindAll() as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取可创建校本课程包的源课程列表
|
|
|
|
|
|
export function getSourceCourses() {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerGetSourceCourses() as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取校本课程包详情
|
|
|
|
|
|
export function getSchoolCourseDetail(id: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerFindOne(id) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建校本课程包
|
|
|
|
|
|
export function createSchoolCourse(data: CreateSchoolCourseData) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerCreate(data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新校本课程包
|
|
|
|
|
|
export function updateSchoolCourse(id: number, data: UpdateSchoolCourseData) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerUpdate(id, data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除校本课程包
|
|
|
|
|
|
export function deleteSchoolCourse(id: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerRemove(id) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取校本课程列表
|
|
|
|
|
|
export function getSchoolCourseLessons(schoolCourseId: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerFindLessons(schoolCourseId) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新校本课程
|
|
|
|
|
|
export function updateSchoolCourseLesson(
|
|
|
|
|
|
schoolCourseId: number,
|
|
|
|
|
|
lessonId: number,
|
|
|
|
|
|
data: Partial<SchoolCourseLesson>,
|
|
|
|
|
|
) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerUpdateLesson(schoolCourseId, lessonId, data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取预约列表
|
|
|
|
|
|
export function getReservations(schoolCourseId: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerFindReservations(schoolCourseId) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建预约
|
|
|
|
|
|
export function createReservation(schoolCourseId: number, data: CreateReservationData) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerCreateReservation(schoolCourseId, data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 取消预约
|
|
|
|
|
|
export function cancelReservation(reservationId: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.schoolCourseControllerCancelReservation(reservationId) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 教师端 API ====================
|
|
|
|
|
|
|
2026-03-12 13:05:20 +08:00
|
|
|
|
// 获取教师端校本课程列表
|
2026-02-28 16:41:39 +08:00
|
|
|
|
export function getTeacherSchoolCourseList() {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerFindAll() as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取教师端可创建校本课程包的源课程列表
|
|
|
|
|
|
export function getTeacherSourceCourses() {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerGetSourceCourses() as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取教师端校本课程包详情
|
|
|
|
|
|
export function getTeacherSchoolCourseDetail(id: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerFindOne(id) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建教师端校本课程包
|
|
|
|
|
|
export function createTeacherSchoolCourse(data: CreateSchoolCourseData) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerCreate(data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新教师端校本课程包
|
|
|
|
|
|
export function updateTeacherSchoolCourse(id: number, data: UpdateSchoolCourseData) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerUpdate(id, data) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除教师端校本课程包
|
|
|
|
|
|
export function deleteTeacherSchoolCourse(id: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerRemove(id) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取教师端校本课程列表
|
|
|
|
|
|
export function getTeacherSchoolCourseLessons(schoolCourseId: number) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerFindLessons(schoolCourseId) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新教师端校本课程
|
|
|
|
|
|
export function updateTeacherSchoolCourseLesson(
|
|
|
|
|
|
schoolCourseId: number,
|
|
|
|
|
|
lessonId: number,
|
|
|
|
|
|
data: Partial<SchoolCourseLesson>,
|
|
|
|
|
|
) {
|
2026-03-12 13:05:20 +08:00
|
|
|
|
return api.teacherSchoolCourseControllerUpdateLesson(schoolCourseId, lessonId, data) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 新增:完整数据API ====================
|
|
|
|
|
|
|
|
|
|
|
|
// 从源课程包创建校本课程包
|
|
|
|
|
|
export function createSchoolCourseFromSource(sourceCourseId: number, saveLocation: 'PERSONAL' | 'SCHOOL') {
|
|
|
|
|
|
return api.schoolCourseControllerCreateFromSource({ sourceCourseId, saveLocation }) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function createTeacherSchoolCourseFromSource(sourceCourseId: number, saveLocation: 'PERSONAL' | 'SCHOOL') {
|
|
|
|
|
|
return api.teacherSchoolCourseControllerCreateFromSource({ sourceCourseId, saveLocation }) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取校本课程包完整详情(含课程配置)
|
|
|
|
|
|
export function getSchoolCourseFullDetail(id: number) {
|
|
|
|
|
|
return api.schoolCourseControllerGetFullDetail(id) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function getTeacherSchoolCourseFullDetail(id: number) {
|
|
|
|
|
|
return api.teacherSchoolCourseControllerGetFullDetail(id) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新校本课程包完整数据
|
|
|
|
|
|
export function updateSchoolCourseFull(id: number, data: any) {
|
|
|
|
|
|
return api.schoolCourseControllerUpdateFull(id, data) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function updateTeacherSchoolCourseFull(id: number, data: any) {
|
|
|
|
|
|
return api.teacherSchoolCourseControllerUpdateFull(id, data) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 审核API(仅学校端)====================
|
|
|
|
|
|
|
|
|
|
|
|
// 审核通过
|
|
|
|
|
|
export function approveSchoolCourse(id: number, comment?: string) {
|
|
|
|
|
|
return api.schoolCourseControllerApprove(id, { comment }) as any;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 审核驳回
|
|
|
|
|
|
export function rejectSchoolCourse(id: number, comment: string) {
|
|
|
|
|
|
return api.schoolCourseControllerReject(id, { comment }) as any;
|
2026-02-28 16:41:39 +08:00
|
|
|
|
}
|