liyanbo 5 ヶ月 前
コミット
489baf10d6
1 ファイル変更2 行追加51 行削除
  1. 2 51
      src/views/programming/Interface.vue

+ 2 - 51
src/views/programming/Interface.vue

@@ -36,7 +36,6 @@
               :currentIndex="course.key || ''"
               @timeUpdate="handleVideoTimeUpdate"
               @videoEnded="handleVideoEnded"
-              @switchVideo="switchVideo"
           />
           <!-- 图片 -->
           <ImageView v-if="course.courseContentType === 'image'" :imagePath="course.courseImagePath" altText="课程图片"></ImageView>
@@ -186,22 +185,6 @@ const blocklyDataScope = ref([])
 // 测试账号禁用视频
 const isDisabled = ref(false)
 
-
-// 视频切换事件处理函数
-const switchVideo = (index) => {
-  // 根据索引切换视频
-  if (videoPathMap.value[index]) {
-    course.value = videoPathMap.value[index]
-    courseId.value = course.value.id
-    console.log("课程id:",courseId.value)
-  } else {
-    //视频不存在
-    Message().notifyWarning('视频不存在!', true)
-  }
-  //测试账号禁用视频
-  if (disableVideo(index)) return
-}
-
 // 展平所有菜单项索引
 const flattenMenuItems = () => {
   const indices = []
@@ -269,40 +252,8 @@ const handleVideoEnded = () => {
     )
   }
 
-  // 如果是图片类型,不需要自动播放下一个
-  if (course.value.courseContentType === 'video') {
-    const allIndices = flattenMenuItems()
-    const currentIndexInList = allIndices.indexOf(course.value.key)
-    if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
-      const nextIndex = allIndices[currentIndexInList + 1]
-      if (videoPathMap.value[nextIndex]) {
-        course.value = videoPathMap.value[nextIndex]
-        courseId.value = course.value.id
-        console.log("课程id:",courseId.value)
-        //测试账号禁用视频
-        if (disableVideo(nextIndex)) return
-      } else {
-        //视频不存在
-        Message().notifyWarning('视频不存在!', true)
-      }
-    }
-  }
-
-  const allIndices = flattenMenuItems()
-  const currentIndexInList = allIndices.indexOf(course.value.key)
-  if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
-    const nextIndex = allIndices[currentIndexInList + 1]
-    if (videoPathMap.value[nextIndex]) {
-      course.value = videoPathMap.value[nextIndex]
-      courseId.value = course.value.id
-      console.log("课程id:",courseId.value)
-      //测试账号禁用视频
-      if (disableVideo(nextIndex)) return
-    } else {
-      //视频不存在
-      Message().notifyWarning('视频不存在!', true)
-    }
-  }
+  // 自动播放下一个
+  playNextVideo();
 }
 
 // 禁用视频