|
@@ -143,7 +143,11 @@ export default defineComponent({
|
|
|
knowledgePointList: [] as any,
|
|
|
courseDetails: [] as any,
|
|
|
itemList: [] as any,
|
|
|
- videoRefs: {} as any[]
|
|
|
+ videoRefs: {} as any[],
|
|
|
+
|
|
|
+ videoState: 'init' as 'init' | 'play',
|
|
|
+ videoItemRef: null as any,
|
|
|
+ animationState: 'start' as 'start' | 'end'
|
|
|
});
|
|
|
const activeData = reactive({
|
|
|
isAutoPlay: true, // 是否自动播放
|
|
@@ -222,6 +226,10 @@ export default defineComponent({
|
|
|
isRender: false // 是否渲染了
|
|
|
};
|
|
|
});
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ data.animationState = 'end'
|
|
|
+ }, 500)
|
|
|
};
|
|
|
|
|
|
// ifram事件处理
|
|
@@ -284,6 +292,14 @@ export default defineComponent({
|
|
|
activeData.model = false;
|
|
|
}, 4000);
|
|
|
};
|
|
|
+ const setModelOpen1 = () => {
|
|
|
+ clearTimeout(activeData.timer);
|
|
|
+ closeToast();
|
|
|
+ activeData.model = true;
|
|
|
+ activeData.timer = setTimeout(() => {
|
|
|
+ activeData.model = false;
|
|
|
+ }, 4000);
|
|
|
+ };
|
|
|
|
|
|
// 双击
|
|
|
const handleDbClick = (item: any) => {
|
|
@@ -351,13 +367,19 @@ export default defineComponent({
|
|
|
current: { transitionDelay: '700ms' }
|
|
|
}
|
|
|
];
|
|
|
-
|
|
|
+ const handleStop = () => {
|
|
|
+ data.videoItemRef.pause();
|
|
|
+ }
|
|
|
const acitveTimer = ref();
|
|
|
// 轮播切换
|
|
|
const handleSwipeChange = (index: number) => {
|
|
|
// 如果是当前正在播放 或者是视频最后一个
|
|
|
if (popupData.activeIndex == index) return;
|
|
|
+ data.animationState = 'start'
|
|
|
+ data.videoState = 'init'
|
|
|
+ handleStop();
|
|
|
clearTimeout(acitveTimer.value);
|
|
|
+ activeData.model = true;
|
|
|
const item = data.itemList[index];
|
|
|
popupData.activeIndex = index;
|
|
|
popupData.itemActive = item.id;
|
|
@@ -368,6 +390,9 @@ export default defineComponent({
|
|
|
if (item.error) {
|
|
|
data.videoRefs[index]?.onPlay();
|
|
|
}
|
|
|
+ setTimeout(() => {
|
|
|
+ data.animationState = 'end'
|
|
|
+ }, 800)
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -705,6 +730,14 @@ 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}>
|
|
|
<div
|
|
@@ -713,6 +746,40 @@ export default defineComponent({
|
|
|
onClick={() => setModelOpen()}>
|
|
|
{!loadingClass.value && (
|
|
|
<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}
|
|
|
+ >
|
|
|
+ <VideoItem
|
|
|
+ ref={(el: any) => data.videoItemRef = el}
|
|
|
+ item={activeVideoItem.value}
|
|
|
+ showModel={activeData.model}
|
|
|
+ onClose={setModelOpen1}
|
|
|
+
|
|
|
+ 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 =
|
|
|
m.isRender || Math.abs(popupData.activeIndex - mIndex) < 2;
|
|
@@ -746,7 +813,10 @@ export default defineComponent({
|
|
|
activeData.nowTime = Date.now();
|
|
|
}}>
|
|
|
{m.type === 'IMG' && <img src={m.content} />}
|
|
|
- {m.type === 'VIDEO' && (
|
|
|
+ {m.type === 'VIDEO' && <img src={m.coverImg} onLoad={() => {
|
|
|
+ m.isprepare = true;
|
|
|
+ }} />}
|
|
|
+ {/* {m.type === 'VIDEO' && (
|
|
|
<VideoItem
|
|
|
ref={(v: any) => (data.videoRefs[mIndex] = v)}
|
|
|
item={m}
|
|
@@ -772,7 +842,7 @@ export default defineComponent({
|
|
|
m.error = true;
|
|
|
}}
|
|
|
/>
|
|
|
- )}
|
|
|
+ )} */}
|
|
|
{m.type === 'SONG' && (
|
|
|
<AudioItem
|
|
|
item={m}
|
|
@@ -806,7 +876,14 @@ export default defineComponent({
|
|
|
|
|
|
{m.type === 'VIDEO' && (
|
|
|
<Transition name="van-fade">
|
|
|
- {!m.isprepare && (
|
|
|
+ {/* {!m.isprepare && (
|
|
|
+ <div class={styles.loadWrap}>
|
|
|
+ <Vue3Lottie
|
|
|
+ style={{ width: '100%', height: '100%' }}
|
|
|
+ animationData={playLoadData}></Vue3Lottie>
|
|
|
+ </div>
|
|
|
+ )} */}
|
|
|
+ {data.videoState !== 'play' && (
|
|
|
<div class={styles.loadWrap}>
|
|
|
<Vue3Lottie
|
|
|
style={{ width: '100%', height: '100%' }}
|