|
@@ -17,7 +17,7 @@ import styles from './index.module.less'
|
|
|
import 'plyr/dist/plyr.css'
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import {
|
|
|
postMessage,
|
|
|
promisefiyPostMessage,
|
|
@@ -37,15 +37,15 @@ import {
|
|
|
iconMenu
|
|
|
} from './image/icons.json'
|
|
|
import Points from './component/points'
|
|
|
-import { browser } from '@/helpers/utils'
|
|
|
+import { browser, getHttpOrigin } from '@/helpers/utils'
|
|
|
import { Vue3Lottie } from 'vue3-lottie'
|
|
|
import playLoadData from './datas/data.json'
|
|
|
import { usePageVisibility } from '@vant/use'
|
|
|
-import PlayRecordTime from './playRecordTime'
|
|
|
+// import PlayRecordTime from './playRecordTime'
|
|
|
// import { handleCheckVip } from '../hook/useFee'
|
|
|
import OGuide from './component/o-guide'
|
|
|
import Tool, { ToolItem, ToolType } from './component/tool'
|
|
|
-import Pen from './component/tools/pen'
|
|
|
+// import Pen from './component/tools/pen'
|
|
|
// import VideoItem from './component/video-item';
|
|
|
import VideoPlay from './component/video-play'
|
|
|
import { musicBuy } from '../music'
|
|
@@ -60,6 +60,7 @@ export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
|
setup() {
|
|
|
const browserInfo = browser()
|
|
|
+ const router = useRouter()
|
|
|
const apiSuffix = ref(
|
|
|
baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
|
|
|
)
|
|
@@ -121,9 +122,11 @@ export default defineComponent({
|
|
|
const data = reactive({
|
|
|
source: route.query.source as any, // 来源 search 搜索
|
|
|
searchLoading: false, // 搜索加载状态
|
|
|
- search: route.query.search as any, // 默认的搜索条件 -
|
|
|
- searchTemp: route.query.search as any, // 默认的搜索条件 -
|
|
|
+ search: route.query.search as any, // 默认的搜索条件 -
|
|
|
+ searchTemp: route.query.search as any, // 默认的搜索条件 -
|
|
|
+ isSearch: route.query.source === "search" ? true : false, // 是否搜索
|
|
|
currentId: route.query.id as any,
|
|
|
+ lessonId: null as any,
|
|
|
detail: null as any,
|
|
|
knowledgePointList: [] as any,
|
|
|
itemList: [] as any,
|
|
@@ -295,6 +298,7 @@ export default defineComponent({
|
|
|
const result = res.data || {}
|
|
|
result.lessonTargetDesc = result.lessonTargetDesc ? result.lessonTargetDesc.replace(/\n/g, "<br />") : ""
|
|
|
data.detail = result;
|
|
|
+ data.lessonId = result.lessonCoursewareId
|
|
|
if (res?.data?.lockFlag) {
|
|
|
postMessage({
|
|
|
api: 'courseLoading',
|
|
@@ -475,6 +479,20 @@ export default defineComponent({
|
|
|
allList.push(...itemResult.list)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(data.source !== 'search') {
|
|
|
+ if(params.type === "pointSearch") {
|
|
|
+ detailTempSearchList.value = result
|
|
|
+ popupData.tempTabActive = allList.length > 0 ? allList[0].knowledgePointId : []
|
|
|
+ popupData.tempItemActive = "-1"
|
|
|
+ data.searchTemp = params.search
|
|
|
+ return
|
|
|
+ }
|
|
|
+ detailList.value = result
|
|
|
+ detailTempSearchList.value = result
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if(params.type === 'pointSearch') {
|
|
|
detailTempSearchList.value = result
|
|
|
|
|
@@ -647,7 +665,7 @@ export default defineComponent({
|
|
|
data.refLevelList = res.data || []
|
|
|
return true
|
|
|
} catch {
|
|
|
- //
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -662,6 +680,7 @@ export default defineComponent({
|
|
|
await getRefLevel()
|
|
|
}
|
|
|
await getDetail()
|
|
|
+ data.lessonId && await getSearchDetail({search: data.search, id: data.lessonId})
|
|
|
}
|
|
|
// getCourseSchedule();
|
|
|
window.addEventListener('message', iframeHandle)
|
|
@@ -706,7 +725,7 @@ export default defineComponent({
|
|
|
|
|
|
const popupData = reactive({
|
|
|
pointOpen: false,
|
|
|
- pointContent: "",
|
|
|
+ pointContent: "",
|
|
|
pointTitle: "",
|
|
|
coursewareOpen: false,
|
|
|
open: false,
|
|
@@ -1049,7 +1068,7 @@ export default defineComponent({
|
|
|
data.animationState = 'end'
|
|
|
if(whitePenShow.value || penShow.value || popupData.coursewareOpen || popupData.open || popupData.guideOpen || popupData.pointOpen) {
|
|
|
handleStop()
|
|
|
- }
|
|
|
+ }
|
|
|
}}
|
|
|
onLoadedmetadata={(videoItem: any) => {
|
|
|
data.videoState = 'play'
|
|
@@ -1154,52 +1173,80 @@ export default defineComponent({
|
|
|
|
|
|
<div class={[styles.btnsWrap, styles.prePoint]}>
|
|
|
|
|
|
- {data.source === 'search' ?
|
|
|
+ {/* {data.source === 'search' ?
|
|
|
+ <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ detailTempSearchList.value = detailList.value
|
|
|
+ popupData.tempItemActive = ""
|
|
|
+ popupData.tempTabActive = ""
|
|
|
+ data.searchTemp = ""
|
|
|
+ // data.searchTemp = JSON.parse(JSON.stringify(data.search))
|
|
|
+ popupData.open = true
|
|
|
+ }}>
|
|
|
+ <img src={iconSearch} />
|
|
|
+ </div> : <>
|
|
|
+ {baseState.platformType === "TEACHER" && <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ popupData.coursewareOpen = true
|
|
|
+ }}>
|
|
|
+ <img src={iconCourseType} />
|
|
|
+ </div>}
|
|
|
+
|
|
|
<div class={styles.fullBtn} onClick={() => {
|
|
|
handleStop()
|
|
|
- detailTempSearchList.value = detailList.value
|
|
|
- popupData.tempItemActive = ""
|
|
|
- popupData.tempTabActive = ""
|
|
|
- data.searchTemp = ""
|
|
|
- // data.searchTemp = JSON.parse(JSON.stringify(data.search))
|
|
|
popupData.open = true
|
|
|
}}>
|
|
|
- <img src={iconSearch} />
|
|
|
- </div> : <>
|
|
|
- {baseState.platformType === "TEACHER" && <div class={styles.fullBtn} onClick={() => {
|
|
|
- handleStop()
|
|
|
- popupData.coursewareOpen = true
|
|
|
- }}>
|
|
|
- <img src={iconCourseType} />
|
|
|
- </div>}
|
|
|
-
|
|
|
- <div class={styles.fullBtn} onClick={() => {
|
|
|
- handleStop()
|
|
|
- popupData.open = true
|
|
|
- }}>
|
|
|
- <img src={iconMenu} />
|
|
|
- {/* <span>知识点</span> */}
|
|
|
- </div>
|
|
|
- </>}
|
|
|
- <div
|
|
|
- class={[styles.fullBtn, !(popupData.activeIndex != 0) && styles.disabled]}
|
|
|
- onClick={() => {
|
|
|
- if(popupData.activeIndex != 0) handlePreAndNext('up')
|
|
|
- }}
|
|
|
- >
|
|
|
- <img src={iconUp} />
|
|
|
- {/* <span style={{ textAlign: 'center' }}>上一个</span> */}
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class={[styles.fullBtn, !(popupData.activeIndex != data.itemList.length - 1) && styles.disabled]}
|
|
|
- onClick={() => {
|
|
|
- if(popupData.activeIndex != data.itemList.length - 1) handlePreAndNext('down')
|
|
|
- }}
|
|
|
- >
|
|
|
- {/* <span style={{ textAlign: 'center' }}>下一个</span> */}
|
|
|
- <img src={iconDown} />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <img src={iconMenu} />
|
|
|
+ </div>
|
|
|
+ </>} */}
|
|
|
+
|
|
|
+ {baseState.platformType === "TEACHER" && data.source !== 'search' && <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ popupData.coursewareOpen = true
|
|
|
+ }}>
|
|
|
+ <img src={iconCourseType} />
|
|
|
+ </div>}
|
|
|
+
|
|
|
+ <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ detailTempSearchList.value = detailList.value
|
|
|
+ data.isSearch = true
|
|
|
+ popupData.tempItemActive = ""
|
|
|
+ popupData.tempTabActive = ""
|
|
|
+ data.searchTemp = ""
|
|
|
+ // data.searchTemp = JSON.parse(JSON.stringify(data.search))
|
|
|
+ popupData.open = true
|
|
|
+ }}>
|
|
|
+ <img src={iconSearch} />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {data.source !== 'search' && <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ data.isSearch = false
|
|
|
+ popupData.open = true
|
|
|
+ }}>
|
|
|
+ <img src={iconMenu} />
|
|
|
+ </div>}
|
|
|
+
|
|
|
+ <div
|
|
|
+ class={[styles.fullBtn, !(popupData.activeIndex != 0) && styles.disabled]}
|
|
|
+ onClick={() => {
|
|
|
+ if(popupData.activeIndex != 0) handlePreAndNext('up')
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <img src={iconUp} />
|
|
|
+ {/* <span style={{ textAlign: 'center' }}>上一个</span> */}
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class={[styles.fullBtn, !(popupData.activeIndex != data.itemList.length - 1) && styles.disabled]}
|
|
|
+ onClick={() => {
|
|
|
+ if(popupData.activeIndex != data.itemList.length - 1) handlePreAndNext('down')
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {/* <span style={{ textAlign: 'center' }}>下一个</span> */}
|
|
|
+ <img src={iconDown} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
)}
|
|
|
</Transition>
|
|
@@ -1263,7 +1310,7 @@ export default defineComponent({
|
|
|
v-model:show={popupData.open}
|
|
|
onClose={handleClosePopup}
|
|
|
>
|
|
|
- {data.source === 'search' ?
|
|
|
+ {data.isSearch ?
|
|
|
<PointsSearch
|
|
|
data={detailTempSearchList.value}
|
|
|
search={data.searchTemp || data.search}
|
|
@@ -1272,6 +1319,38 @@ export default defineComponent({
|
|
|
itemActive={popupData.tempItemActive || popupData.itemActive}
|
|
|
open={popupData.open}
|
|
|
onHandleSelect={(res: any) => {
|
|
|
+ if(data.source !== "search") {
|
|
|
+ if (browser().isApp) {
|
|
|
+ postMessage({
|
|
|
+ api: 'openWebView',
|
|
|
+ content: {
|
|
|
+ url: `${getHttpOrigin()}${location.pathname}#/coursewarePlay?lessonId=${data.refLevelList}&source=search&kId=${res.materialId}&search=${encodeURIComponent(data.searchTemp ? JSON.parse(JSON.stringify(data.searchTemp)) : '')}`,
|
|
|
+ orientation: 0,
|
|
|
+ isHideTitle: true,
|
|
|
+ statusBarTextColor: false,
|
|
|
+ isOpenLight: true,
|
|
|
+ showLoadingAnim: true
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ router.push({
|
|
|
+ path: '/coursewarePlay',
|
|
|
+ query: {
|
|
|
+ lessonId: data.lessonId,
|
|
|
+ kId: res.materialId,
|
|
|
+ search: data.searchTemp ? JSON.parse(JSON.stringify(data.searchTemp)) : '',
|
|
|
+ source: 'search'
|
|
|
+ }
|
|
|
+ }).then(() => {
|
|
|
+ window.location.reload()
|
|
|
+ });
|
|
|
+
|
|
|
+ // Toast('请使用App打开')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
popupData.open = false;
|
|
|
if(res.isSearch) {
|
|
|
detailList.value = detailTempSearchList.value
|
|
@@ -1289,13 +1368,21 @@ export default defineComponent({
|
|
|
onHandleSearch={async (val: any) => {
|
|
|
data.searchLoading = true
|
|
|
detailTempSearchList.value = []
|
|
|
- await getSearchDetail({
|
|
|
- type: 'pointSearch',
|
|
|
- search: val.search
|
|
|
- })
|
|
|
+ if(data.source === 'search') {
|
|
|
+ await getSearchDetail({
|
|
|
+ type: 'pointSearch',
|
|
|
+ search: val.search
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ await getSearchDetail({
|
|
|
+ type: 'pointSearch',
|
|
|
+ search: val.search,
|
|
|
+ id: data.lessonId
|
|
|
+ })
|
|
|
+ }
|
|
|
data.searchTemp = val.search;
|
|
|
data.searchLoading = false
|
|
|
- }} /> :
|
|
|
+ }} /> :
|
|
|
<Points
|
|
|
data={data.knowledgePointList}
|
|
|
tabActive={popupData.tabActive}
|
|
@@ -1324,6 +1411,7 @@ export default defineComponent({
|
|
|
data.currentId = item.id;
|
|
|
const n = await getDetail(item.id);
|
|
|
const s = await getRefLevel(item.id);
|
|
|
+ data.isSearch = false
|
|
|
if(n && s) {
|
|
|
popupData.coursewareOpen = false;
|
|
|
popupData.activeIndex = 0;
|
|
@@ -1336,6 +1424,7 @@ export default defineComponent({
|
|
|
Toast('网络异常')
|
|
|
}
|
|
|
}
|
|
|
+ data.lessonId && await getSearchDetail({search: data.search, id: data.lessonId})
|
|
|
}} />
|
|
|
</Popup>
|
|
|
|