diff --git a/src/api/examples/usage.ts b/src/api/examples/usage.ts index 0363f0d..64dbce6 100644 --- a/src/api/examples/usage.ts +++ b/src/api/examples/usage.ts @@ -93,13 +93,8 @@ export const searchCoursesExample = async () => { try { const response = await CourseApi.searchCourses({ keyword: 'Vue.js', - category: '前端开发', - level: 'intermediate', - price: 'paid', - rating: 4, - sortBy: 'newest', - page: 1, - pageSize: 10 + limit: '20', + page: 1 })  if (response.code === 200) { diff --git a/src/api/modules/course.ts b/src/api/modules/course.ts index 9d3a3e1..e8cdde2 100644 --- a/src/api/modules/course.ts +++ b/src/api/modules/course.ts @@ -23,7 +23,7 @@ import type { CourseComment, Quiz, LearningProgress, - SearchRequest, + Instructor, } from '../types'  diff --git a/src/api/modules/exam.ts b/src/api/modules/exam.ts index 5a1865f..f7be93a 100644 --- a/src/api/modules/exam.ts +++ b/src/api/modules/exam.ts @@ -333,6 +333,420 @@ export class ExamApi { console.log('✅ 批量添加题目答案成功:', responses) return responses } + + // ========== 试卷管理相关接口 ========== + + /** + * 获取试卷列表 + */ + static async getExamPaperList(params: { + page?: number + pageSize?: number + keyword?: string + category?: string + status?: string + difficulty?: string + creator?: string + } = {}): Promise> { + console.log('🚀 获取试卷列表:', params) + const response = await ApiRequest.get<{ + result: { + records: any[] + total: number + current: number + size: number + } + }>('/aiol/aiolPaper/list', { params }) + console.log('✅ 获取试卷列表成功:', response) + return response + } + + /** + * 获取试卷详情 + */ + static async getExamPaperDetail(id: string): Promise> { + console.log('🚀 获取试卷详情:', id) + const response = await ApiRequest.get(`/aiol/aiolExam/paperDetail/${id}`) + console.log('✅ 获取试卷详情成功:', response) + return response + } + + /** + * 创建试卷 + */ + static async createExamPaper(data: { + name: string + category: string + description?: string + totalScore: number + difficulty: string + duration: number + questions: any[] + }): Promise> { + console.log('🚀 创建试卷:', data) + const response = await ApiRequest.post('/aiol/aiolPaper/add', data) + console.log('✅ 创建试卷成功:', response) + return response + } + + /** + * 更新试卷 + */ + static async updateExamPaper(id: string, data: { + name?: string + category?: string + description?: string + totalScore?: number + difficulty?: string + duration?: number + questions?: any[] + }): Promise> { + console.log('🚀 更新试卷:', { id, data }) + const response = await ApiRequest.put(`/aiol/aiolExam/paperUpdate/${id}`, data) + console.log('✅ 更新试卷成功:', response) + return response + } + + /** + * 删除试卷 + */ + static async deleteExamPaper(id: string): Promise> { + console.log('🚀 删除试卷:', id) + const response = await ApiRequest.delete(`/aiol/aiolExam/paperDelete/${id}`) + console.log('✅ 删除试卷成功:', response) + return response + } + + /** + * 批量删除试卷 + */ + static async batchDeleteExamPapers(ids: string[]): Promise> { + console.log('🚀 批量删除试卷:', ids) + const response = await ApiRequest.post('/aiol/aiolExam/paperBatchDelete', { ids }) + console.log('✅ 批量删除试卷成功:', response) + return response + } + + /** + * 发布试卷 + */ + static async publishExamPaper(id: string, data: { + startTime: string + endTime: string + classIds?: string[] + }): Promise> { + console.log('🚀 发布试卷:', { id, data }) + const response = await ApiRequest.post(`/aiol/aiolExam/paperPublish/${id}`, data) + console.log('✅ 发布试卷成功:', response) + return response + } + + /** + * 取消发布试卷 + */ + static async unpublishExamPaper(id: string): Promise> { + console.log('🚀 取消发布试卷:', id) + const response = await ApiRequest.post(`/aiol/aiolExam/paperUnpublish/${id}`) + console.log('✅ 取消发布试卷成功:', response) + return response + } + + /** + * 结束试卷 + */ + static async endExamPaper(id: string): Promise> { + console.log('🚀 结束试卷:', id) + const response = await ApiRequest.post(`/aiol/aiolExam/paperEnd/${id}`) + console.log('✅ 结束试卷成功:', response) + return response + } + + /** + * 导入试卷 + */ + static async importExamPaper(file: File): Promise> { + console.log('🚀 导入试卷:', file.name) + const formData = new FormData() + formData.append('file', file) + const response = await ApiRequest.post('/aiol/aiolExam/paperImport', formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + console.log('✅ 导入试卷成功:', response) + return response + } + + /** + * 导出试卷 + */ + static async exportE