Jelajahi Sumber

视频收藏

shilipojs 2 tahun lalu
induk
melakukan
9a0d58376b
2 mengubah file dengan 18 tambahan dan 2 penghapusan
  1. 7 0
      src/api/webApi/webVideo.js
  2. 11 2
      src/views/videocourse/video_course.vue

+ 7 - 0
src/api/webApi/webVideo.js

@@ -135,3 +135,10 @@ export function getAiSubjectPapers(params) {
     params
   })
 }
+export function collectVideoCourse(params) {
+  return request({
+    url: 'front/videoCourse/video/collectVideoCourse',
+    method: 'post',
+    params
+  })
+}

+ 11 - 2
src/views/videocourse/video_course.vue

@@ -33,7 +33,7 @@
           />
           <p class="fx-row jc-between ai-center">
             <span class="text-ellipsis"> {{ item.section_name }} </span>
-            <span class="pointer iconfont icon-shoucang"></span>
+            <span @click="toCollect(item)" class="pointer iconfont icon-shoucang" :class="{'f-primary':item.isCollect}"></span>
           </p>
         </el-col>
       </el-row>
@@ -53,7 +53,7 @@
   </div>
 </template>
 <script>
-import { videoList } from '@/api/webApi/webVideo'
+import { videoList,collectVideoCourse } from '@/api/webApi/webVideo'
 import MxSearchGroup from '@/components/MxSearch/mx-search-group'
 import MxCondition from '@/components/MxCondition/mx-condition'
 
@@ -104,6 +104,15 @@ export default {
     searchVideo() {
       this.getVideoList()
     },
+    toCollect(item) {
+      collectVideoCourse({
+        id:item.id
+      }).then(res => {
+        item = !item.isCollect
+      }).catch(_ => {
+
+      })
+    },
     // 获取视频列表
     getVideoList() {
       videoList({