|
@@ -17,7 +17,7 @@ import styles from './index.module.less'
|
|
|
import 'plyr/dist/plyr.css'
|
|
|
import request from '@/helpers/request'
|
|
|
import { setLogin, state } from '@/state'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import { listenerMessage, postMessage, promisefiyPostMessage } from '@/helpers/native-message'
|
|
|
import qs from 'query-string'
|
|
|
import MusicScore from './component/musicScore'
|
|
@@ -132,16 +132,19 @@ export default defineComponent({
|
|
|
})
|
|
|
|
|
|
const route = useRoute()
|
|
|
+ const router = useRouter()
|
|
|
const headeRef = ref()
|
|
|
const isCurrentCoursewareMenu = shallowRef(true) // 是否为当前选的课程类型
|
|
|
const detailTempSearchList = shallowRef<any[]>()
|
|
|
- const detailList = shallowRef<any[]>()// 搜索来的所有数据
|
|
|
+ const detailList = shallowRef<any[]>()// 搜索来的所有数据
|
|
|
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,
|
|
@@ -329,6 +332,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',
|
|
@@ -505,6 +509,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
|
|
|
|
|
@@ -540,7 +558,7 @@ export default defineComponent({
|
|
|
popupData.itemName = item.name;
|
|
|
data.detail = detailList.value?.find((child: any) => child.lessonCoursewareDetailId === item.lessonCoursewareDetailId)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
nextTick(() => {
|
|
|
data.itemList = allList;
|
|
|
getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
|
|
@@ -562,7 +580,7 @@ export default defineComponent({
|
|
|
}, 500);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+
|
|
|
return true
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
@@ -695,7 +713,7 @@ export default defineComponent({
|
|
|
data.refLevelList = res.data || []
|
|
|
return true
|
|
|
} catch {
|
|
|
- //
|
|
|
+ //
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -713,6 +731,7 @@ export default defineComponent({
|
|
|
await getRefLevel()
|
|
|
}
|
|
|
await getDetail()
|
|
|
+ data.lessonId && await getSearchDetail({search: data.search, id: data.lessonId})
|
|
|
}
|
|
|
// console.log(data.detail, "data.detail");
|
|
|
// const hasFree = String(data.detail?.accessScope) === '0'
|
|
@@ -773,7 +792,7 @@ export default defineComponent({
|
|
|
|
|
|
const popupData = reactive({
|
|
|
pointOpen: false,
|
|
|
- pointContent: "",
|
|
|
+ pointContent: "",
|
|
|
pointTitle: "",
|
|
|
coursewareOpen: false,
|
|
|
open: false,
|
|
@@ -1036,7 +1055,7 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (type === 'up') {
|
|
|
handleSwipeChange(popupData.activeIndex - 1)
|
|
|
} else {
|
|
@@ -1299,7 +1318,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'
|
|
@@ -1452,52 +1471,53 @@ export default defineComponent({
|
|
|
{activeData.model && (
|
|
|
<div class={styles.leftFixedBtns} onClick={(e: Event) => e.stopPropagation()}>
|
|
|
<div class={[styles.btnsWrap, styles.prePoint]}>
|
|
|
- {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> : <>
|
|
|
- {state.platformType === 'TEACHER' && <div class={styles.fullBtn} onClick={() => {
|
|
|
+
|
|
|
+ {state.platformType === 'TEACHER' && data.source !== 'search' && <div class={styles.fullBtn} onClick={() => {
|
|
|
popupData.coursewareOpen = true
|
|
|
handleStop()
|
|
|
}}>
|
|
|
<img src={iconCourseType} />
|
|
|
</div>}
|
|
|
-
|
|
|
- <div class={styles.fullBtn} onClick={() => {
|
|
|
- popupData.open = true
|
|
|
- handleStop()
|
|
|
- }}>
|
|
|
- <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 class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ data.isSearch = true
|
|
|
+ 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>
|
|
|
+
|
|
|
+ {data.source !== 'search' && <div class={styles.fullBtn} onClick={() => {
|
|
|
+ popupData.open = true
|
|
|
+ data.isSearch = false
|
|
|
+ handleStop()
|
|
|
+ }}>
|
|
|
+ <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>
|
|
|
</div>
|
|
|
)}
|
|
@@ -1595,7 +1615,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}
|
|
@@ -1604,6 +1624,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: `${location.origin}${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
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(res.isSearch) {
|
|
|
detailList.value = detailTempSearchList.value
|
|
|
const tempList: any[] = []
|
|
@@ -1630,13 +1682,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}
|
|
@@ -1647,7 +1707,7 @@ export default defineComponent({
|
|
|
toggleMaterial(res.itemActive)
|
|
|
}}
|
|
|
/>}
|
|
|
-
|
|
|
+
|
|
|
</Popup>
|
|
|
|
|
|
<Popup
|
|
@@ -1666,6 +1726,7 @@ export default defineComponent({
|
|
|
|
|
|
const n = await getDetail(item.id);
|
|
|
const s = await getRefLevel(item.id);
|
|
|
+ data.isSearch = false
|
|
|
if(n && s) {
|
|
|
data.currentId = item.id;
|
|
|
isCurrentCoursewareMenu.value = item.id === route.query.id ? true : false
|
|
@@ -1680,6 +1741,7 @@ export default defineComponent({
|
|
|
showToast('网络异常')
|
|
|
}
|
|
|
}
|
|
|
+ data.lessonId && await getSearchDetail({search: data.search, id: data.lessonId})
|
|
|
}} />
|
|
|
</Popup>
|
|
|
|