import React, { useCallback, useMemo, useState } from 'react' import styles from './index.module.scss' import BaseImg from '@/components/BaseImg' import { baseURL, myData } from '@/utils/http' import EndVideo from '@/components/EndVideo' import NextPage from '@/components/NextPage' import classNames from 'classnames' import FloorBtn from '@/components/FloorBtn' import HotIcon from '@/components/HotIcon' import Hot2 from '../A2visit/PanoVideo/Hot2' import { PlowHotType } from '@/types' import useLoding from '@/components/ownUse/useLoding' function A6plow() { // 初始显示和隐藏 const [cutVideoShow, setCutVideoShow] = useState(false) // 控制视频播放的方法 const videoPlayFu = useCallback((index: number) => { setTimeout(() => { const domAll: any = document.querySelectorAll('.A6video') if (domAll && domAll.length) { domAll.forEach((v: HTMLVideoElement, i: number) => { if (index === i) v.play() else { v.pause() v.currentTime = 0 } }) } }, 100) }, []) // 点击继续 const btnStart = useCallback(() => { setCutVideoShow(true) // 播放第一个整地的视频 videoPlayFu(0) }, [videoPlayFu]) // 点击 跳下一个章节 const [lastVideo, setLastVideo] = useState(false) // 左侧按钮的选中 const [leftAc, setLeftAc] = useState(0) const leftAcFu = useCallback( (index: number) => { videoPlayFu(index) setLeftAc(index) }, [videoPlayFu] ) // 底部文字 const floorTxt = useMemo(() => { return myData.plow.info[leftAc].txt }, [leftAc]) // 打开热点 const [hotInd, setHotInd] = useState(-1) const hotInfo = useMemo(() => { let info = {} as PlowHotType const temp = myData.plow.info[leftAc].hot if (temp && temp[hotInd]) { info = temp[hotInd] } return info }, [hotInd, leftAc]) // 先加载背景图 序列帧等 在加载视频 const { imgNow, imgNumFu } = useLoding(3) return (