import React, { useCallback, useEffect, useRef, useState } from 'react' import styles from './index.module.scss' import useDataUrl from '@/components/ownUse/useDataUrl' import { myData } from '@/utils/http' import classNames from 'classnames' import { domDelOwnFu } from '@/utils/utilsSome' import { ArrowRightOutlined } from '@ant-design/icons' import history from '@/utils/history' import Hot2 from '../A2visit/PanoVideo/Hot2' function A4dance() { const { dataUrlSame } = useDataUrl() // 待完善 const [loding, setLoding] = useState(100) const timeRR = useRef(-1) useEffect(() => { clearInterval(timeRR.current) timeRR.current = window.setInterval(() => { if (loding >= 100) { clearInterval(timeRR.current) return } setLoding(loding + 1) }, 40) }, [loding]) // 点击继续 const btnStart = useCallback(() => { if (loding >= 100) { setLoding(110) // 0.5s之后删除自己 setTimeout(() => { domDelOwnFu('.A4base') }, 500) } }, [loding]) // 点击 跳下一个章节 const [lastVideo, setLastVideo] = useState(false) const videoRefLast = useRef(null) const lastVideoFu = useCallback(() => { setLastVideo(true) setTimeout(() => { if (videoRefLast.current) { videoRefLast.current.play() } }, 100) // 0.5s之后删除自己 setTimeout(() => { domDelOwnFu('.pvBox') }, 500) }, []) // 底部选中 const [floorAc, setFloorAc] = useState(-1) useEffect(() => { if (floorAc !== -1) { setTimeout(() => { const domAll: any = document.querySelectorAll('.A4fRvideo') if (domAll && domAll.length) { domAll.forEach((v: HTMLVideoElement, i: number) => { if (floorAc === i) v.play() else { v.pause() v.currentTime = 0 } }) } }, 100) } }, [floorAc]) // 点击 云气图 const hotVideoRef = useRef(null) const [hotInd, setHotInd] = useState(-1) const hotShowFu = useCallback((index: number) => { setHotInd(index) // 第一个热点 云气图 其他是通用热点 if (index === 0) { setTimeout(() => { if (hotVideoRef.current) { hotVideoRef.current.play() } }, 100) } }, []) return (
{/* 初始页面 */}
{/* anpg动图 */}
{loding >= 100 ? '点击继续' : '加载中'}
{loding >= 100 ? null : (
)}
{/* 主要内容 */}
{/* 热点 云气图为第一个 */} {myData.dance.hot.map((item, index) => (
hotShowFu(index)} key={index} className='pvHot' style={{ top: item.loc.top, left: item.loc.left }} >
))} {/* 底部 */}
{myData.dance.floor.map((item, index) => (
setFloorAc(index)} className={classNames('pvflRow', floorAc === index ? 'pvflRowAc' : '')} > {/* 蒙版 */}
{/* 底图 */}
{/* 文字 */}
{item.name}
))}
{/* 跳到下一章 */}
后厨备宴
{/* 右下角按钮 */}
{/*
*/} {/* 更多 跳新页面 */}
history.push('/chef')}>
{/* 中间的8个动画视频*/}
{/* 边框遮盖 */} {/* 返回按钮 */} setFloorAc(-1)} src={`${dataUrlSame}dance/back22.png`} alt='' /> {myData.dance.floor.map((item, index) => (
))}
{/* 点击四神云气图的动画 */}
{/* 点击其他热点 */} {hotInd > 0 ? (
setHotInd(-1)} name={myData.dance.hot[hotInd].name} />
) : null} {/* 最后一个过长动画 */}
history.push('/chef')} >
) } const MemoA4dance = React.memo(A4dance) export default MemoA4dance