|
@@ -28,7 +28,7 @@ import { browser } from '@/helpers/utils'
|
|
|
import { Vue3Lottie } from 'vue3-lottie'
|
|
|
import playLoadData from './datas/data.json'
|
|
|
import { usePageVisibility } from '@vant/use'
|
|
|
-import { useInterval, useIntervalFn } from '@vueuse/core'
|
|
|
+import { useInterval, useIntervalFn, useNetwork } from '@vueuse/core'
|
|
|
import PlayRecordTime from './playRecordTime'
|
|
|
import { handleCheckVip } from '../hook/useFee'
|
|
|
import OGuide from '@/components/o-guide'
|
|
@@ -37,11 +37,15 @@ import Pen from './component/tools/pen'
|
|
|
import VideoItem from './component/video-item'
|
|
|
import deepClone from '@/helpers/deep-clone'
|
|
|
import VideoPlay from './component/video-play'
|
|
|
+import CoursewareType from './component/courseware-type'
|
|
|
+import CoursewareTips from './component/courseware-tips'
|
|
|
+import GlobalTools from '@/components/globalTools'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
|
setup() {
|
|
|
const pageVisibility = usePageVisibility()
|
|
|
+ const { isOnline } = useNetwork()
|
|
|
/** 页面显示和隐藏 */
|
|
|
watch(
|
|
|
() => pageVisibility.value,
|
|
@@ -112,6 +116,7 @@ export default defineComponent({
|
|
|
const route = useRoute()
|
|
|
const headeRef = ref()
|
|
|
const data = reactive({
|
|
|
+ currentId: route.query.id as any,
|
|
|
detail: null as any,
|
|
|
knowledgePointList: [] as any,
|
|
|
itemList: [] as any,
|
|
@@ -120,7 +125,7 @@ export default defineComponent({
|
|
|
isCourse: false,
|
|
|
isRecordPlay: false,
|
|
|
videoRefs: {},
|
|
|
-
|
|
|
+ refLevelList: [] as any,
|
|
|
videoState: 'init' as 'init' | 'play',
|
|
|
videoItemRef: null as any,
|
|
|
animationState: 'start' as 'start' | 'end',
|
|
@@ -272,15 +277,17 @@ export default defineComponent({
|
|
|
}, 500)
|
|
|
})
|
|
|
}
|
|
|
- const getDetail = async () => {
|
|
|
+ const getDetail = async (id?: any) => {
|
|
|
try {
|
|
|
const res: any = await request.get(
|
|
|
- state.platformApi + `/lessonCoursewareDetail/detail/${route.query.id}`,
|
|
|
+ state.platformApi + `/lessonCoursewareDetail/detail/${id || route.query.id}`,
|
|
|
{
|
|
|
hideLoading: true
|
|
|
}
|
|
|
)
|
|
|
- data.detail = res.data
|
|
|
+ const result = res.data || {}
|
|
|
+ result.lessonTargetDesc = result.lessonTargetDesc ? result.lessonTargetDesc.replace(/\n/g, "<br />") : ""
|
|
|
+ data.detail = result;
|
|
|
if (res?.data?.lockFlag) {
|
|
|
postMessage({
|
|
|
api: 'courseLoading',
|
|
@@ -336,11 +343,24 @@ export default defineComponent({
|
|
|
})
|
|
|
getItemList()
|
|
|
}
|
|
|
+ return true
|
|
|
} catch (error) {
|
|
|
console.log(error)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const onTitleTip = (type: "phaseGoals" | "checkItem", text: string) => {
|
|
|
+ handleStop()
|
|
|
+ popupData.pointOpen = true
|
|
|
+ popupData.pointContent = text
|
|
|
+ if(type === "checkItem") {
|
|
|
+ popupData.pointTitle = '检查事项'
|
|
|
+ } else if(type === "phaseGoals") {
|
|
|
+ popupData.pointTitle = '阶段目标'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// ifram事件处理
|
|
|
const iframeHandle = (ev: MessageEvent) => {
|
|
|
if (ev.data?.api === 'headerTogge') {
|
|
@@ -443,12 +463,28 @@ export default defineComponent({
|
|
|
//
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ const getRefLevel = async (id?: any) => {
|
|
|
+ try {
|
|
|
+ const res = await request.post(state.platformApi + '/tenantAlbumMusic/refLevel', {
|
|
|
+ data: {
|
|
|
+ lessonCoursewareDetailId: id || route.query.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ data.refLevelList = res.data || []
|
|
|
+ return true
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await sysParamConfig()
|
|
|
|
|
|
if (state.platformType === 'STUDENT') {
|
|
|
await getLookVideoData()
|
|
|
}
|
|
|
+ await getRefLevel()
|
|
|
await getDetail()
|
|
|
const hasFree = String(data.detail?.accessScope) === '0'
|
|
|
if (!hasFree) {
|
|
@@ -507,6 +543,10 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
const popupData = reactive({
|
|
|
+ pointOpen: false,
|
|
|
+ pointContent: "",
|
|
|
+ pointTitle: "",
|
|
|
+ coursewareOpen: false,
|
|
|
open: false,
|
|
|
activeIndex: 0,
|
|
|
playIndex: 0,
|
|
@@ -1136,30 +1176,24 @@ export default defineComponent({
|
|
|
<img src={iconMenu} />
|
|
|
{/* <span>知识点</span> */}
|
|
|
</div>
|
|
|
- {popupData.activeIndex != 0 && (
|
|
|
-
|
|
|
<div
|
|
|
- class={styles.fullBtn}
|
|
|
+ class={[styles.fullBtn, !(popupData.activeIndex != 0) && styles.disabled]}
|
|
|
onClick={() => {
|
|
|
- handlePreAndNext('up')
|
|
|
+ if(popupData.activeIndex != 0) handlePreAndNext('up')
|
|
|
}}
|
|
|
>
|
|
|
<img src={iconUp} />
|
|
|
{/* <span style={{ textAlign: 'center' }}>上一个</span> */}
|
|
|
</div>
|
|
|
-
|
|
|
- )}
|
|
|
- {popupData.activeIndex != data.itemList.length - 1 && (
|
|
|
<div
|
|
|
- class={styles.fullBtn}
|
|
|
+ class={[styles.fullBtn, !(popupData.activeIndex != data.itemList.length - 1) && styles.disabled]}
|
|
|
onClick={() => {
|
|
|
- handlePreAndNext('down')
|
|
|
+ if(popupData.activeIndex != data.itemList.length - 1) handlePreAndNext('down')
|
|
|
}}
|
|
|
>
|
|
|
{/* <span style={{ textAlign: 'center' }}>下一个</span> */}
|
|
|
<img src={iconDown} />
|
|
|
</div>
|
|
|
- )}
|
|
|
</div>
|
|
|
</div>
|
|
|
)}
|
|
@@ -1175,12 +1209,18 @@ export default defineComponent({
|
|
|
<div class={styles.backBtn} onClick={() => goback()}>
|
|
|
<Icon name={iconBack} />
|
|
|
<div class={styles.titleSection}>
|
|
|
- <div class={styles.title}>{popupData.tabName}</div>
|
|
|
+ {/* <div class={styles.title}>{popupData.tabName}</div>
|
|
|
<div class={styles.titleContent}>
|
|
|
<p>第3条练习6-15小节-演奏-练习</p>
|
|
|
<span>阶段目标</span>
|
|
|
<span>检查事项</span>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
+ <div class={styles.title}>{popupData.tabName}</div>
|
|
|
+ <div class={styles.titleContent}>
|
|
|
+ <p>{data.itemList[popupData.activeIndex]?.name}</p>
|
|
|
+ {data.detail?.lessonTargetDesc ? <span onClick={() => onTitleTip('phaseGoals', data.detail?.lessonTargetDesc)}>阶段目标</span>: ""}
|
|
|
+ {data.itemList[popupData.activeIndex]?.checkItem ? <span onClick={() => onTitleTip('checkItem', data.itemList[popupData.activeIndex]?.checkItem)}>检查事项</span> : ""}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
{data.isCourse && <PlayRecordTime ref={playRef} list={data.knowledgePointList} />}
|
|
@@ -1271,7 +1311,37 @@ export default defineComponent({
|
|
|
</Popup>
|
|
|
|
|
|
<Popup
|
|
|
- class={styles.popup}
|
|
|
+ class={[styles.popup, styles.popupCoursewarePlay]}
|
|
|
+ overlayClass={styles.overlayClass}
|
|
|
+ position="right"
|
|
|
+ round
|
|
|
+ v-model:show={popupData.coursewareOpen}
|
|
|
+ onClose={handleClosePopup}>
|
|
|
+ {/* 课件类型 */}
|
|
|
+ <CoursewareType list={data.refLevelList} onConfirm={async (item: any) => {
|
|
|
+ // 判断是否为当前课程类型
|
|
|
+ if(data.currentId === item.id) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ data.currentId = item.id;
|
|
|
+ const n = await getDetail(item.id);
|
|
|
+ const s = await getRefLevel(item.id);
|
|
|
+ if(n && s) {
|
|
|
+ popupData.coursewareOpen = false;
|
|
|
+ popupData.activeIndex = 0;
|
|
|
+ nextTick(() => {
|
|
|
+ popupData.open = true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if(!isOnline.value) {
|
|
|
+ showToast('网络异常')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }} />
|
|
|
+ </Popup>
|
|
|
+
|
|
|
+ <Popup
|
|
|
+ class={[styles.popup, styles.popupCoursewarePlay]}
|
|
|
overlayClass={styles.overlayClass}
|
|
|
position="right"
|
|
|
round
|
|
@@ -1281,9 +1351,18 @@ export default defineComponent({
|
|
|
<OGuide />
|
|
|
</Popup>
|
|
|
|
|
|
- {studyData.penShow && (
|
|
|
- <Pen show={studyData.type === 'pen'} close={() => closeStudyTool()} />
|
|
|
- )}
|
|
|
+ <Popup
|
|
|
+ class={[styles.popup, styles.popupPoint]}
|
|
|
+ round
|
|
|
+ style={{ background: 'transparent !important' }}
|
|
|
+ v-model:show={popupData.pointOpen}
|
|
|
+ onClose={handleClosePopup}>
|
|
|
+ <CoursewareTips onClose={() => {
|
|
|
+ popupData.pointOpen = false
|
|
|
+ }} content={popupData.pointContent} titleName={popupData.pointTitle} />
|
|
|
+ </Popup>
|
|
|
+
|
|
|
+ <GlobalTools />
|
|
|
</div>
|
|
|
)
|
|
|
}
|