|
|
@@ -2,6 +2,8 @@ import React, { useState, useEffect, useRef } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import StatueArt from './StatueArt'
|
|
|
import Genealogy from './Genealogy'
|
|
|
+import Sangzang from './Sangzang'
|
|
|
+
|
|
|
import classNames from 'classnames'
|
|
|
import { isPc } from '@/utils/http'
|
|
|
import MenuSider from '@/components/MenuSider'
|
|
|
@@ -12,18 +14,32 @@ function A6ybwx() {
|
|
|
const [gotoTab, setGotoTab] = useState(0)
|
|
|
|
|
|
window.onClickMainHotspot = (hotspotName: string) => {
|
|
|
+ console.log('调用了onClickMainHotspot', hotspotName)
|
|
|
if (hotspotName === '梵风汉韵') {
|
|
|
- window.location.href = '../index.html#/ybwx?tab=1'
|
|
|
+ window.location.replace('../index.html#/ybwx?tab=1')
|
|
|
}
|
|
|
if (hotspotName === '世系铭远') {
|
|
|
- window.location.href = '../index.html#/ybwx?tab=2'
|
|
|
+ window.location.replace('../index.html#/ybwx?tab=2')
|
|
|
}
|
|
|
if (hotspotName === '丧葬因素') {
|
|
|
- window.location.href = '../index.html#/ybwx?tab=1'
|
|
|
+ window.location.replace('../index.html#/ybwx?tab=3')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
useEffect(() => {
|
|
|
+ const handleHashChange = () => {
|
|
|
+ const search = new URLSearchParams(window.location.hash.split('?')[1] || '')
|
|
|
+ const tab = search.get('tab')
|
|
|
+ if (tab) {
|
|
|
+ setGotoTab(Number(tab))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ window.addEventListener('hashchange', handleHashChange)
|
|
|
+ return () => window.removeEventListener('hashchange', handleHashChange)
|
|
|
+ }, [])
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
const search = new URLSearchParams(window.location.hash.split('?')[1] || '')
|
|
|
console.log(search.get('tab'), '===================================')
|
|
|
const tab = search.get('tab')
|
|
|
@@ -39,8 +55,8 @@ function A6ybwx() {
|
|
|
objectFit: 'cover', // 视频的object-fit样式, 默认 cover
|
|
|
loop: false, // 是否循环, 默认false
|
|
|
autoplay: false, // 自动播放, 默认false
|
|
|
- onPlay: () => {}, // 触发播放事件
|
|
|
- onPause: () => {}, // 触发暂停事件
|
|
|
+ onPlay: () => { }, // 触发播放事件
|
|
|
+ onPause: () => { }, // 触发暂停事件
|
|
|
onEnded: () => {
|
|
|
setIsEnter(true)
|
|
|
playerRef.current.destroy()
|
|
|
@@ -48,7 +64,7 @@ function A6ybwx() {
|
|
|
onSourceEstablished: () => {
|
|
|
if (isEnter) setVideoOk(false)
|
|
|
setVideoOk(true)
|
|
|
-
|
|
|
+
|
|
|
} //有足够的数据可以播放了
|
|
|
}
|
|
|
playerRef.current = F_Video('./myData/ybwx.ts', params)
|
|
|
@@ -114,6 +130,9 @@ function A6ybwx() {
|
|
|
|
|
|
{/* 程氏谱系 */}
|
|
|
{gotoTab === 2 && <Genealogy setGotoTab={setGotoTab} />}
|
|
|
+
|
|
|
+ {/* 丧葬因素 */}
|
|
|
+ {gotoTab === 3 && <Sangzang setGotoTab={setGotoTab} />}
|
|
|
</div>
|
|
|
)
|
|
|
}
|