diff --git a/src/api/modules/chat.ts b/src/api/modules/chat.ts index 8a09d42..e01d0e2 100644 --- a/src/api/modules/chat.ts +++ b/src/api/modules/chat.ts @@ -277,6 +277,15 @@ export const ChatApi = { return ApiRequest.post(`/aiol/aiolChat/${chatId}/update_last_read/${messageId}`) }, + /** + * 退出群聊 + * DELETE /aiol/aiolChat/{chatId}/exit + * 退出指定的群聊会话 + */ + exitChat: (chatId: string): Promise> => { + return ApiRequest.delete(`/aiol/aiolChat/${chatId}/exit`) + }, + /** * 通用文件上传 * POST /sys/common/upload diff --git a/src/api/modules/comment.ts b/src/api/modules/comment.ts index 355ee33..cc06670 100644 --- a/src/api/modules/comment.ts +++ b/src/api/modules/comment.ts @@ -11,13 +11,28 @@ import type { */ export class CommentApi { // 获取课程评论 - static getCourseComments(courseId: number, params?: { + static async getCourseComments(courseId: number, params?: { page?: number pageSize?: number sortBy?: 'newest' | 'oldest' | 'rating' | 'helpful' rating?: number - }): Promise>> { - return ApiRequest.get(`/courses/${courseId}/comments`, params) + }): Promise> { + try { + console.log('🚀 获取课程评论:', { courseId, params }) + + // 使用正确的API路径 - 根据用户提供的接口 + const response = await ApiRequest.get(`/aiol/aiolComment/course/${courseId}/list`, { + pageNo: params?.page || 1, + pageSize: params?.pageSize || 20, + ...params + }) + + console.log('✅ 获取课程评论成功:', response) + return response + } catch (error) { + console.error('❌ 获取课程评论失败:', error) + throw error + } } // 获取课时评论 @@ -48,12 +63,54 @@ export class CommentApi { } // 添加课程评论 - static addCourseComment(courseId: number, data: { + static async addCourseComment(courseId: number, data: { content: string rating?: number parentId?: number - }): Promise> { - return ApiRequest.post(`/courses/${courseId}/comments`, data) + }): Promise> { + try { + console.log('🚀 添加课程评论:', { courseId, data }) + + // 使用正确的API路径 + const response = await ApiRequest.post(`/aiol/aiolComment/course/${courseId}/add`, { + content: data.content, + imgs: '', + parentId: data.parentId + }) + + console.log('✅ 添加课程评论成功:', response) + return response + } catch (error) { + console.error('❌ 添加课程评论失败:', error) + throw error + } + } + + // 回复评论 - 使用专门的回复接口 + static async replyComment(data: { + content: string + targetType: 'course' | 'lesson' | 'comment' + targetId: string + parentId?: number + }): Promise> { + try { + console.log('🚀 回复评论:', data) + + // 使用专门的回复接口 + const response = await ApiRequest.post(`/aiol/aiolComment/add`, { + content: data.content, + targetType: data.targetType, + targetId: data.targetId, + parentId: data.parentId, + imgs: '' + }) + + console.log('✅ 回复评论成功:', response) + return response + } catch (error) { + console.error('❌ 回复评论失败:', error) + throw error + } } // 添加课时评论 @@ -78,11 +135,16 @@ export class CommentApi { } // 点赞评论 - static likeComment(commentId: number): Promise> { - return ApiRequest.post(`/comments/${commentId}/like`) + static async likeComment(commentId: string | number): Promise> { + try { + console.log('🚀 点赞评论:', commentId) + const response = await ApiRequest.get(`/aiol/aiolComment/like/${commentId}`) + console.log('✅ 点赞评论成功:', response) + return response + } catch (error) { + console.error('❌ 点赞评论失败:', error) + throw error + } } // 取消点赞评论 @@ -211,6 +273,6 @@ export class CommentApi { }>>> { return ApiRequest.get('/comments/reported', params) } -} +}export default CommentApi + -export default CommentApi diff --git a/src/api/modules/course.ts b/src/api/modules/course.ts index e03ef60..3eef8f7 100644 --- a/src/api/modules/course.ts +++ b/src/api/modules/course.ts @@ -157,7 +157,9 @@ export class CourseApi { question: item.question || '', video: item.video || '', // 添加AI伴学模式字段 - izAi: item.izAi + izAi: item.izAi, + // 添加学期字段 + semester: item.semester || '' })) return { @@ -217,6 +219,8 @@ export class CourseApi { } // 转换后端数据格式为前端格式 const item: BackendCourseItem = response.data.result + console.log('🔍 后端原始课程数据:', item) + console.log('📅 后端学期字段:', item.semester) const course: Course = { id: item.id, // 保持字符串格式,不转换为数字 title: item.name || '', @@ -259,7 +263,9 @@ export class CourseApi { createdAt: this.formatTimestamp(item.createTime), updatedAt: this.formatTimestamp(item.updateTime), // 添加AI伴学模式字段 - izAi: item.izAi + izAi: item.izAi, + // 添加学期字段 + semester: item.semester || '' } as any return { @@ -403,6 +409,8 @@ export class CourseApi { } // 转换后端数据格式为前端格式 const item: BackendCourseItem = response.data.result + console.log('🔍 后端原始课程数据:', item) + console.log('📅 后端学期字段:', item.semester) const course: Course = { id: item.id, // 保持字符串格式,不转换为数字 title: item.name || '', @@ -445,7 +453,9 @@ export class CourseApi { createdAt: this.formatTimestamp(item.createTime), updatedAt: this.formatTimestamp(item.updateTime), // 添加AI伴学模式字段 - izAi: item.izAi + izAi: item.izAi, + // 添加学期字段 + semester: item.semester || '' } as any return { diff --git a/src/api/types.ts b/src/api/types.ts index 2b267fd..d29d6cc 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -165,6 +165,7 @@ export interface Course { createdAt: string updatedAt: string publishedAt?: string + semester?: string // 新增学期字段 } // 后端实际返回的课程数据格式 @@ -333,6 +334,7 @@ export interface BackendCourseItem { updateBy: string updateTime: string teacherList: BackendInstructor[] // 新增讲师列表字段 + semester?: string // 新增学期字段 } // 后端课程列表响应格式 diff --git a/src/components/teacher/CourseContentManagement.vue b/src/components/teacher/CourseContentManagement.vue index 41c34ca..28384e0 100644 --- a/src/components/teacher/CourseContentManagement.vue +++ b/src/components/teacher/CourseContentManagement.vue @@ -2,43 +2,40 @@
- - + + + + 添加总结 - - + + 搜索 + + 清空 + + + 刷新 +
- +
- + @@ -46,12 +43,7 @@ - +