|
@@ -1,78 +1,33 @@
|
|
|
-import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
|
+import React, { useCallback, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import useDataUrl from '@/components/ownUse/useDataUrl'
|
|
|
import classNames from 'classnames'
|
|
|
-import { domDelOwnFu } from '@/utils/utilsSome'
|
|
|
import { myData } from '@/utils/http'
|
|
|
import PanoImg from './PanoImg'
|
|
|
import { ArrowRightOutlined } from '@ant-design/icons'
|
|
|
import history from '@/utils/history'
|
|
|
import EndVideo from '@/components/EndVideo'
|
|
|
+import BaseVideo from '@/components/BaseVideo'
|
|
|
+import CatVideo from '@/components/CatVideo'
|
|
|
|
|
|
function A3banquet() {
|
|
|
const { dataUrlSame } = useDataUrl()
|
|
|
|
|
|
- // 初始视频
|
|
|
- const A3baseVideo = useRef<HTMLVideoElement>(null)
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- setTimeout(() => {
|
|
|
- if (A3baseVideo.current) {
|
|
|
- A3baseVideo.current.play()
|
|
|
- }
|
|
|
- }, 100)
|
|
|
- }, [])
|
|
|
-
|
|
|
- // 动画视频的ref
|
|
|
- const videoRef = useRef<HTMLVideoElement>(null)
|
|
|
-
|
|
|
// 当前视频索引
|
|
|
const [videoInd, setVideoInd] = useState(-1)
|
|
|
|
|
|
- const [loding, setLoding] = useState(myData.isLdong ? 0 : 100)
|
|
|
-
|
|
|
- const timeRR = useRef(-1)
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- clearInterval(timeRR.current)
|
|
|
- timeRR.current = window.setInterval(() => {
|
|
|
- if (loding >= 100) {
|
|
|
- clearInterval(timeRR.current)
|
|
|
- return
|
|
|
- }
|
|
|
- setLoding(loding + 1)
|
|
|
- }, 30)
|
|
|
- }, [loding])
|
|
|
-
|
|
|
// 开始之后的过度动画
|
|
|
const [overVideo, setOverVideo] = useState(true)
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- if (!overVideo) {
|
|
|
- // 0.5s之后删除过度视频
|
|
|
- setTimeout(() => {
|
|
|
- domDelOwnFu('.A3base2')
|
|
|
- }, 500)
|
|
|
- // 打开全景页面
|
|
|
- }
|
|
|
- }, [overVideo])
|
|
|
-
|
|
|
// 点击继续
|
|
|
const btnStart = useCallback(() => {
|
|
|
- if (loding >= 100) {
|
|
|
- // 播放已经加载好的视频
|
|
|
- setVideoInd(0)
|
|
|
- setTimeout(() => {
|
|
|
- if (videoRef.current) {
|
|
|
- videoRef.current.play()
|
|
|
- }
|
|
|
- }, 100)
|
|
|
- // 0.5s之后删除初始视频
|
|
|
- setTimeout(() => {
|
|
|
- domDelOwnFu('.A3base')
|
|
|
- }, 500)
|
|
|
- }
|
|
|
- }, [loding])
|
|
|
+ setVideoInd(0)
|
|
|
+ setTimeout(() => {
|
|
|
+ // 播放过度视频
|
|
|
+ const dom: HTMLVideoElement = document.querySelector('#CatVideo video')!
|
|
|
+ if (dom) dom.play()
|
|
|
+ }, 100)
|
|
|
+ }, [])
|
|
|
|
|
|
// 点击 跳下一个章节
|
|
|
const [lastVideo, setLastVideo] = useState(false)
|
|
@@ -80,60 +35,21 @@ function A3banquet() {
|
|
|
return (
|
|
|
<div className={styles.A3banquet}>
|
|
|
{/* 加载页面 */}
|
|
|
- <div className={classNames('A3base', videoInd < 0 ? '' : 'A3baseHide')}>
|
|
|
- <img src={`${dataUrlSame}banquet/mulu.png`} alt='' />
|
|
|
- <div className='A3baseBtn' onClick={btnStart}>
|
|
|
- {/* anpg动图 */}
|
|
|
- <div className='A3BIcon'>
|
|
|
- <img src={`${dataUrlSame}visit/arrow.png`} alt='' />
|
|
|
- </div>
|
|
|
-
|
|
|
- <img src={`${dataUrlSame}visit/btn.png`} alt='' />
|
|
|
-
|
|
|
- <div className='A3Btxt'>{loding >= 100 ? '点击继续' : '加载中'}</div>
|
|
|
- {loding >= 100 ? null : (
|
|
|
- <div className='A3Bxian'>
|
|
|
- <div>
|
|
|
- <div style={{ width: loding + '%' }}></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
-
|
|
|
- <video
|
|
|
- ref={A3baseVideo}
|
|
|
- src={`${dataUrlSame}/${myData.banquet.videoSta}`}
|
|
|
- playsInline
|
|
|
- muted
|
|
|
- webkit-playsinline='true'
|
|
|
- x5-video-player-type='h5'
|
|
|
- loop
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <BaseVideo
|
|
|
+ isShow={videoInd < 0}
|
|
|
+ imgSrc={`${dataUrlSame}banquet/mulu.png`}
|
|
|
+ videoSrc={`${dataUrlSame}/${myData.banquet.videoSta}`}
|
|
|
+ parentFu={() => btnStart()}
|
|
|
+ />
|
|
|
|
|
|
{/* 过度动画页面 */}
|
|
|
- <div hidden={loding < 100} className={classNames('A3base2', overVideo ? '' : 'A3baseHide2')}>
|
|
|
- <video
|
|
|
- ref={videoRef}
|
|
|
- playsInline
|
|
|
- muted
|
|
|
- webkit-playsinline='true'
|
|
|
- x5-video-player-type='h5'
|
|
|
- src={dataUrlSame + myData.banquet.videos[videoInd < 0 ? 0 : videoInd]}
|
|
|
- onEnded={() => setOverVideo(false)}
|
|
|
- >
|
|
|
- <source type='video/mp4' />
|
|
|
- Your browser does not support the video tag.
|
|
|
- </video>
|
|
|
-
|
|
|
- <div
|
|
|
- className='A3Tiao'
|
|
|
- style={{ backgroundImage: `url(${dataUrlSame}home/tiao.png)` }}
|
|
|
- onClick={() => setOverVideo(false)}
|
|
|
- ></div>
|
|
|
- </div>
|
|
|
+ <CatVideo
|
|
|
+ isShow={overVideo}
|
|
|
+ src={dataUrlSame + myData.banquet.videos[videoInd < 0 ? 0 : videoInd]}
|
|
|
+ parentFu={() => setOverVideo(false)}
|
|
|
+ />
|
|
|
|
|
|
- {/* 全景视频 */}
|
|
|
+ {/* 全景图 */}
|
|
|
<div className={classNames('pvBox', lastVideo ? 'pvBoxHide' : '')} hidden={overVideo}>
|
|
|
<PanoImg />
|
|
|
{/* 跳到下一章 */}
|