import React, { useEffect, useRef, useState } from 'react' import styles from './index.module.scss' import { baseURL, myData } from '@/utils/http' import history from '@/utils/history' import classNames from 'classnames' import BaseImg from '@/components/BaseImg' import S1manor from './S1manor' import S2mien from './S2mien' import S3goods from './S3goods' const videoObj = { 探索庄园: { 汉代风华: 'more/1.mp4', 文物欣赏: 'more/2.mp4' }, 汉代风华: { 探索庄园: 'more/3.mp4', 文物欣赏: 'more/4.mp4' }, 文物欣赏: { 探索庄园: 'more/5.mp4', 汉代风华: 'more/6.mp4' } } type TxtType = '探索庄园' | '汉代风华' | '文物欣赏' const floorArr: TxtType[] = ['探索庄园', '汉代风华', '文物欣赏'] function B1more() { const [floorTxt, setFloorTxt] = useState('探索庄园') const floorRef = useRef('探索庄园') // 需要播放的视频路径 const [videoSrc, setVideoSrc] = useState('') useEffect(() => { if (videoSrc) { setTimeout(() => { const domAll: any = document.querySelectorAll('.A6videoBox video') if (domAll && domAll.length) { domAll.forEach((v: HTMLVideoElement) => { if (baseURL + videoSrc === v.src) v.play() else { v.pause() v.currentTime = 0 } }) } }, 100) } }, [videoSrc]) useEffect(() => { const tempObj = Reflect.get(videoObj, floorRef.current) const temp = Reflect.get(tempObj, floorTxt) floorRef.current = floorTxt setVideoSrc(temp) }, [floorTxt]) // 初始加载中动画 const [isLoding, setIsLoding] = useState(true) return (
{/* 三个主要页面 */} {/*
) } const MemoB1more = React.memo(B1more) export default MemoB1more