import React, { useCallback, useEffect, useRef, useState } from 'react' import styles from './index.module.scss' import BaseImg from '@/components/BaseImg' import { baseURL, myData } from '@/utils/http' import useLoding from '@/components/ownUse/useLoding' import CatVideo from '@/components/CatVideo' import A6PanoVideo from './A6PanoVideo' import classNames from 'classnames' import { domDelOwnFu } from '@/utils/utilsSome' import FloorBtn from '@/components/FloorBtn' import NextPage from '@/components/NextPage' import EndVideo from '@/components/EndVideo' import history from '@/utils/history' function A6xian() { // 过度动画 const [cutVideoShow, setCutVideoShow] = useState(false) // 点击 跳下一个章节 const [lastVideo, setLastVideo] = useState(false) // 点击继续 const btnStart = useCallback(() => { setCutVideoShow(true) }, []) // 过度动画播放完毕或者点击跳过 const cutEndFu = useCallback(() => { setCutVideoShow(false) }, []) // 先加载背景图 序列帧等 在加载视频 const { imgNow, imgNumFu } = useLoding(3) // 点击升仙 const [xianShow, setXianShow] = useState(window.location.href.includes('t=xian') ? true : false) // 滚动 const [isFlag, setIsFlag] = useState(false) const xianRef = useRef(null) // 监听3S没有操作 const [action, setAction] = useState(false) const actionRef = useRef(-1) const actionFu = useCallback( (val?: boolean) => { if (xianShow || val) { setAction(false) clearTimeout(actionRef.current) actionRef.current = window.setTimeout(() => { setAction(true) }, 3000) } }, [xianShow] ) const actionMoveRef = useRef(-1) useEffect(() => { if (xianShow) { clearInterval(actionMoveRef.current) if (action) { actionMoveRef.current = window.setInterval(() => { if (xianRef.current) { const nowMove = xianRef.current.scrollLeft xianRef.current.scrollLeft = nowMove + 2 if (xianRef.current.scrollLeft >= 2988) xianRef.current.scrollLeft = 0 } }, 50) } } }, [action, xianShow]) const mousemoveFu = useCallback( (ev: any, flag?: boolean) => { if (xianRef.current) { if (flag && !isFlag) { actionFu() const nowMove = xianRef.current.scrollLeft // 滚轮 let num = 50 if (ev.deltaY < 0) num = -num xianRef.current.scrollLeft = nowMove + num } else if (isFlag) { actionFu() const nowMove = xianRef.current.scrollLeft // 鼠标按住移动 xianRef.current.scrollLeft = nowMove - ev.movementX } } }, [actionFu, isFlag] ) const videoRef = useRef(null) useEffect(() => { if (window.location.href.includes('t=xian')) { setTimeout(() => { if (videoRef.current) videoRef.current.play() }, 100) } }, []) // 二级的静态图 const [erImg, setErImg] = useState(false) return (
{/* 初始静态图 */}
) } const MemoA6xian = React.memo(A6xian) export default MemoA6xian