Jelajahi Sumber

课程管理 选择视频自动选中题目

Long 1 Minggu lalu
induk
melakukan
fbf17fd7eb

+ 3 - 0
src/components/VideoUpload/index.vue

@@ -389,6 +389,9 @@ export default {
       // 设置预览URL
       this.$emit("update:videoUrl", this.selectedVideo.videoUrl);
 
+      // 题目
+      this.$emit("selectProjects", this.selectedVideo.projectIds)
+
       this.libraryOpen = false;
     },
     /** 取消视频选择 */

+ 21 - 0
src/views/components/course/userCourseCatalogDetails.vue

@@ -192,6 +192,7 @@
           :uploadType.sync="form.uploadType"
           @video-duration="handleVideoDuration"
           @change="handleVideoChange"
+          @selectProjects="handleSelectProjects"
           ref="videoUpload"
           append-to-body
         />
@@ -362,6 +363,7 @@ import {
 import QuestionBank from "@/views/course/courseQuestionBank/QuestionBank.vue";
 import VideoUpload from "@/components/VideoUpload/index.vue";
 import { listVideoResource } from '@/api/course/videoResource';
+import {getByIds} from "@/api/course/courseQuestionBank";
 
 export default {
     name: "userCourseCatalog",
@@ -554,6 +556,25 @@ export default {
         }
         // console.log("选择的video=======>>>>>>>",this.videoUrl)
       },
+      // 视频库课题
+      handleSelectProjects(projectIds) {
+        if (!projectIds || projectIds.length === 0 || this.isPrivate === 0) {
+          return
+        }
+
+        this.form.questionBankList = []
+        const params = {ids: projectIds}
+        getByIds(params).then(response => {
+          if (response.code === 200) {
+            response.data.forEach(item => {
+              let isExist = this.form.questionBankList.some(q => q.id === item.id)
+              if (!isExist) {
+                this.form.questionBankList.push(item)
+              }
+            });
+          }
+        })
+      },
       handleVideoDuration(duration) {
         this.form.duration = duration;
       },