Kaynağa Gözat

修改显示逻辑

lex-xin 8 ay önce
ebeveyn
işleme
1d42fd416d

+ 15 - 18
src/views/coursewarePlay/coursewarePlay.vue

@@ -15,8 +15,8 @@
                   isTempAutoPlay = false
                }
             "
+            :autoPlay="true"
             @playbackRate="showController"
-            :autoPlay="videoIsAutoPlay"
             :disableEvents="true"
             :isShowController="isShowController"
          />
@@ -81,7 +81,8 @@
                <div class="title">{{ activeCourseware?.parentData.name || "" }}</div>
                <div class="content">
                   <p>{{ activeCourseware?.name || "" }}</p>
-                  <span v-if="activeCourseware?.phaseGoals" @click="onTitleTip('phaseGoals', activeCourseware?.phaseGoals)">阶段目标</span>
+                  <!-- <span v-if="activeCourseware?.phaseGoals" @click="onTitleTip('phaseGoals', activeCourseware?.phaseGoals)">阶段目标</span> -->
+                  <span v-if="lessonTargetDetail" @click="onTitleTip('phaseGoals', lessonTargetDetail)">阶段目标</span>
                   <span v-if="activeCourseware?.checkItem" @click="onTitleTip('checkItem', activeCourseware?.checkItem)">检查事项</span>
                </div>
             </div>
@@ -153,6 +154,7 @@ const userStoreHook = userStore()
 /* 获取资源 */
 const videoPlayDom = ref<InstanceType<typeof videoPlay>>()
 const songPlayDom = ref<any>() // 曲谱对象
+const lessonTargetDetail = ref<string>("") // 阶段目标
 const coursewareMenuList = shallowRef<any[]>([]) // 课程类型
 const coursewareList = shallowRef<any[]>([]) // 知识点
 const flattenCoursewareList = ref<any[]>([]) // 扁平化coursewareList
@@ -184,11 +186,11 @@ const songPlaySrc = computed<string>(() => {
    return urlObj[userStoreHook.roles!]
 })
 // 视频是否自动播放
-const videoIsAutoPlay = computed<boolean>(() => {
-   // 如果为视频且有阶段目前则不自动播放
-   console.log(fileType.value, isTempAutoPlay.value, "isTempAutoPlay")
-   return (fileType.value === "VIDEO" && activeCourseware.value?.phaseGoals) || isTempAutoPlay.value ? false : true
-})
+// const videoIsAutoPlay = computed<boolean>(() => {
+//    // 如果为视频且有阶段目前则不自动播放
+//    console.log(fileType.value, isTempAutoPlay.value, "isTempAutoPlay")
+//    return (fileType.value === "VIDEO" && activeCourseware.value?.phaseGoals) || isTempAutoPlay.value ? false : true
+// })
 const activeCoursewareIndex = ref(0)
 const drawerShow = ref(false)
 const drawerMenuShow = ref(false)
@@ -196,12 +198,6 @@ const drawerMenuShow = ref(false)
 const coursewareTotalTime = ref(0)
 // 监控播放
 watch(activeCourseware, () => {
-   handleVideoPause()
-   if (activeCourseware.value?.phaseGoals) {
-      onTitleTip("phaseGoals", activeCourseware.value?.phaseGoals)
-
-      handleSongPause()
-   }
    fileType.value === "VIDEO" &&
       nextTick(() => {
          handlePlayVideo({
@@ -221,7 +217,7 @@ async function getCoursewareList(id?: string) {
    }
    await httpAjaxErrMsg(LessonCoursewareDetailApi[userStoreHook.roles!], id || (route.params.id as string)).then(res => {
       if (res.code === 200) {
-         const { lockFlag, knowledgePointList } = res.data || {}
+         const { lockFlag, knowledgePointList, lessonTargetDesc } = res.data || {}
          if (lockFlag) {
             ElMessageBox.alert("课件已锁定", "温馨提示", {
                confirmButtonText: "退出",
@@ -248,6 +244,7 @@ async function getCoursewareList(id?: string) {
                })
             return
          }
+         lessonTargetDetail.value = lessonTargetDesc ? lessonTargetDesc.replace(/\n/g, "<br />") : ""
          // 处理返回的数据
          handlePointList(knowledgePointList)
       }
@@ -335,10 +332,10 @@ async function handleCourseMenuClick(value: any) {
    drawerMenuShow.value = false
    activeCoursewareIndex.value = 0
    nextTick(() => {
-      if (!activeCourseware.value?.phaseGoals) {
-         // 切换之后默认打开课程目录
-         drawerShow.value = true
-      }
+      //    if (!activeCourseware.value?.phaseGoals) {
+      // 切换之后默认打开课程目录
+      drawerShow.value = true
+      //    }
    })
    LoadingBar.loading(false)
 }

+ 2 - 1
src/views/coursewarePlay/videoPlay/videoPlay.vue

@@ -94,6 +94,7 @@ const emits = defineEmits<{
    (e: "ready"): void //播放器初始化完成
    (e: "ended"): void //播放结束
    (e: "playbackRate"): void //播放速度改动时候
+   (e: "loadedmetadata"): void // 播放器加载初始化数据时
 }>()
 const videoId = "video" + UUID()
 let playerVm: Record<string, any>
@@ -174,7 +175,7 @@ function initVideo() {
    })
    playerVm.on("loadedmetadata", () => {
       console.log("loadedmetadata")
-      if (props.autoPlay) {
+      if (props?.autoPlay) {
          playerVm.play()
       }