|
@@ -1,11 +1,11 @@
|
|
|
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
-import Hot1 from './Hot1'
|
|
|
-import Hot2 from './Hot2'
|
|
|
-import { otherUrl, myData } from '@/utils/http'
|
|
|
+import { otherUrl, hotInfo } from '@/utils/http'
|
|
|
import HotIcon from '@/components/HotIcon'
|
|
|
import { HotSpot, Krpano, VideoScene, videoSceneModel, View } from '@dage/krpano'
|
|
|
import { KrpanoMiddleware, KrpanoMiddlewareMethods } from '@/components/KrpanoMiddleware'
|
|
|
+import ZHot0 from '@/components/ZHot0'
|
|
|
+import Zhot from '@/components/Zhot'
|
|
|
|
|
|
// window.draggbleHotspotEvent = (ath: number, atv: number) => {
|
|
|
// console.log(`ath: ${ath}, atv: ${atv}`)
|
|
@@ -16,16 +16,12 @@ type Propr = {
|
|
|
}
|
|
|
|
|
|
function PanoVideo({ lodingOk }: Propr) {
|
|
|
- // 0为 第一种模式的热点 其他为第二种
|
|
|
- const [ind, setInd] = useState(-1)
|
|
|
+ // 热点名字-打开热点
|
|
|
+ const [acName, setAcName] = useState('')
|
|
|
+
|
|
|
const [activeIdx, setActiveIdx] = useState(-1)
|
|
|
const middlewareIns = useRef<KrpanoMiddlewareMethods>(null)
|
|
|
|
|
|
- const data = useMemo(() => {
|
|
|
- if (ind !== -1) return myData.visit.hot[ind].data
|
|
|
- else return []
|
|
|
- }, [ind])
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
const readyEvent = videoSceneModel.event.on('Event.videoScene.play', () => {
|
|
|
console.log('加载完成')
|
|
@@ -40,6 +36,10 @@ function PanoVideo({ lodingOk }: Propr) {
|
|
|
}
|
|
|
}, [lodingOk])
|
|
|
|
|
|
+ const arrRes = useMemo(() => {
|
|
|
+ return [...hotInfo.cheQi, ...hotInfo.周礼九拜]
|
|
|
+ }, [])
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<KrpanoMiddleware ref={middlewareIns}>
|
|
@@ -68,27 +68,28 @@ function PanoVideo({ lodingOk }: Propr) {
|
|
|
}
|
|
|
}}
|
|
|
>
|
|
|
+ {/* 待完善位置 */}
|
|
|
<View hlookat={0} vlookat={0} fovType='MFOV' fov={120} fovMin={70} fovMax={130} />
|
|
|
- {myData.visit.hot.map((item, index) => (
|
|
|
+ {arrRes.map((item, index) => (
|
|
|
// 热点图标
|
|
|
<HotSpot
|
|
|
key={index}
|
|
|
type='text'
|
|
|
name={item.name}
|
|
|
- atv={item.atv}
|
|
|
- ath={item.ath}
|
|
|
+ atv={item.panoLoc.atv}
|
|
|
+ ath={item.panoLoc.ath}
|
|
|
edge='top'
|
|
|
distorted={true}
|
|
|
- scale={item.size}
|
|
|
+ scale={item.panoLoc.size}
|
|
|
bg={false}
|
|
|
onOver={() => setActiveIdx(index)}
|
|
|
onOut={() => setActiveIdx(-1)}
|
|
|
- onClick={() => setInd(index)}
|
|
|
+ onClick={() => setAcName(item.name)}
|
|
|
// @ts-ignore
|
|
|
// onDown='draggable_hotspot()'
|
|
|
>
|
|
|
<HotIcon
|
|
|
- isModel={item.isModel ? true : false}
|
|
|
+ isModel={item.tubiao === '文物' ? true : false}
|
|
|
key={index}
|
|
|
index={index}
|
|
|
isHoverAc={activeIdx === index}
|
|
@@ -101,11 +102,13 @@ function PanoVideo({ lodingOk }: Propr) {
|
|
|
</Krpano>
|
|
|
</KrpanoMiddleware>
|
|
|
|
|
|
- {ind === -1 ? null : ind === 0 ? (
|
|
|
- <Hot1 data={data} closeFu={() => setInd(-1)} />
|
|
|
- ) : (
|
|
|
- <Hot2 data={data} closeFu={() => setInd(-1)} name={myData.visit.hot[ind].name} />
|
|
|
- )}
|
|
|
+ {acName ? (
|
|
|
+ acName === '周礼九拜' ? (
|
|
|
+ <ZHot0 closeFu={() => setAcName('')} />
|
|
|
+ ) : (
|
|
|
+ <Zhot name={acName} closeFu={() => setAcName('')} />
|
|
|
+ )
|
|
|
+ ) : null}
|
|
|
</>
|
|
|
)
|
|
|
}
|