|
@@ -59,6 +59,7 @@ import PointsSearch from './component/points-search'
|
|
|
export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
|
setup() {
|
|
|
+ const browserInfo = browser()
|
|
|
const apiSuffix = ref(
|
|
|
baseState.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
|
|
|
)
|
|
@@ -77,17 +78,6 @@ export default defineComponent({
|
|
|
const parentContainer = reactive({
|
|
|
width: '100vw'
|
|
|
})
|
|
|
- // const setContainer = () => {
|
|
|
- // const min = Math.min(screen.width, screen.height)
|
|
|
- // const max = Math.max(screen.width, screen.height)
|
|
|
- // const width = min * (16 / 9)
|
|
|
- // if (width > max) {
|
|
|
- // parentContainer.width = '100vw'
|
|
|
- // return
|
|
|
- // } else {
|
|
|
- // parentContainer.width = width + 'px'
|
|
|
- // }
|
|
|
- // }
|
|
|
const handleInit = (type = 0) => {
|
|
|
//设置容器16:9
|
|
|
// setContainer()
|
|
@@ -103,13 +93,6 @@ export default defineComponent({
|
|
|
// console.log(234);
|
|
|
}
|
|
|
)
|
|
|
- // 头,包括返回箭头
|
|
|
- // postMessage({
|
|
|
- // api: 'setTitleBarVisibility',
|
|
|
- // content: {
|
|
|
- // status: type
|
|
|
- // }
|
|
|
- // })
|
|
|
// 安卓的状态栏
|
|
|
postMessage({
|
|
|
api: 'setStatusBarVisibility',
|
|
@@ -180,45 +163,24 @@ export default defineComponent({
|
|
|
// console.log('缓存路径返回', res)
|
|
|
return res
|
|
|
}
|
|
|
- // 获取当前课程是否签退
|
|
|
- // const getCourseSchedule = async () => {
|
|
|
- // if (!route.query.courseId) return;
|
|
|
- // try {
|
|
|
- // const res = await request.get(
|
|
|
- // `${state.platformApi}/courseSchedule/detail/${route.query.courseId}`,
|
|
|
- // {
|
|
|
- // hideLoading: true
|
|
|
- // }
|
|
|
- // );
|
|
|
- // if (res?.data) {
|
|
|
- // data.isCourse =
|
|
|
- // res.data.status === 'ING' && state.platformType == 'TEACHER'
|
|
|
- // ? true
|
|
|
- // : false;
|
|
|
- // // data.isRecordPlay = Date.now() > dayjs(res.data.startTime).valueOf()
|
|
|
- // }
|
|
|
- // } catch (e) {
|
|
|
- // console.log(e);
|
|
|
- // }
|
|
|
- // };
|
|
|
const getTempList = async (materialList: any, name: any) => {
|
|
|
const list: any = []
|
|
|
- const browserInfo = browser()
|
|
|
+ // const browserInfo = browser()
|
|
|
for (let j = 0; j < materialList.length; j++) {
|
|
|
const material = materialList[j]
|
|
|
//请求本地缓存
|
|
|
- if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(material.typeCode)) {
|
|
|
- const localData: any = await getCacheFilePath(material)
|
|
|
-
|
|
|
- if (localData?.content?.localPath) {
|
|
|
- material.url = material.content
|
|
|
- material.content = localData.content.localPath
|
|
|
- } else {
|
|
|
- material.url = material.content + '?t=' + +new Date()
|
|
|
- material.content = material.content + '?t=' + +new Date()
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(material.typeCode)) {
|
|
|
+ // const localData: any = await getCacheFilePath(material)
|
|
|
|
|
|
+ // if (localData?.content?.localPath) {
|
|
|
+ // material.url = material.content
|
|
|
+ // material.content = localData.content.localPath
|
|
|
+ // } else {
|
|
|
+ // material.url = material.content + '?t=' + +new Date()
|
|
|
+ // material.content = material.content + '?t=' + +new Date()
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ material.isReadCatch = false // 是否读取缓存
|
|
|
material.iframeRef = null
|
|
|
material.videoEle = null
|
|
|
material.tabName = name
|
|
@@ -272,8 +234,6 @@ export default defineComponent({
|
|
|
)
|
|
|
_firstIndex = _firstIndex > -1 ? _firstIndex : 0
|
|
|
const item = list[_firstIndex]
|
|
|
-
|
|
|
- // console.log(_firstIndex, '_firstIndex', route.query.kId, 'route.query.kId', item)
|
|
|
// 是否自动播放
|
|
|
if (activeData.isAutoPlay) {
|
|
|
item.autoPlay = true
|
|
@@ -286,6 +246,7 @@ export default defineComponent({
|
|
|
popupData.itemName = item.name
|
|
|
nextTick(() => {
|
|
|
data.itemList = list
|
|
|
+ getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
|
|
|
checkedAnimation(popupData.activeIndex)
|
|
|
postMessage({
|
|
|
api: 'courseLoading',
|
|
@@ -304,6 +265,24 @@ export default defineComponent({
|
|
|
}, 500)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ /** 获取当前元素的缓存 */
|
|
|
+ const getCurrentItemCatch = async (index: number) => {
|
|
|
+ const item = data.itemList[index]
|
|
|
+ if (browserInfo.isApp && ['VIDEO', 'IMG'].includes(item.typeCode) && !item.isReadCatch) {
|
|
|
+ const localData: any = await getCacheFilePath(item)
|
|
|
+ item.isReadCatch = true
|
|
|
+ if (localData?.content?.localPath) {
|
|
|
+ item.url = item.content
|
|
|
+ item.content = localData.content.localPath
|
|
|
+ } else {
|
|
|
+ item.url = item.content + '?t=' + +new Date()
|
|
|
+ item.content = item.content + '?t=' + +new Date()
|
|
|
+ }
|
|
|
+ console.log('加载了缓存')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const getDetail = async (id?: any) => {
|
|
|
try {
|
|
|
const res: any = await request.get(
|
|
@@ -382,7 +361,6 @@ export default defineComponent({
|
|
|
return n
|
|
|
}
|
|
|
)
|
|
|
- console.log(data.knowledgePointList, 'data.knowledgePointList')
|
|
|
getItemList()
|
|
|
}
|
|
|
return true
|
|
@@ -532,9 +510,10 @@ export default defineComponent({
|
|
|
|
|
|
data.detail = detailList.value?.find((child: any) => child.coursewareDetailId === item.coursewareDetailId)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
nextTick(() => {
|
|
|
data.itemList = allList;
|
|
|
+ getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
|
|
|
checkedAnimation(popupData.activeIndex);
|
|
|
postMessage({
|
|
|
api: 'courseLoading',
|
|
@@ -553,7 +532,6 @@ export default defineComponent({
|
|
|
}, 500);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
return true
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
@@ -675,7 +653,6 @@ export default defineComponent({
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await sysParamConfig()
|
|
|
-
|
|
|
|
|
|
if(data.source === 'search') {
|
|
|
await getSearchDetail({search: data.search})
|
|
@@ -736,7 +713,7 @@ export default defineComponent({
|
|
|
activeIndex: 0,
|
|
|
playIndex: 0,
|
|
|
tempTabActive: '', // 临时选中
|
|
|
- tempItemActive: "", // 临时编号
|
|
|
+ tempItemActive: "", // 临时编号
|
|
|
tabActive: '',
|
|
|
tabName: '',
|
|
|
itemActive: '',
|
|
@@ -794,22 +771,6 @@ export default defineComponent({
|
|
|
Toast.clear()
|
|
|
activeData.model = false
|
|
|
}
|
|
|
- const toggleModel = (type = true) => {
|
|
|
- activeData.model = type
|
|
|
- }
|
|
|
-
|
|
|
- // 去点名,签退
|
|
|
- const gotoRollCall = (pageTag: string) => {
|
|
|
- postMessage({
|
|
|
- api: 'open_app_page',
|
|
|
- content: {
|
|
|
- action: 'app',
|
|
|
- pageTag: pageTag,
|
|
|
- url: '',
|
|
|
- params: JSON.stringify({ courseId: route.query.courseId })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
|
|
|
// 双击
|
|
|
const handleDbClick = () => {
|
|
@@ -908,7 +869,7 @@ export default defineComponent({
|
|
|
checkedAnimation(popupData.activeIndex, index)
|
|
|
nextTick(() => {
|
|
|
popupData.activeIndex = index
|
|
|
-
|
|
|
+ getCurrentItemCatch(index) // 获取当前元素的缓存
|
|
|
acitveTimer.value = setTimeout(
|
|
|
() => {
|
|
|
popupData.playIndex = index
|
|
@@ -1012,8 +973,8 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 白板的批注打开时暂停播放
|
|
|
- watch(
|
|
|
+ // 白板的批注打开时暂停播放
|
|
|
+ watch(
|
|
|
() => [whitePenShow.value, penShow.value],
|
|
|
() => {
|
|
|
if (whitePenShow.value || penShow.value) {
|
|
@@ -1034,12 +995,6 @@ export default defineComponent({
|
|
|
}
|
|
|
)
|
|
|
|
|
|
- /** 关闭教学工具 */
|
|
|
- const closeStudyTool = () => {
|
|
|
- studyData.type = 'init'
|
|
|
- toggleModel()
|
|
|
- }
|
|
|
-
|
|
|
const activeVideoItem = computed(() => {
|
|
|
const item = data.itemList[popupData.activeIndex]
|
|
|
if (
|
|
@@ -1124,7 +1079,6 @@ export default defineComponent({
|
|
|
const isRender = Math.abs(popupData.playIndex - mIndex) < 2
|
|
|
// 判断是否是当前选中的元素
|
|
|
const activeEle = popupData.playIndex === mIndex ? true : false
|
|
|
-
|
|
|
return isRenderItem ? (
|
|
|
<div
|
|
|
key={'index' + mIndex}
|
|
@@ -1146,14 +1100,14 @@ export default defineComponent({
|
|
|
<Transition name="van-fade">
|
|
|
{m.typeCode === 'VIDEO' &&
|
|
|
data.animationState !== 'end' &&
|
|
|
- data.videoState != 'play' && (
|
|
|
+ data.videoState != 'play' ? (
|
|
|
<div class={styles.loadWrap}>
|
|
|
<Vue3Lottie animationData={playLoadData}></Vue3Lottie>
|
|
|
</div>
|
|
|
- )}
|
|
|
+ ) : ''}
|
|
|
</Transition>
|
|
|
{isRender && m.typeCode === 'IMG' && (
|
|
|
- <>
|
|
|
+ <div>
|
|
|
<img src={m.content} />
|
|
|
{m.materialMusicId && (
|
|
|
<div
|
|
@@ -1172,7 +1126,7 @@ export default defineComponent({
|
|
|
}}
|
|
|
></div>
|
|
|
)}
|
|
|
- </>
|
|
|
+ </div>
|
|
|
)}
|
|
|
{isRender && m.typeCode === 'SONG' && (
|
|
|
<MusicScore
|
|
@@ -1190,48 +1144,6 @@ export default defineComponent({
|
|
|
)
|
|
|
})}
|
|
|
</div>
|
|
|
- {/* <Transition name="right">
|
|
|
- {activeData.model && (
|
|
|
- <div
|
|
|
- class={styles.rightFixedBtns}
|
|
|
- onClick={(e: Event) => {
|
|
|
- e.stopPropagation()
|
|
|
- clearTimeout(activeData.timer)
|
|
|
- }}
|
|
|
- >
|
|
|
- <div class={styles.btnsWrap}>
|
|
|
- <div
|
|
|
- class={[styles.fullBtn, styles.point]}
|
|
|
- onClick={() => (popupData.open = true)}
|
|
|
- >
|
|
|
- <img src={iconMenu} />
|
|
|
- <span>知识点</span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class={[styles.btnsWrap, styles.btnsBottom]}>
|
|
|
- {data.isCourse && (
|
|
|
- <>
|
|
|
- <div
|
|
|
- class={styles.fullBtn}
|
|
|
- onClick={() => gotoRollCall('student_roll_call')}
|
|
|
- >
|
|
|
- <img src={iconDian} />
|
|
|
- <span>点名</span>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class={styles.fullBtn}
|
|
|
- onClick={() => gotoRollCall('sign_out')}
|
|
|
- >
|
|
|
- <img src={iconPoint} />
|
|
|
- <span>签退</span>
|
|
|
- </div>
|
|
|
- </>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </Transition> */}
|
|
|
|
|
|
<Transition name="left">
|
|
|
{activeData.model && (
|
|
@@ -1260,7 +1172,7 @@ export default defineComponent({
|
|
|
}}>
|
|
|
<img src={iconCourseType} />
|
|
|
</div>}
|
|
|
-
|
|
|
+
|
|
|
<div class={styles.fullBtn} onClick={() => {
|
|
|
handleStop()
|
|
|
popupData.open = true
|
|
@@ -1269,7 +1181,6 @@ export default defineComponent({
|
|
|
{/* <span>知识点</span> */}
|
|
|
</div>
|
|
|
</>}
|
|
|
-
|
|
|
<div
|
|
|
class={[styles.fullBtn, !(popupData.activeIndex != 0) && styles.disabled]}
|
|
|
onClick={() => {
|
|
@@ -1331,29 +1242,6 @@ export default defineComponent({
|
|
|
</div>
|
|
|
)}
|
|
|
</div>
|
|
|
- {/* <div
|
|
|
- style={{ transform: activeData.model ? '' : 'translateY(-100%)' }}
|
|
|
- id="coursePlayHeader"
|
|
|
- class={styles.headerContainer}
|
|
|
- ref={headeRef}
|
|
|
- >
|
|
|
- <div class={styles.backBtn} onClick={() => goback()}>
|
|
|
- <Icon name={iconBack} />
|
|
|
- </div>
|
|
|
- <div
|
|
|
- class={styles.menu}
|
|
|
- onClick={() => {
|
|
|
- const _effectIndex = effectIndex.value + 1
|
|
|
- effectIndex.value =
|
|
|
- _effectIndex >= effects.length - 1 ? 0 : _effectIndex
|
|
|
- setModelOpen()
|
|
|
- }}
|
|
|
- >
|
|
|
- {popupData.tabName}
|
|
|
- </div>
|
|
|
-
|
|
|
-
|
|
|
- </div> */}
|
|
|
|
|
|
{/* 更多弹窗 */}
|
|
|
<Popup
|
|
@@ -1375,7 +1263,7 @@ export default defineComponent({
|
|
|
v-model:show={popupData.open}
|
|
|
onClose={handleClosePopup}
|
|
|
>
|
|
|
- {data.source === 'search' ?
|
|
|
+ {data.source === 'search' ?
|
|
|
<PointsSearch
|
|
|
data={detailTempSearchList.value}
|
|
|
search={data.searchTemp || data.search}
|
|
@@ -1418,7 +1306,6 @@ export default defineComponent({
|
|
|
toggleMaterial(res.itemActive)
|
|
|
}}
|
|
|
/>}
|
|
|
-
|
|
|
</Popup>
|
|
|
|
|
|
<Popup
|
|
@@ -1440,6 +1327,7 @@ export default defineComponent({
|
|
|
if(n && s) {
|
|
|
popupData.coursewareOpen = false;
|
|
|
popupData.activeIndex = 0;
|
|
|
+ getCurrentItemCatch(popupData.activeIndex) // 获取当前元素的缓存
|
|
|
nextTick(() => {
|
|
|
popupData.open = true
|
|
|
})
|