|
@@ -169,7 +169,11 @@ export default defineComponent({
|
|
|
homeworkStatus: true, // 布置作业完成时
|
|
|
removeVisiable: false,
|
|
|
removeTitle: '',
|
|
|
- removeContent: ''
|
|
|
+ removeContent: '',
|
|
|
+
|
|
|
+ videoState: 'init' as 'init' | 'play',
|
|
|
+ videoItemRef: null as any,
|
|
|
+ animationState: 'start' as 'start' | 'end'
|
|
|
});
|
|
|
const activeData = reactive({
|
|
|
// isAutoPlay: false, // 是否自动播放
|
|
@@ -219,6 +223,9 @@ export default defineComponent({
|
|
|
isRender: false // 是否渲染了
|
|
|
};
|
|
|
});
|
|
|
+ setTimeout(() => {
|
|
|
+ data.animationState = 'end'
|
|
|
+ }, 500)
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
@@ -537,8 +544,11 @@ export default defineComponent({
|
|
|
const handleSwipeChange = (index: number) => {
|
|
|
// 如果是当前正在播放 或者是视频最后一个
|
|
|
if (popupData.activeIndex == index) return;
|
|
|
+ data.animationState = 'start'
|
|
|
+ data.videoState = 'init'
|
|
|
handleStop();
|
|
|
clearTimeout(acitveTimer.value);
|
|
|
+ activeData.model = true;
|
|
|
checkedAnimation(popupData.activeIndex, index);
|
|
|
popupData.activeIndex = index;
|
|
|
|
|
@@ -569,6 +579,7 @@ export default defineComponent({
|
|
|
item.error = false;
|
|
|
// item.videoEle?.onPlay();
|
|
|
}
|
|
|
+ data.animationState = 'end'
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -861,6 +872,7 @@ export default defineComponent({
|
|
|
const closeStudyTool = () => {
|
|
|
studyData.type = 'init';
|
|
|
toggleModel();
|
|
|
+ setModelOpen();
|
|
|
};
|
|
|
|
|
|
const startShowModal = (
|
|
@@ -1016,7 +1028,13 @@ export default defineComponent({
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
-
|
|
|
+ const activeVideoItem = computed(() => {
|
|
|
+ const item = data.itemList[popupData.activeIndex]
|
|
|
+ if (item && item.type && item.type.toLocaleUpperCase() === 'VIDEO') {
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ return {}
|
|
|
+ })
|
|
|
return () => (
|
|
|
<div id="playContent" class={[styles.playContent, 'wrap']}>
|
|
|
<div
|
|
@@ -1032,13 +1050,43 @@ export default defineComponent({
|
|
|
}}>
|
|
|
<div
|
|
|
class={styles.coursewarePlay}
|
|
|
- style={{ width: parentContainer.width }}
|
|
|
- onClick={(e: Event) => {
|
|
|
- e.stopPropagation();
|
|
|
- setModelOpen();
|
|
|
- }}>
|
|
|
+ style={{ width: parentContainer.width }}>
|
|
|
{!popupData.chapterLoading ? (
|
|
|
<div class={styles.wraps}>
|
|
|
+ <div
|
|
|
+ style={
|
|
|
+ activeVideoItem.value.type &&
|
|
|
+ data.animationState === 'end' &&
|
|
|
+ data.videoState === 'play'
|
|
|
+ ? {
|
|
|
+ zIndex: 15,
|
|
|
+ opacity: 1
|
|
|
+ }
|
|
|
+ : { opacity: 0, zIndex: -1 }
|
|
|
+ }
|
|
|
+ class={styles.itemDiv}
|
|
|
+ >
|
|
|
+ <VideoPlay
|
|
|
+ ref={(el: any) => data.videoItemRef = el}
|
|
|
+ item={activeVideoItem.value}
|
|
|
+ showModel={activeData.model}
|
|
|
+ onClose={setModelOpen}
|
|
|
+
|
|
|
+ onCanplay={() => {
|
|
|
+ data.videoState = 'play'
|
|
|
+ }}
|
|
|
+ onPause={() => {
|
|
|
+ clearTimeout(activeData.timer)
|
|
|
+ activeData.model = true
|
|
|
+ }}
|
|
|
+ onEnded={() => {
|
|
|
+ const _index = popupData.activeIndex + 1
|
|
|
+ if (_index < data.itemList.length) {
|
|
|
+ handleSwipeChange(_index);
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
{data.itemList.map((m: any, mIndex: number) => {
|
|
|
const isRender = Math.abs(popupData.activeIndex - mIndex) < 2;
|
|
|
const isEmtry = Math.abs(popupData.activeIndex - mIndex) > 4;
|
|
@@ -1087,7 +1135,10 @@ export default defineComponent({
|
|
|
}}>
|
|
|
{m.type === 'VIDEO' ? (
|
|
|
<>
|
|
|
- <VideoPlay
|
|
|
+ <img src={m.coverImg} onLoad={() => {
|
|
|
+ m.isprepare = true;
|
|
|
+ }} />
|
|
|
+ {/* <VideoPlay
|
|
|
ref={(v: any) => (data.videoRefs[mIndex] = v)}
|
|
|
item={m}
|
|
|
isEmtry={isEmtry}
|
|
@@ -1112,9 +1163,9 @@ export default defineComponent({
|
|
|
console.log('video error');
|
|
|
m.error = true;
|
|
|
}}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
<Transition name="van-fade">
|
|
|
- {!m.isprepare && (
|
|
|
+ { (
|
|
|
<div class={styles.loadWrap}>
|
|
|
<Vue3Lottie
|
|
|
animationData={playLoadData}></Vue3Lottie>
|
|
@@ -1184,6 +1235,9 @@ export default defineComponent({
|
|
|
<div
|
|
|
onClick={(e: any) => {
|
|
|
e.stopPropagation();
|
|
|
+ if (activeData.timer){
|
|
|
+ setModelOpen();
|
|
|
+ }
|
|
|
}}
|
|
|
class={[
|
|
|
styles.switchDisplaySection,
|