|
@@ -8,7 +8,8 @@ import {
|
|
|
ref,
|
|
|
watch,
|
|
|
Transition,
|
|
|
- computed
|
|
|
+ computed,
|
|
|
+ shallowRef
|
|
|
} from 'vue';
|
|
|
import iconBack from './image/back.svg';
|
|
|
import styles from './index.module.less';
|
|
@@ -25,7 +26,7 @@ import MusicScore from './component/musicScore';
|
|
|
// import iconDian from './image/icon-dian.svg';
|
|
|
// import iconPoint from './image/icon-point.svg';
|
|
|
// import qs from 'query-string';
|
|
|
-import { iconUp, iconDown, iconTouping, iconMenu, iconCourseType } from './image/icons.json';
|
|
|
+import { iconUp, iconDown, iconTouping, iconMenu, iconCourseType, iconSearch } from './image/icons.json';
|
|
|
import Points from './component/points';
|
|
|
import { browser } from '@/helpers/utils';
|
|
|
import { Vue3Lottie } from 'vue3-lottie';
|
|
@@ -42,6 +43,7 @@ import CoursewareTips from './component/courseware-tips';
|
|
|
import GlobalTools from '@/components/globalTools';
|
|
|
import { isHidden, isPlay, penShow, toolOpen, whitePenShow } from '@/components/globalTools/globalTools';
|
|
|
import { vaildCurrentUrl } from '@/helpers/validate';
|
|
|
+import PointsSearch from './component/points-search';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
@@ -56,8 +58,17 @@ export default defineComponent({
|
|
|
handleStop();
|
|
|
}
|
|
|
if (value === "visible") {
|
|
|
- getDetail('visible', data.currentId)
|
|
|
- getRefLevel(data.currentId)
|
|
|
+ if(data.source === 'search') {
|
|
|
+ getSearchDetail({
|
|
|
+ type: 'visible',
|
|
|
+ id: data.currentId,
|
|
|
+ search: data.search
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ getDetail('visible', data.currentId)
|
|
|
+ getRefLevel(data.currentId)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
);
|
|
@@ -121,9 +132,16 @@ export default defineComponent({
|
|
|
|
|
|
const route = useRoute();
|
|
|
const headeRef = ref();
|
|
|
+ const detailTempSearchList = shallowRef<any[]>()
|
|
|
+ const detailList = shallowRef<any[]>()// 搜索来的所有数据
|
|
|
const data = reactive({
|
|
|
- currentId: route.query.id as any,
|
|
|
+ source: route.query.source as any, // 来源 search 搜索
|
|
|
+ searchLoading: false, // 搜索加载状态
|
|
|
+ search: route.query.search as any, // 默认的搜索条件 -
|
|
|
+ searchTemp: route.query.search as any, // 默认的搜索条件 -
|
|
|
+ currentId: route.query.id as any || route.query.lessonId as any,
|
|
|
lessonCoursewareId: "",
|
|
|
+ // detailList: [], // 搜索来的所有数据
|
|
|
detail: null as any,
|
|
|
refLevelList: [] as any, // 课堂类型
|
|
|
knowledgePointList: [] as any,
|
|
@@ -132,7 +150,6 @@ export default defineComponent({
|
|
|
// isCourse: false,
|
|
|
isRecordPlay: false,
|
|
|
videoRefs: {},
|
|
|
-
|
|
|
videoState: 'init' as 'init' | 'play',
|
|
|
videoItemRef: null as any,
|
|
|
animationState: 'start' as 'start' | 'end',
|
|
@@ -313,7 +330,7 @@ export default defineComponent({
|
|
|
title: '温馨提示',
|
|
|
message: '课件已锁定'
|
|
|
}).then(() => {
|
|
|
- goback();
|
|
|
+ goBack();
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -383,6 +400,217 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ const getSearchItemList = async (knowledgePointList: any[]) => {
|
|
|
+ const list: any = [];
|
|
|
+
|
|
|
+ for (let i = 0; i < knowledgePointList.length; i++) {
|
|
|
+ const item = knowledgePointList[i];
|
|
|
+ if (item.materialList && item.materialList.length > 0) {
|
|
|
+ const tempList = await getTempList(item.materialList, item.name);
|
|
|
+ list.push(...tempList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 第二层级
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ const childrenList = item.children || [];
|
|
|
+ for (let j = 0; j < childrenList.length; j++) {
|
|
|
+ const childItem = childrenList[j];
|
|
|
+ const tempList = await getTempList(
|
|
|
+ childItem.materialList,
|
|
|
+ childItem.name
|
|
|
+ );
|
|
|
+ list.push(...tempList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ /** 搜索页面 获取当前播放元素 */
|
|
|
+ const checkRecursionCoursewareId = (list: [], id: string) => {
|
|
|
+ list.forEach((parent: any) => {
|
|
|
+ if(Array.isArray(parent.materialList)) {
|
|
|
+ const parentMaterial = parent.materialList || []
|
|
|
+ parentMaterial.forEach((item: any) => {
|
|
|
+ console.log(item.materialId, id, '------------------------------')
|
|
|
+ if(item.materialId == id) {
|
|
|
+ console.log(item, '---------------')
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(Array.isArray(parent.child)) {
|
|
|
+ const parentItem = parent.child || []
|
|
|
+ checkRecursionCoursewareId(parentItem, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const getSearchParentCoursewareId = (list: [], id: string) => {
|
|
|
+ if(!id || list.length <= 0) return
|
|
|
+
|
|
|
+ // list.knowledgePointList.forEach(element => {
|
|
|
+
|
|
|
+ // });
|
|
|
+ // let coursewareDetailId = ''
|
|
|
+ console.log(list, '12121--------')
|
|
|
+ list.forEach((parent: any) => {
|
|
|
+ if(Array.isArray(parent.knowledgePointList)) {
|
|
|
+ const parentItem = parent.knowledgePointList || []
|
|
|
+ console.log(checkRecursionCoursewareId(parentItem, id))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 从搜索页面来的 */
|
|
|
+ const getSearchDetail = async (params: { type?: string, id?: any, search?: string }) => {
|
|
|
+ try {
|
|
|
+ const res = await request.get(
|
|
|
+ state.platformApi +
|
|
|
+ `/lessonCourseware/getLessonCoursewareCourseList/${params.id || route.query.lessonId}`,
|
|
|
+ {
|
|
|
+ hideLoading: true,
|
|
|
+ params: {
|
|
|
+ search: params.search
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ const result = res.data || []
|
|
|
+ const allList: any[] = []
|
|
|
+ for(let i = 0; i < result.length; i++) {
|
|
|
+ const itemResult = result[i];
|
|
|
+ itemResult.name = itemResult.coursewareDetailName;
|
|
|
+ itemResult.id = itemResult.coursewareDetailId;
|
|
|
+ itemResult.lessonTargetDesc = itemResult.lessonTargetDesc ? itemResult.lessonTargetDesc.replace(/\n/g, "<br />") : ""
|
|
|
+ if (Array.isArray(itemResult?.knowledgePointList)) {
|
|
|
+ let index = 0;
|
|
|
+ itemResult.children = itemResult.knowledgePointList.map(
|
|
|
+ (n: any) => {
|
|
|
+ if (Array.isArray(n.materialList)) {
|
|
|
+ n.materialList = n.materialList.map((item: any) => {
|
|
|
+ index++;
|
|
|
+ const materialRefs = item.materialRefs
|
|
|
+ ? item.materialRefs
|
|
|
+ : [];
|
|
|
+ const materialMusicId =
|
|
|
+ materialRefs.length > 0
|
|
|
+ ? materialRefs[0].resourceIdStr
|
|
|
+ : null;
|
|
|
+ const useStatus = materialRefs.length > 0
|
|
|
+ ? materialRefs[0]?.extend?.useStatus : null
|
|
|
+ const isLock = useStatus === 'LOCK' && state.platformType === "STUDENT" ? true : false
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isLock,
|
|
|
+ materialMusicId,
|
|
|
+ content: item.content,
|
|
|
+ coursewareDetailId: itemResult.coursewareDetailId,
|
|
|
+ knowledgePointId: [itemResult.coursewareDetailId, item.knowledgePointId],
|
|
|
+ materialId: item.id,
|
|
|
+ id: index + ''
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (Array.isArray(n.children)) {
|
|
|
+ n.children = n.children.map((cn: any) => {
|
|
|
+ cn.materialList = cn.materialList.map((item: any) => {
|
|
|
+ index++;
|
|
|
+ const materialRefs = item.materialRefs
|
|
|
+ ? item.materialRefs
|
|
|
+ : [];
|
|
|
+ const materialMusicId =
|
|
|
+ materialRefs.length > 0
|
|
|
+ ? materialRefs[0].resourceIdStr
|
|
|
+ : null;
|
|
|
+ const useStatus = materialRefs.length > 0
|
|
|
+ ? materialRefs[0]?.extend?.useStatus : null
|
|
|
+ const isLock = useStatus === 'LOCK' && state.platformType === "STUDENT" ? true : false
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ isLock,
|
|
|
+ materialMusicId,
|
|
|
+ coursewareDetailId: itemResult.coursewareDetailId,
|
|
|
+ content: item.content,
|
|
|
+ knowledgePointId: [itemResult.coursewareDetailId, n.id, item.knowledgePointId],
|
|
|
+ materialId: item.id,
|
|
|
+ id: index + ''
|
|
|
+ };
|
|
|
+ });
|
|
|
+ return cn;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return n;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ itemResult.knowledgePointList = null // 去掉不要的
|
|
|
+ itemResult.list = await getSearchItemList(itemResult.children);
|
|
|
+
|
|
|
+ allList.push(...itemResult.list)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(params.type === 'pointSearch') {
|
|
|
+ detailTempSearchList.value = result
|
|
|
+ return
|
|
|
+ }
|
|
|
+ detailList.value = result
|
|
|
+ detailTempSearchList.value = result
|
|
|
+
|
|
|
+ // getSearchParentCoursewareId(result, route.query.kId as any)
|
|
|
+
|
|
|
+ if(!params.type) {
|
|
|
+ let _firstIndex = allList.findIndex(
|
|
|
+ (n: any) =>
|
|
|
+ n.knowledgePointMaterialRelationId == route.query.kId ||
|
|
|
+ n.materialId == route.query.kId
|
|
|
+ );
|
|
|
+ _firstIndex = _firstIndex > -1 ? _firstIndex : 0;
|
|
|
+ const item = allList[_firstIndex];
|
|
|
+ console.log(item, 'item')
|
|
|
+ // console.log(_firstIndex, '_firstIndex', route.query.kId, 'route.query.kId', item)
|
|
|
+ // 是否自动播放
|
|
|
+ if (activeData.isAutoPlay) {
|
|
|
+ item.autoPlay = true;
|
|
|
+ }
|
|
|
+ popupData.activeIndex = _firstIndex;
|
|
|
+ popupData.playIndex = _firstIndex;
|
|
|
+ popupData.tabName = item.tabName;
|
|
|
+ popupData.tabActive = item.knowledgePointId;
|
|
|
+ popupData.itemActive = item.id;
|
|
|
+ popupData.itemName = item.name;
|
|
|
+
|
|
|
+ data.detail = detailList.value?.find((child: any) => child.coursewareDetailId === item.coursewareDetailId)
|
|
|
+ }
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ data.itemList = allList;
|
|
|
+ checkedAnimation(popupData.activeIndex);
|
|
|
+ postMessage({
|
|
|
+ api: 'courseLoading',
|
|
|
+ content: {
|
|
|
+ show: false,
|
|
|
+ type: 'fullscreen'
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (data.disableScreenRecordingFlag === '1') {
|
|
|
+ // 检测是否录屏
|
|
|
+ handleLimitScreenRecord();
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ data.animationState = 'end';
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ return true
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const onTitleTip = (type: "phaseGoals" | "checkItem", text: string) => {
|
|
|
handleStop()
|
|
|
popupData.pointOpen = true
|
|
@@ -500,8 +728,12 @@ export default defineComponent({
|
|
|
onMounted(async () => {
|
|
|
isHidden.value = true;
|
|
|
await sysParamConfig();
|
|
|
- await getRefLevel()
|
|
|
- await getDetail();
|
|
|
+ if(data.source === 'search') {
|
|
|
+ await getSearchDetail({search: data.search})
|
|
|
+ } else {
|
|
|
+ await getRefLevel()
|
|
|
+ await getDetail();
|
|
|
+ }
|
|
|
isHidden.value = false;
|
|
|
// getCourseSchedule();
|
|
|
window.addEventListener('message', iframeHandle);
|
|
@@ -525,7 +757,7 @@ export default defineComponent({
|
|
|
|
|
|
const playRef = ref();
|
|
|
// 返回
|
|
|
- const goback = () => {
|
|
|
+ const goBack = () => {
|
|
|
try {
|
|
|
playRef.value?.handleOut();
|
|
|
} catch (error) {
|
|
@@ -677,6 +909,10 @@ export default defineComponent({
|
|
|
const acitveTimer = ref();
|
|
|
// 轮播切换
|
|
|
const handleSwipeChange = async (index: number) => {
|
|
|
+ if(data.source === 'search') {
|
|
|
+ // const item = data.itemList[index];
|
|
|
+ // data.detail = detailList.value?.find((child: any) => child.coursewareDetailId === item.coursewareDetailId)
|
|
|
+ }
|
|
|
// 如果是当前正在播放 或者是视频最后一个
|
|
|
if (popupData.activeIndex == index) return;
|
|
|
await handleStop();
|
|
@@ -1102,20 +1338,29 @@ export default defineComponent({
|
|
|
{activeData.model && (
|
|
|
<div class={styles.leftFixedBtns} onClick={(e: Event) => e.stopPropagation()}>
|
|
|
<div class={[styles.btnsWrap, styles.prePoint]}>
|
|
|
- <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>
|
|
|
-
|
|
|
+ {data.source === 'search' ?
|
|
|
+ <div class={styles.fullBtn} onClick={() => {
|
|
|
+ handleStop()
|
|
|
+ detailTempSearchList.value = detailList.value
|
|
|
+ // data.searchTemp = JSON.parse(JSON.stringify(data.search))
|
|
|
+ popupData.open = true
|
|
|
+ }}>
|
|
|
+ <img src={iconSearch} />
|
|
|
+ </div> : <>
|
|
|
+ <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} />
|
|
|
+ </div>
|
|
|
+ </>}
|
|
|
+
|
|
|
<div
|
|
|
class={[styles.fullBtn, !(popupData.activeIndex != 0) && styles.disabled]}
|
|
|
onClick={() => {
|
|
@@ -1147,11 +1392,11 @@ export default defineComponent({
|
|
|
ref={headeRef}
|
|
|
>
|
|
|
<div class={styles.backBtn}>
|
|
|
- <Icon name={iconBack} onClick={goback} />
|
|
|
+ <Icon name={iconBack} onClick={goBack} />
|
|
|
<div class={styles.titleSection}>
|
|
|
- <div class={styles.title} onClick={goback}>{popupData.tabName}</div>
|
|
|
+ <div class={styles.title} onClick={goBack}>{popupData.tabName}</div>
|
|
|
<div class={styles.titleContent}>
|
|
|
- <p onClick={goback}>{data.itemList[popupData.activeIndex]?.name}</p>
|
|
|
+ <p onClick={goBack}>{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>
|
|
@@ -1183,16 +1428,49 @@ export default defineComponent({
|
|
|
round
|
|
|
v-model:show={popupData.open}
|
|
|
onClose={handleClosePopup}>
|
|
|
- <Points
|
|
|
- data={data.knowledgePointList}
|
|
|
- tabActive={popupData.tabActive}
|
|
|
- itemActive={popupData.itemActive}
|
|
|
- onHandleSelect={(res: any) => {
|
|
|
- // onChangeSwiper('change', res.itemActive)
|
|
|
- popupData.open = false;
|
|
|
- toggleMaterial(res.itemActive);
|
|
|
- }}
|
|
|
- />
|
|
|
+ {data.source === 'search' ?
|
|
|
+ <PointsSearch
|
|
|
+ data={detailTempSearchList.value}
|
|
|
+ search={data.search}
|
|
|
+ loading={data.searchLoading}
|
|
|
+ tabActive={popupData.tabActive}
|
|
|
+ itemActive={popupData.itemActive}
|
|
|
+ open={popupData.open}
|
|
|
+ onHandleSelect={(res: any) => {
|
|
|
+ popupData.open = false;
|
|
|
+ if(res.isSearch) {
|
|
|
+ detailList.value = detailTempSearchList.value
|
|
|
+ const tempList: any[] = []
|
|
|
+ detailTempSearchList.value?.forEach((item: any) => {
|
|
|
+ if(Array.isArray(item.list)) {
|
|
|
+ tempList.push(...item.list)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ data.itemList = tempList || []
|
|
|
+ data.search = JSON.parse(JSON.stringify(data.searchTemp))
|
|
|
+ }
|
|
|
+ toggleMaterial(res.itemActive);
|
|
|
+ }}
|
|
|
+ onHandleSearch={async (val: any) => {
|
|
|
+ data.searchLoading = true
|
|
|
+ detailTempSearchList.value = []
|
|
|
+ await getSearchDetail({
|
|
|
+ type: 'pointSearch',
|
|
|
+ search: val.search
|
|
|
+ })
|
|
|
+ data.searchTemp = val.search;
|
|
|
+ data.searchLoading = false
|
|
|
+ }} /> :
|
|
|
+ <Points
|
|
|
+ data={data.knowledgePointList}
|
|
|
+ tabActive={popupData.tabActive}
|
|
|
+ itemActive={popupData.itemActive}
|
|
|
+ onHandleSelect={(res: any) => {
|
|
|
+ popupData.open = false;
|
|
|
+ toggleMaterial(res.itemActive);
|
|
|
+ }}
|
|
|
+ />}
|
|
|
+
|
|
|
</Popup>
|
|
|
|
|
|
<Popup
|