From 21b03635a2b448bd208a5bc09c76fce0e3de2af0 Mon Sep 17 00:00:00 2001 From: chenghuan Date: Fri, 14 Nov 2025 15:13:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=9A=84=E5=88=9D=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/modules/course.ts | 179 +++- components/bkhumor-emojiplus/index.vue | 12 +- components/comment/CommentEditor.vue | 491 ++++++++++ components/comment/CommentList.vue | 406 ++++++++ components/course/CatalogueList.vue | 96 ++ components/course/ChapterList.vue | 308 ++++++ components/course/GoodsSelector.vue | 237 +++++ components/course/VideoPlayer.vue | 242 +++++ hooks/useComment.ts | 191 ++++ hooks/useCourse.ts | 98 ++ locale/en.json | 87 ++ locale/zh-Hans.json | 87 ++ pages.json | 18 + pages/course/details/chapter.vue | 466 ++++++++++ .../course/details/components/course-info.vue | 187 ++++ pages/course/details/course.vue | 876 ++++++++++++++++++ pages/course/index.vue | 2 +- pages/course/list/components/list-item.vue | 2 +- pages/course/order.vue | 672 ++++++++++++++ stores/course.ts | 142 +++ style/tailwind.css | 5 +- style/ui.scss | 12 +- tailwind-input.css | 2 +- types/comment.d.ts | 43 + types/course.d.ts | 109 +++ 25 files changed, 4958 insertions(+), 12 deletions(-) create mode 100644 components/comment/CommentEditor.vue create mode 100644 components/comment/CommentList.vue create mode 100644 components/course/CatalogueList.vue create mode 100644 components/course/ChapterList.vue create mode 100644 components/course/GoodsSelector.vue create mode 100644 components/course/VideoPlayer.vue create mode 100644 hooks/useComment.ts create mode 100644 hooks/useCourse.ts create mode 100644 pages/course/details/chapter.vue create mode 100644 pages/course/details/components/course-info.vue create mode 100644 pages/course/details/course.vue create mode 100644 pages/course/order.vue create mode 100644 stores/course.ts create mode 100644 types/comment.d.ts diff --git a/api/modules/course.ts b/api/modules/course.ts index 8b50f79..b947717 100644 --- a/api/modules/course.ts +++ b/api/modules/course.ts @@ -1,12 +1,19 @@ // api/modules/course.ts import { createRequestClient } from '../request' import { SERVICE_MAP } from '../config' +import type { IApiResponse } from '../types' import type { ICourseMedicalTreeResponse, IUserLateCourseListResponse, - IMarketCourseListResponse + IMarketCourseListResponse, + ICourseDetailResponse, + IChapterListResponse, + IChapterDetailResponse, + IProductListResponse, + IVipInfo } from '@/types/course' import type { ISearchRequest, ISearchResponse } from '@/types/search' +import type { ICommentListResponse, IAddCommentResponse, IComment } from '@/types/comment' const client = createRequestClient({ baseURL: SERVICE_MAP.MAIN }) @@ -64,5 +71,175 @@ export const courseApi = { method: 'POST', data }) + }, + + /** + * 获取课程详情 + * @param id 课程ID + */ + getCourseDetail(id: number) { + return client.request({ + url: 'sociology/course/getCourseDetail', + method: 'POST', + data: { id } + }) + }, + + /** + * 获取目录章节列表 + * @param id 目录ID + */ + getCatalogueChapterList(id: number) { + return client.request({ + url: 'sociology/course/getCourseCatalogueChapterList', + method: 'POST', + data: { id } + }) + }, + + /** + * 获取章节详情 + * @param id 章节ID + */ + getChapterDetail(id: number) { + return client.request({ + url: 'sociology/course/getCourseCatalogueChapterDetail', + method: 'POST', + data: { id, load: false } + }) + }, + + /** + * 开始学习免费课程 + * @param catalogueId 目录ID + */ + startStudyForMF(catalogueId: number) { + return client.request({ + url: 'sociology/course/startStudyForMF', + method: 'POST', + data: { catalogueId } + }) + }, + + /** + * 获取课程商品列表 + * @param id 目录ID + */ + getProductListForCourse(id: number) { + return client.request({ + url: 'sociology/product/getProductListForCourse', + method: 'POST', + data: { id } + }) + }, + + /** + * 检查目录是否支持复读 + * @param courseCatalogueId 目录ID + */ + checkRenewPayment(courseCatalogueId: number) { + return client.request>({ + url: 'common/courseRelearn/courseCatalogueCanRelearn', + method: 'POST', + data: { courseCatalogueId } + }) + }, + + /** + * 获取复读商品列表 + * @param catalogueId 目录ID + */ + getRenewProductList(catalogueId: number) { + return client.request({ + url: 'common/courseRelearn/relearnShopProductList', + method: 'POST', + data: { catalogueId } + }) + }, + + /** + * 获取课程留言列表 + * @param courseId 课程ID + * @param page 页码 + * @param limit 每页数量 + * @param userId 用户ID + */ + getCourseComments(courseId: number, page: number, limit: number, userId: number) { + return client.request({ + url: 'common/courseGuestbook/getCourseGuestbookList', + method: 'POST', + data: { courseId, page, limit, userId, chapterId: '' } + }) + }, + + /** + * 添加课程留言 + * @param data 留言数据 + */ + addCourseComment(data: { + type: number + courseId: number + chapterId: string + pid: number + userId: number + forUserId: number + content: string + images: string + }) { + return client.request({ + url: 'common/courseGuestbook/addCourseGuestbook', + method: 'POST', + data + }) + }, + + /** + * 点赞留言 + * @param userId 用户ID + * @param guestbookId 留言ID + */ + likeComment(userId: number, guestbookId: number) { + return client.request({ + url: 'common/courseGuestbook/addCourseGuestbookSupport', + method: 'POST', + data: { userId, guestbookId } + }) + }, + + /** + * 取消点赞 + * @param userId 用户ID + * @param guestbookId 留言ID + */ + unlikeComment(userId: number, guestbookId: number) { + return client.request({ + url: 'common/courseGuestbook/cancelCourseGuestbookSupport', + method: 'POST', + data: { userId, guestbookId } + }) + }, + + /** + * 检查用户VIP权益 + * @param courseId 课程ID + */ + checkCourseVip(courseId: number) { + return client.request>({ + url: 'common/userVip/ownCourseCatalogueByVip', + method: 'POST', + data: { courseId } + }) + }, + + /** + * 获取课程需要的VIP类型 + * @param courseId 课程ID + */ + getCourseVipModule(courseId: number) { + return client.request>({ + url: 'common/userVip/getCourseVipModule', + method: 'POST', + data: { courseId } + }) } } diff --git a/components/bkhumor-emojiplus/index.vue b/components/bkhumor-emojiplus/index.vue index 1d260a3..8292b97 100644 --- a/components/bkhumor-emojiplus/index.vue +++ b/components/bkhumor-emojiplus/index.vue @@ -1,7 +1,13 @@