From 3e1f1fdc6742b9a878479ff4fefe4e444277746f Mon Sep 17 00:00:00 2001 From: yuk255 Date: Mon, 22 Sep 2025 14:07:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=AF=BE=E7=A8=8B=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=B8=8B=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/teachCourse.ts | 447 +++++++ src/components/CustomDropdown.vue | 2 +- src/components/DiscussionLibraryModal.vue | 605 +++++++++ src/components/ExamPaperLibraryModal.vue | 191 ++- src/components/HomeworkLibraryModal.vue | 452 ++++--- src/components/ResourceLibraryModal.vue | 623 +++++++-- src/router/index.ts | 7 + src/views/teacher/course/AddDiscussion.vue | 336 ++--- src/views/teacher/course/AddHomework.vue | 649 +++++---- src/views/teacher/course/ChapterEditor.vue | 1060 +++++++++++++-- .../teacher/course/ChapterManagement.vue | 22 +- .../teacher/course/CoursewareManagement.vue | 14 +- .../teacher/course/DiscussionManagement.vue | 302 +++-- .../course/DiscussionRepliesManagement.vue | 1179 +++++++++++++++++ src/views/teacher/course/HomeworkLibrary.vue | 411 +++--- src/views/teacher/course/HomeworkReview.vue | 25 - 16 files changed, 5098 insertions(+), 1227 deletions(-) create mode 100644 src/components/DiscussionLibraryModal.vue create mode 100644 src/views/teacher/course/DiscussionRepliesManagement.vue diff --git a/src/api/modules/teachCourse.ts b/src/api/modules/teachCourse.ts index 1d8ab5c..0f2f2bb 100644 --- a/src/api/modules/teachCourse.ts +++ b/src/api/modules/teachCourse.ts @@ -367,6 +367,19 @@ export class TeachCourseApi { } } + /** + * 章节绑定考试-考试列表查询 + */ + static async getExamsList(params: { type: '0' | '1'; examName?: string; }): Promise> { + try { + const response = await ApiRequest.get(`/aiol/aiolExam/queryExamList`, params) + return response + } catch (error) { + console.error('❌ 章节绑定考试-考试列表查询失败:', error) + throw error + } + } + /** * 删除课程章节 */ @@ -494,8 +507,208 @@ export class TeachCourseApi { } } +// 作业相关类型定义 +export interface Homework { + id?: string + title?: string | null + description?: string | null + attachment?: string | null + max_score?: number | null + pass_score?: number | null + start_time?: string | null + end_time?: string | null + status?: number | null + allow_makeup?: string // 是否允许补交 0不允许 1允许 + makeup_time?: string // 补交截止时间 + notify_time?: string // 作业通知时间 + classId?: string // 班级id,多个用逗号分割 + sectionId?: string // 章节id + courseId?: string // 课程id,必填 +} + +// 新建作业请求参数 +export interface CreateHomeworkRequest { + title?: string | null + description?: string | null + attachment?: string | null + maxScore?: number | null + passScore?: number | null + startTime?: string | null + endTime?: string | null + allowMakeup: string // 是否允许补交 0不允许 1允许 (必填) + makeupTime: string // 补交截止时间 (必填) + notifyTime: number // 作业通知时间 (必填) + classId: string // 班级id,多个用逗号分割 (必填) + sectionId?: string // 章节id + courseId: string // 课程id,必填 +} + +// 编辑作业请求参数 +export interface EditHomeworkRequest { + id: string // 必填 + title?: string | null + description?: string | null + attachment?: string | null + max_score?: number | null + pass_score?: number | null + start_time?: string | null + end_time?: string | null + status?: number | null +} + +// 作业提交信息类型 +export interface HomeworkSubmit { + id?: string + homeworkId?: string + studentId?: string + studentName?: string + submitTime?: string + score?: number | null + comment?: string | null + status?: number // 提交状态 + attachment?: string | null +} + +// 作业批阅请求参数 +export interface ReviewHomeworkRequest { + submitId: string // 提交记录ID (必填) + score: string // 得分 (必填) + comment: string // 评语 (必填) +} + +/** + * 作业API模块 + */ +export class HomeworkApi { + + /** + * 新建作业 + */ + static async createHomework(data: CreateHomeworkRequest): Promise> { + try { + console.log('🚀 发送新建作业请求:', { url: '/aiol/aiolHomework/teacher_add', data }) + + const response = await ApiRequest.post('/aiol/aiolHomework/teacher_add', data) + + console.log('📝 新建作业响应:', response) + return response + } catch (error) { + console.error('❌ 新建作业失败:', error) + throw error + } + } + + /** + * 编辑作业 + */ + static async editHomework(data: EditHomeworkRequest): Promise> { + try { + console.log('🚀 发送编辑作业请求:', { url: '/aiol/aiolHomework/edit', data }) + + const response = await ApiRequest.put('/aiol/aiolHomework/edit', data) + + console.log('✏️ 编辑作业响应:', response) + return response + } catch (error) { + console.error('❌ 编辑作业失败:', error) + throw error + } + } + + /** + * 删除作业 + */ + static async deleteHomework(id: string): Promise> { + try { + console.log('🚀 发送删除作业请求:', { url: '/aiol/aiolHomework/teacher_delete', id }) + + const response = await ApiRequest.delete(`/aiol/aiolHomework/teacher_delete?id=${id}`) + + console.log('🗑️ 删除作业响应:', response) + return response + } catch (error) { + console.error('❌ 删除作业失败:', error) + throw error + } + } + + /** + * 查询作业详情 + */ + static async getHomeworkById(id: string): Promise> { + try { + console.log('🚀 发送查询作业详情请求:', { url: '/aiol/aiolHomework/queryById', id }) + + const response = await ApiRequest.get<{ result: Homework }>(`/aiol/aiolHomework/queryById?id=${id}`) + + console.log('📋 作业详情响应:', response) + return response + } catch (error) { + console.error('❌ 查询作业详情失败:', error) + throw error + } + } + + /** + * 查询课程作业列表 + */ + static async getTeacherHomeworkList(courseId: string): Promise> { + try { + console.log('🚀 发送查询作业列表请求:', { url: '/aiol/aiolHomework/teacher_list', courseId }) + + const response = await ApiRequest.get<{ code: number, result: Homework[] }>('/aiol/aiolHomework/teacher_list', { courseId }) + + console.log('📋 作业列表响应:', response) + return response + } catch (error) { + console.error('❌ 查询作业列表失败:', error) + throw error + } + } + + /** + * 查询作业提交情况 + */ + static async getHomeworkSubmits(homeworkId: string): Promise> { + try { + console.log('🚀 发送查询作业提交情况请求:', { + url: `/aiol/aiolHomeworkSubmit/homework/${homeworkId}/submits`, + homeworkId + }) + + const response = await ApiRequest.get<{ result: HomeworkSubmit[] }>(`/aiol/aiolHomeworkSubmit/homework/${homeworkId}/submits`) + + console.log('📊 作业提交情况响应:', response) + return response + } catch (error) { + console.error('❌ 查询作业提交情况失败:', error) + throw error + } + } + + /** + * 作业批阅 + */ + static async reviewHomework(data: ReviewHomeworkRequest): Promise> { + try { + console.log('🚀 发送作业批阅请求:', { url: '/aiol/aiolHomework/review', data }) + + const response = await ApiRequest.post('/aiol/aiolHomework/review', data) + + console.log('✅ 作业批阅响应:', response) + return response + } catch (error) { + console.error('❌ 作业批阅失败:', error) + throw error + } + } +} + // 默认导出 export default TeachCourseApi + +// 导出讨论API +export { DiscussionApi } /** * 班级相关API */ @@ -632,4 +845,238 @@ export class ClassApi { throw error } } +} + +// 讨论相关类型定义 +export interface Discussion { + id?: string + title?: string | null + description?: string | null + sectionId?: string | null + courseId?: string | null + authorId?: string | null + authorName?: string | null + createTime?: string | null + updateTime?: string | null + status?: number | null + replyCount?: number | null +} + +// 新增评论请求参数 +export interface CreateCommentRequest { + content?: string // 评论内容 + imgs?: string // 图片 + targetType: string // 目标类型: course、comment、course_section、discussion + targetId: string // 目标id +} + +// 新建讨论请求参数 +export interface CreateDiscussionRequest { + title: string // 讨论标题 (必填) + description: string // 讨论描述 (必填) + sectionId?: string // 章节id + courseId?: string // 课程id +} + +// 编辑讨论请求参数 +export interface EditDiscussionRequest { + id: string // 讨论id (必填) + title: string // 讨论标题 (必填) + description?: string // 讨论描述 + sectionId?: string // 章节id +} + +/** + * 讨论API模块 + */ +class DiscussionApi { + + /** + * 新建讨论 + */ + static async createDiscussion(data: CreateDiscussionRequest): Promise> { + try { + console.log('🚀 发送新建讨论请求:', { url: '/aiol/aiolDiscussion/add', data }) + + const response = await ApiRequest.post('/aiol/aiolDiscussion/add', data) + + console.log('💬 新建讨论响应:', response) + return response + } catch (error) { + console.error('❌ 新建讨论失败:', error) + throw error + } + } + + /** + * 编辑讨论 + */ + static async editDiscussion(data: EditDiscussionRequest): Promise> { + try { + console.log('🚀 发送编辑讨论请求:', { url: '/aiol/aiolDiscussion/edit', data }) + + const response = await ApiRequest.put('/aiol/aiolDiscussion/edit', data) + + console.log('✏️ 编辑讨论响应:', response) + return response + } catch (error) { + console.error('❌ 编辑讨论失败:', error) + throw error + } + } + + /** + * 删除讨论 + */ + static async deleteDiscussion(id: string): Promise> { + try { + console.log('🚀 发送删除讨论请求:', { url: '/aiol/aiolDiscussion/delete', id }) + + const response = await ApiRequest.delete(`/aiol/aiolDiscussion/delete?id=${id}`) + + console.log('🗑️ 删除讨论响应:', response) + return response + } catch (error) { + console.error('❌ 删除讨论失败:', error) + throw error + } + } + + /** + * 查询课程讨论列表 + */ + static async getDiscussionList(courseId: string): Promise> { + try { + console.log('🚀 发送查询讨论列表请求:', { url: '/aiol/aiolDiscussion/teacher_list', courseId }) + + const response = await ApiRequest.get<{ result: Discussion[] }>('/aiol/aiolDiscussion/teacher_list', { courseId }) + + console.log('📋 讨论列表响应:', response) + return response + } catch (error) { + console.error('❌ 查询讨论列表失败:', error) + throw error + } + } + + /** + * 查询讨论详情 + */ + static async getDiscussionById(id: string): Promise> { + try { + console.log('🚀 发送查询讨论详情请求:', { url: '/aiol/aiolDiscussion/queryById', id }) + + const response = await ApiRequest.get<{ result: Discussion }>(`/aiol/aiolDiscussion/queryById?id=${id}`) + + console.log('📝 讨论详情响应:', response) + return response + } catch (error) { + console.error('❌ 查询讨论详情失败:', error) + throw error + } + } + + // ========== 评论相关接口 ========== + + /** + * 查询讨论下的评论列表 + */ + static async getDiscussionComments(discussionId: string): Promise> { + try { + console.log('🚀 发送查询讨论评论请求:', { url: `/aiol/aiolComment/discussion/${discussionId}/list`, discussionId }) + + const response = await ApiRequest.get<{ result: any[] }>(`/aiol/aiolComment/discussion/${discussionId}/list`) + + console.log('💬 讨论评论响应:', response) + return response + } catch (error) { + console.error('❌ 查询讨论评论失败:', error) + throw error + } + } + + /** + * 查询课程下的评论列表 + */ + static async getCourseComments(courseId: string): Promise> { + try { + console.log('🚀 发送查询课程评论请求:', { url: `/aiol/aiolComment/course/${courseId}/list`, courseId }) + + const response = await ApiRequest.get<{ result: any[] }>(`/aiol/aiolComment/course/${courseId}/list`) + + console.log('💬 课程评论响应:', response) + return response + } catch (error) { + console.error('❌ 查询课程评论失败:', error) + throw error + } + } + + /** + * 新增评论 + */ + static async createComment(commentData: CreateCommentRequest): Promise { + try { + console.log('🚀 发送新增评论请求:', { url: '/aiol/aiolComment/add', data: commentData }) + + const response = await ApiRequest.post('/aiol/aiolComment/add', commentData) + + console.log('✅ 新增评论响应:', response) + return response + } catch (error) { + console.error('❌ 新增评论失败:', error) + throw error + } + } + + /** + * 查询评论详情 + */ + static async getCommentById(id: string): Promise> { + try { + console.log('🚀 发送查询评论详情请求:', { url: '/aiol/aiolComment/queryById', id }) + + const response = await ApiRequest.get<{ result: any }>(`/aiol/aiolComment/queryById?id=${id}`) + + console.log('📝 评论详情响应:', response) + return response + } catch (error) { + console.error('❌ 查询评论详情失败:', error) + throw error + } + } + + /** + * 评论点赞 + */ + static async likeComment(commentId: string): Promise { + try { + console.log('🚀 发送评论点赞请求:', { url: `/aiol/aiolComment/like/${commentId}`, commentId }) + + const response = await ApiRequest.get(`/aiol/aiolComment/like/${commentId}`) + + console.log('👍 评论点赞响应:', response) + return response + } catch (error) { + console.error('❌ 评论点赞失败:', error) + throw error + } + } + + /** + * 评论置顶 + */ + static async topComment(commentId: string): Promise { + try { + console.log('🚀 发送评论置顶请求:', { url: `/aiol/aiolComment/top/${commentId}`, commentId }) + + const response = await ApiRequest.get(`/aiol/aiolComment/top/${commentId}`) + + console.log('👍 评论置顶响应:', response) + return response + } catch (error) { + console.error('❌ 评论置顶失败:', error) + throw error + } + } } \ No newline at end of file diff --git a/src/components/CustomDropdown.vue b/src/components/CustomDropdown.vue index 5f68e06..e31e710 100644 --- a/src/components/CustomDropdown.vue +++ b/src/components/CustomDropdown.vue @@ -149,7 +149,7 @@ onUnmounted(() => { background: #ffffff; border: 1.5px solid #D8D8D8; border-radius: 0 0 2px 2px; - z-index: 1000; + z-index: 9999; max-height: 200px; overflow-y: auto; } diff --git a/src/components/DiscussionLibraryModal.vue b/src/components/DiscussionLibraryModal.vue new file mode 100644 index 0000000..c1028ee --- /dev/null +++ b/src/components/DiscussionLibraryModal.vue @@ -0,0 +1,605 @@ + + + + + \ No newline at end of file diff --git a/src/components/ExamPaperLibraryModal.vue b/src/components/ExamPaperLibraryModal.vue index 85d16b0..3ef559b 100644 --- a/src/components/ExamPaperLibraryModal.vue +++ b/src/components/ExamPaperLibraryModal.vue @@ -11,42 +11,28 @@
-
+
-
- - 搜索 -
+
已全部加载,共{{ totalCount }}份考试/练习
- - - 导入试卷 -
-
+
+ :class="{ 'selected': selectedExamId === exam.id }">
- +
-
+
@@ -63,17 +49,24 @@ 考试时长: {{ exam.duration }}
-
+
+ +
+
+

暂无考试数据

+

尝试调整搜索条件

+
+
@@ -90,7 +83,7 @@ -

添加讨论

+

{{ isEditMode ? '编辑讨论' : '添加讨论' }}

- +
@@ -35,32 +35,22 @@
- - - -
-
选择章节:
-
- -
-
- 取消 - 确认 -
-
+
取消 - 发布 + + {{ isEditMode ? '保存' : '发布' }} +
@@ -72,16 +62,32 @@ diff --git a/src/views/teacher/course/ChapterManagement.vue b/src/views/teacher/course/ChapterManagement.vue index e466875..3288177 100644 --- a/src/views/teacher/course/ChapterManagement.vue +++ b/src/views/teacher/course/ChapterManagement.vue @@ -468,8 +468,7 @@ const columns: DataTableColumns = [ style: { display: 'flex', alignItems: 'center', - cursor: (isChapter && row.children && row.children.length > 0) ? 'pointer' : 'default', - marginLeft: isChapter ? '0px' : '-3px' + cursor: (isChapter && row.children && row.children.length > 0) ? 'pointer' : 'default' }, onClick: (isChapter && row.children && row.children.length > 0) ? () => toggleChapter(row) : undefined }, [ @@ -485,9 +484,9 @@ const columns: DataTableColumns = [ } }, { default: () => h(ChevronForwardOutline) - }) : (isChapter ? h('span', { style: { marginRight: '22px' } }) : null), + }) : (isChapter ? h('span', {}) : null), h('span', { - style: { color: '#062333', fontSize: '13px' } + style: { color: '#062333', fontSize: '13px', fontWeight: isChapter ? '600' : '400' } }, row.name) ]) } @@ -499,7 +498,7 @@ const columns: DataTableColumns = [ render: (row: Chapter) => { const isChapter = row.level === 1; // level=1 表示章 if (isChapter || row.type === '-') { - return h('span', { style: { color: '#BABABA' } }, '-') + return h('span', { style: { color: '#BABABA' } }, '章节') } return h('div', { style: { @@ -509,7 +508,7 @@ const columns: DataTableColumns = [ color: '#062333', fontSize: '12px' } - }, row.type) + }, getTypeText(row.type)) } }, { @@ -603,6 +602,17 @@ const columns: DataTableColumns = [ } ] +const getTypeText = (type: string) => { + const typeMap: Record = { + '0': '视频', + '1': '文档', + '2': '音频', + '3': '测试', + '4': '作业' + } + return typeMap[type] || '-' +} + const fetchCourseChapters = () => { loading.value = true TeachCourseApi.getCourseSections(courseId.value).then(res => { diff --git a/src/views/teacher/course/CoursewareManagement.vue b/src/views/teacher/course/CoursewareManagement.vue index 77fea33..55e7186 100644 --- a/src/views/teacher/course/CoursewareManagement.vue +++ b/src/views/teacher/course/CoursewareManagement.vue @@ -9,7 +9,7 @@ -
+
@@ -50,9 +50,9 @@ + + \ No newline at end of file diff --git a/src/views/teacher/course/HomeworkLibrary.vue b/src/views/teacher/course/HomeworkLibrary.vue index 39ec40c..bbc73bd 100644 --- a/src/views/teacher/course/HomeworkLibrary.vue +++ b/src/views/teacher/course/HomeworkLibrary.vue @@ -6,19 +6,26 @@ 添加作业 导入 导出 - 删除 +
- + +
+ 搜索 "{{ searchValue }}" 共找到 {{ filteredTotalCount }} 条结果 + 清除搜索 +
+ + +
@@ -60,95 +67,66 @@