|
@@ -5,7 +5,7 @@
|
|
|
-->
|
|
|
<template>
|
|
|
<div class="coursewarePlay">
|
|
|
- <videoPlay ref="videoPlayDom" @ready="handleVideoReady" @keydown="handleVideoKeydown">
|
|
|
+ <videoPlay ref="videoPlayDom" @ready="handleVideoReady" :listen-win-events="true">
|
|
|
<div class="leftTools posTools">
|
|
|
<div v-if="activeCoursewareIndex > 0" class="posBtn" @click="handleChangeCourseware(-1)">
|
|
|
<img src="@/img/coursewarePlay/shang.png" />
|
|
@@ -29,7 +29,7 @@
|
|
|
<img src="@/img/coursewarePlay/zhishidian.png" />
|
|
|
<div>知识点</div>
|
|
|
</div>
|
|
|
- <div class="posBtn" @click="handleGoBack">
|
|
|
+ <div class="posBtn" @click="handleCoursewareEnd">
|
|
|
<img src="@/img/coursewarePlay/jieshu.png" />
|
|
|
<div>结束</div>
|
|
|
</div>
|
|
@@ -37,6 +37,11 @@
|
|
|
<div class="topTools">
|
|
|
<div class="leftMenu">
|
|
|
<img @click="handleGoBack" class="backImg" src="@/img/coursewarePlay/back.png" />
|
|
|
+ <playRecordTime
|
|
|
+ v-if="route.query.modeId && coursewareTotalTIme && !(userStoreHook.roles === 'GYM')"
|
|
|
+ :modeId="route.query.modeId as string"
|
|
|
+ :coursewareTotalTIme="coursewareTotalTIme"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="midMenu">{{ activeCourseware?.parentData.name || "" }}</div>
|
|
|
<div class="rightMenu"></div>
|
|
@@ -78,13 +83,17 @@
|
|
|
<script setup lang="ts">
|
|
|
import videoPlay from "./videoPlay"
|
|
|
import { getLessonCourseDetail_gym, getLessonCoursewareDetail_gyt } from "@/api/cloudTextbooks.api"
|
|
|
+import { checkWebCourse_gyt } from "@/api/coursewarePlay.api"
|
|
|
import { httpAjaxErrMsg } from "@/plugin/httpAjax"
|
|
|
import userStore from "@/store/modules/user"
|
|
|
import { useRoute } from "vue-router"
|
|
|
-import { shallowRef, ref, computed, watchEffect } from "vue"
|
|
|
+import { shallowRef, ref, computed, watchEffect, onUnmounted, onMounted } from "vue"
|
|
|
import { ElMessageBox } from "element-plus"
|
|
|
import courseCollapse from "./components/courseCollapse"
|
|
|
import pen from "./components/pen"
|
|
|
+import playRecordTime from "./components/playRecordTime"
|
|
|
+import useDialogConfirm from "@/hooks/useDialogConfirm"
|
|
|
+import { getRecentCourseSchedule_gym } from "@/api/homePage.api"
|
|
|
|
|
|
// 批注
|
|
|
const penShow = ref(false)
|
|
@@ -108,7 +117,12 @@ const coursewareTotalTIme = ref(0)
|
|
|
watchEffect(() => {
|
|
|
activeCourseware.value && videoPlayDom.value?.playVideo({ src: activeCourseware.value.content })
|
|
|
})
|
|
|
-
|
|
|
+onMounted(() => {
|
|
|
+ document.addEventListener("keydown", handleVideoKeydown)
|
|
|
+})
|
|
|
+onUnmounted(() => {
|
|
|
+ document.removeEventListener("keydown", handleVideoKeydown)
|
|
|
+})
|
|
|
function getCoursewareList() {
|
|
|
httpAjaxErrMsg(userStoreHook.roles === "GYM" ? getLessonCourseDetail_gym : getLessonCoursewareDetail_gyt, route.params.id as string).then(res => {
|
|
|
if (res.code === 200) {
|
|
@@ -165,6 +179,7 @@ function filterPointList(pointList: any[], parentData?: { ids: string[]; name: s
|
|
|
children: filterPointList(point.children, { ids: [...(parentData?.ids || []), point.id], name: point.name })
|
|
|
})
|
|
|
} else {
|
|
|
+ coursewareTotalTIme.value += point.totalMaterialTimeSecond
|
|
|
return Object.assign(point, {
|
|
|
materialList: point.materialList.map((item: any) => {
|
|
|
item.parentData = {
|
|
@@ -207,6 +222,47 @@ function handleGoBack() {
|
|
|
window.open("about:blank", "_self")
|
|
|
window.close()
|
|
|
}
|
|
|
+function handleCoursewareEnd() {
|
|
|
+ if (route.query.modeId) {
|
|
|
+ if (userStoreHook.roles === "GYM") {
|
|
|
+ httpAjaxErrMsg(getRecentCourseSchedule_gym, route.query.modeId as string).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data?.signOutStatusEnum === 3) {
|
|
|
+ useDialogConfirm({
|
|
|
+ headImg: require("@/img/coursewarePlay/ts.png"),
|
|
|
+ text: `请确认是否结束课程,结束后请到APP进行签退。`,
|
|
|
+ btnShow: [true, true],
|
|
|
+ onOk() {
|
|
|
+ handleGoBack()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ handleGoBack()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ httpAjaxErrMsg(checkWebCourse_gyt, route.query.modeId as string).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data?.signOut === false) {
|
|
|
+ useDialogConfirm({
|
|
|
+ headImg: require("@/img/coursewarePlay/ts.png"),
|
|
|
+ text: `请确认是否结束课程,结束后请到APP进行签退。`,
|
|
|
+ btnShow: [true, true],
|
|
|
+ onOk() {
|
|
|
+ handleGoBack()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ handleGoBack()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ handleGoBack()
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -239,6 +295,8 @@ function handleGoBack() {
|
|
|
justify-content: space-between;
|
|
|
padding: 20px 30px;
|
|
|
.leftMenu {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
.backImg {
|
|
|
cursor: pointer;
|
|
|
width: 22px;
|