import React, { useEffect, useRef, useState } from 'react' import styles from './index.module.scss' import { baseURL, myData } from '@/utils/http' import NextPage from '@/components/NextPage' import FloorBtn from '@/components/FloorBtn' import { domDelOwnFu } from '@/utils/utilsSome' import CatVideo from '@/components/CatVideo' import EndVideo from '@/components/EndVideo' import A22Pano from './A22Pano' import BtnRight from '@/components/BtnRight' import classNames from 'classnames' import history from '@/utils/history' function A2visit2() { 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 + 2) }, 50) }, [loding]) // 底部按钮选中 const [btnAc, setBtnAc] = useState('贵宾') // 3个视频切换 const [videoPlay, setVideoPlay] = useState(false) const videoRef = useRef(null) // 进入院落 全景图显示 const [panoShow, setPanoShow] = useState(window.location.href.includes('?v=v2') ? true : false) // 点击进入室内 const [toShi, setToShi] = useState(false) // 点击观看百戏 const [baiXi, setBaiXi] = useState(window.location.href.includes('r=ren') ? true : false) const [xiAc, setXiAc] = useState('') return (
{window.location.href.includes('?v=v2') ? null : (
{/* 底部按钮 */}
{myData.visit2.btnArr.map((item, index) => (
{ setBtnAc(item) setVideoPlay(true) setTimeout(() => { if (videoRef.current) videoRef.current.play() }, 100) }} key={index} className='A22btnRow' style={{ backgroundImage: `url(${baseURL}plow/left${btnAc === item ? 'Ac' : ''}.png)`, color: btnAc === item ? '#BD7656' : '#DACB8B' }} > {item}
))}
{loding >= 100 ? ( // 进入院落 { setPanoShow(true) setTimeout(() => { domDelOwnFu('.A22imgBox') }, 500) }} txt='进入院落' /> ) : null} {/* 3个视频 */}
{myData.visit2.btnArr.map((item, index) => (
))}
{/* 加载进度条 */} {loding >= 100 ? null : (
)}
)} {/* 右下角按钮 */} { history.push('/unend/game3') } : undefined } /> {window.location.href.includes('?v=v2') ? null : ( domDelOwnFu('#CatVideo')} /> )} {/* 全景图页面 */} {window.location.href.includes('r=ren') ? null : (
{/* 进入室内 */} setToShi(true)} txt='进入室内' /> {/* 底部按钮 */}
setBaiXi(true)} className='A22Pbtn' style={{ backgroundImage: `url(${baseURL}chef/chuBtn.png)` }} > 观看百戏
)} {/* 室外看百戏 */}
{/* 进入室内 */} setToShi(true)} txt='进入室内' /> {/* 百戏底部按钮 */}
{myData.visit2.baixiArr.map((item, index) => (
{ setXiAc(item) setTimeout(() => { const doms: any = document.querySelectorAll('.A22Bvideo') if (doms) { doms.forEach((v: HTMLVideoElement, i: number) => { if (index === i) v.play() else { v.pause() v.currentTime = 0 } }) } }, 100) }} className={classNames('pvflRow', xiAc === item ? 'pvflRowAc' : '')} > {/* 蒙版 */}
{/* 底图 */}
{/* 文字 */}
{item}
))}
{myData.visit2.baixiArr.map(item => ( // 5个视频
))} { if (window.location.href.includes('?r=ren')) { history.go(-1) } else { setBaiXi(false) setXiAc('') } }} imgName='back' />
{/* 最后的视频 */}
) } const MemoA2visit2 = React.memo(A2visit2) export default MemoA2visit2