Ver Fonte

课程评论 关联到小节

yuhongqi há 3 dias atrás
pai
commit
516a3874ba

+ 6 - 3
src/api/course/userCourseComment.js

@@ -62,9 +62,12 @@ export function downloadCommentImportTemplate() {
 }
 
 // 导入精选留言
-export function importComments(courseId, file) {
+export function importComments(courseId, videoId, file) {
   const formData = new FormData()
   formData.append('file', file)
+  if (videoId != null) {
+    formData.append('videoId', videoId)
+  }
   return request({
     url: '/course/userCourseComment/importComments/' + courseId,
     method: 'post',
@@ -74,10 +77,10 @@ export function importComments(courseId, file) {
 }
 
 // 查询精选留言历史列表
-export function listFeaturedComments(courseId, query) {
+export function listFeaturedComments(courseId, videoId, query) {
   return request({
     url: '/course/userCourseComment/featuredComments/' + courseId,
     method: 'get',
-    params: query
+    params: { videoId: videoId || undefined, ...query }
   })
 }

+ 7 - 5
src/views/components/course/userCourseCatalogDetails.vue

@@ -876,7 +876,8 @@ export default {
         fileList: [],
         file: null,
         historyList: [],
-        courseId: null
+        courseId: null,
+        videoId: null
       },
     }
   },
@@ -1744,8 +1745,9 @@ export default {
       this.commentImportDialog.file = null;
       this.commentImportDialog.fileList = [];
       this.commentImportDialog.courseId = this.form.courseId;
+      this.commentImportDialog.videoId = this.form.videoId;
       // 加载历史留言
-      listFeaturedComments(this.form.courseId).then(res => {
+      listFeaturedComments(this.form.courseId, this.form.videoId).then(res => {
         this.commentImportDialog.historyList = res.rows || [];
       });
     },
@@ -1760,7 +1762,7 @@ export default {
           if (res.code === 200) {
             this.$message.success('删除成功');
             // 刷新历史列表
-            listFeaturedComments(this.commentImportDialog.courseId).then(res2 => {
+            listFeaturedComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId).then(res2 => {
               this.commentImportDialog.historyList = res2.rows || [];
             });
           } else {
@@ -1788,11 +1790,11 @@ export default {
         return;
       }
       this.commentImportDialog.loading = true;
-      importComments(this.commentImportDialog.courseId, this.commentImportDialog.file).then(res => {
+      importComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId, this.commentImportDialog.file).then(res => {
         if (res.code === 200) {
           this.$message.success(res.msg);
           // 刷新历史列表
-          listFeaturedComments(this.commentImportDialog.courseId).then(res2 => {
+          listFeaturedComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId).then(res2 => {
             this.commentImportDialog.historyList = res2.rows || [];
           });
         } else {

+ 7 - 5
src/views/components/course/userCourseCatalogDetailsZM.vue

@@ -806,7 +806,8 @@ export default {
         fileList: [],
         file: null,
         historyList: [],
-        courseId: null
+        courseId: null,
+        videoId: null
       },
       // 批量修改封面
       batchEditCoverDialog: {
@@ -1830,8 +1831,9 @@ export default {
       this.commentImportDialog.file = null;
       this.commentImportDialog.fileList = [];
       this.commentImportDialog.courseId = this.form.courseId;
+      this.commentImportDialog.videoId = this.form.videoId;
       // 加载历史留言
-      listFeaturedComments(this.form.courseId).then(res => {
+      listFeaturedComments(this.form.courseId, this.form.videoId).then(res => {
         this.commentImportDialog.historyList = res.rows || [];
       });
     },
@@ -1846,7 +1848,7 @@ export default {
           if (res.code === 200) {
             this.$message.success('删除成功');
             // 刷新历史列表
-            listFeaturedComments(this.commentImportDialog.courseId).then(res2 => {
+            listFeaturedComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId).then(res2 => {
               this.commentImportDialog.historyList = res2.rows || [];
             });
           } else {
@@ -1874,11 +1876,11 @@ export default {
         return;
       }
       this.commentImportDialog.loading = true;
-      importComments(this.commentImportDialog.courseId, this.commentImportDialog.file).then(res => {
+      importComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId, this.commentImportDialog.file).then(res => {
         if (res.code === 200) {
           this.$message.success(res.msg);
           // 刷新历史列表
-          listFeaturedComments(this.commentImportDialog.courseId).then(res2 => {
+          listFeaturedComments(this.commentImportDialog.courseId, this.commentImportDialog.videoId).then(res2 => {
             this.commentImportDialog.historyList = res2.rows || [];
           });
         } else {