feat(课程评论): 实现课程评论的点赞、取消点赞及分页加载功能
添加了课程评论的点赞和取消点赞功能,并优化了评论列表的分页加载逻辑。同时,修复了评论提交后的列表刷新问题,确保数据一致性。
Showing
3 changed files
with
21 additions
and
3 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-04-15 09:32:07 | 2 | * @Date: 2025-04-15 09:32:07 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-04-18 14:43:46 | 4 | + * @LastEditTime: 2025-04-18 17:15:52 |
| 5 | * @FilePath: /mlaj/src/api/course.js | 5 | * @FilePath: /mlaj/src/api/course.js |
| 6 | * @Description: 课程模块相关接口 | 6 | * @Description: 课程模块相关接口 |
| 7 | */ | 7 | */ |
| ... | @@ -15,6 +15,8 @@ const Api = { | ... | @@ -15,6 +15,8 @@ const Api = { |
| 15 | GROUP_COMMENT_ADD: '/srv/?a=group_comment_add', | 15 | GROUP_COMMENT_ADD: '/srv/?a=group_comment_add', |
| 16 | GROUP_COMMENT_EDIT: '/srv/?a=group_comment_edit', | 16 | GROUP_COMMENT_EDIT: '/srv/?a=group_comment_edit', |
| 17 | GROUP_COMMENT_DEL: '/srv/?a=group_comment_del', | 17 | GROUP_COMMENT_DEL: '/srv/?a=group_comment_del', |
| 18 | + GROUP_COMMENT_LIKE: '/srv/?a=group_comment_like', | ||
| 19 | + GROUP_COMMENT_DISLIKE: '/srv/?a=group_comment_dislike', | ||
| 18 | } | 20 | } |
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| ... | @@ -44,6 +46,7 @@ export const getScheduleCourseAPI = (params) => fn(fetch.get(Api.GET_SCHEDULE_CO | ... | @@ -44,6 +46,7 @@ export const getScheduleCourseAPI = (params) => fn(fetch.get(Api.GET_SCHEDULE_CO |
| 44 | /** | 46 | /** |
| 45 | * @description: 获取课程评论列表 | 47 | * @description: 获取课程评论列表 |
| 46 | * @param: i 课程 ID | 48 | * @param: i 课程 ID |
| 49 | + * @param: schedule_id 章节ID,非必须,在课程章节内查询时需要 | ||
| 47 | * @param: limit 每页数量 默认10 | 50 | * @param: limit 每页数量 默认10 |
| 48 | * @param: page 页码 | 51 | * @param: page 页码 |
| 49 | * @return: data: { comment_score 课程评论分数, comment_count 评论数量, comment_list [{ id 评论id, created_by 评论人ID, name 评论人姓名, note 评论内容, score 分数, create_time 评论时间}] 评论列表} | 52 | * @return: data: { comment_score 课程评论分数, comment_count 评论数量, comment_list [{ id 评论id, created_by 评论人ID, name 评论人姓名, note 评论内容, score 分数, create_time 评论时间}] 评论列表} |
| ... | @@ -53,6 +56,7 @@ export const getGroupCommentListAPI = (params) => fn(fetch.get(Api.GET_GROUP_COM | ... | @@ -53,6 +56,7 @@ export const getGroupCommentListAPI = (params) => fn(fetch.get(Api.GET_GROUP_COM |
| 53 | /** | 56 | /** |
| 54 | * @description: 添加课程评论 | 57 | * @description: 添加课程评论 |
| 55 | * @param: i 课程 ID | 58 | * @param: i 课程 ID |
| 59 | + * @param: schedule_id 章节ID,非必须,在课程章节添加时需要 | ||
| 56 | * @param: note 评论内容 | 60 | * @param: note 评论内容 |
| 57 | * @param: score 分数 | 61 | * @param: score 分数 |
| 58 | * @return: data: '' | 62 | * @return: data: '' |
| ... | @@ -70,7 +74,21 @@ export const editGroupCommentAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_E | ... | @@ -70,7 +74,21 @@ export const editGroupCommentAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_E |
| 70 | 74 | ||
| 71 | /** | 75 | /** |
| 72 | * @description: 删除课程评论 | 76 | * @description: 删除课程评论 |
| 73 | - * @param: i 课程 ID | 77 | + * @param: i 课程ID |
| 74 | * @return: data: '' | 78 | * @return: data: '' |
| 75 | */ | 79 | */ |
| 76 | export const delGroupCommentAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_DEL, params)) | 80 | export const delGroupCommentAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_DEL, params)) |
| 81 | + | ||
| 82 | +/** | ||
| 83 | + * @description: 点赞章节评论 | ||
| 84 | + * @param: i 评论ID | ||
| 85 | + * @return: data: '' | ||
| 86 | + */ | ||
| 87 | +export const addGroupCommentLikeAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_LIKE, params)) | ||
| 88 | + | ||
| 89 | +/** | ||
| 90 | + * @description: 取消点赞章节评论 | ||
| 91 | + * @param: i 评论ID | ||
| 92 | + * @return: data: '' | ||
| 93 | + */ | ||
| 94 | +export const delGroupCommentLikeAPI = (params) => fn(fetch.post(Api.GROUP_COMMENT_DISLIKE, params)) | ... | ... |
| ... | @@ -20,7 +20,7 @@ declare module 'vue' { | ... | @@ -20,7 +20,7 @@ declare module 'vue' { |
| 20 | GradientHeader: typeof import('./components/ui/GradientHeader.vue')['default'] | 20 | GradientHeader: typeof import('./components/ui/GradientHeader.vue')['default'] |
| 21 | LiveStreamCard: typeof import('./components/ui/LiveStreamCard.vue')['default'] | 21 | LiveStreamCard: typeof import('./components/ui/LiveStreamCard.vue')['default'] |
| 22 | MenuItem: typeof import('./components/ui/MenuItem.vue')['default'] | 22 | MenuItem: typeof import('./components/ui/MenuItem.vue')['default'] |
| 23 | - ReviewPopup: typeof import('./components/ui/ReviewPopup.vue')['default'] | 23 | + ReviewPopup: typeof import('./components/courses/ReviewPopup.vue')['default'] |
| 24 | RouterLink: typeof import('vue-router')['RouterLink'] | 24 | RouterLink: typeof import('vue-router')['RouterLink'] |
| 25 | RouterView: typeof import('vue-router')['RouterView'] | 25 | RouterView: typeof import('vue-router')['RouterView'] |
| 26 | SearchBar: typeof import('./components/ui/SearchBar.vue')['default'] | 26 | SearchBar: typeof import('./components/ui/SearchBar.vue')['default'] | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment