|
@@ -1,24 +1,26 @@
|
|
|
-import React, { useEffect, useState } from "react";
|
|
|
+import React, { useEffect, useMemo, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import { useLocation } from "react-router-dom";
|
|
|
import history from "@/utils/history";
|
|
|
import { useSelector } from "react-redux";
|
|
|
import { RootState } from "@/store";
|
|
|
+import { HotSpot, Krpano } from "@dage/krpano";
|
|
|
+import classNames from "classnames";
|
|
|
function B1Village() {
|
|
|
const location = useLocation();
|
|
|
|
|
|
const [uId, setUid] = useState("");
|
|
|
+ const [curScene, setCurScene] = useState('scene_zlc');
|
|
|
+ const [hotspotHoverName, setHotspotHoverName] = useState('');
|
|
|
+ const villageData = useSelector(
|
|
|
+ (state: RootState) => state.A0Layout.dataAll.village
|
|
|
+ );
|
|
|
+ const curVillage = useMemo(() => villageData.find(i => i.id === Number(uId)) || villageData[0], [uId, villageData])
|
|
|
|
|
|
const architec = useSelector(
|
|
|
(state: RootState) => state.A0Layout.dataAll.architec
|
|
|
);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- const [data,setData] =useState({
|
|
|
- id:Number
|
|
|
- })
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
const query = new URLSearchParams(location.search);
|
|
|
const param = query.get("id");
|
|
@@ -28,6 +30,37 @@ function B1Village() {
|
|
|
|
|
|
return (
|
|
|
<div className={styles.B1Village}>
|
|
|
+ <Krpano className={styles.villageKrpano}
|
|
|
+ xml="/scene.xml"
|
|
|
+ currentScene={curScene}
|
|
|
+ >
|
|
|
+ {curVillage.info.map(item => {
|
|
|
+ const name = `hotspot${item.id}`;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <HotSpot key={name}
|
|
|
+ name={name}
|
|
|
+ type="text"
|
|
|
+ // @ts-ignore
|
|
|
+ atv={item.atv}
|
|
|
+ ath={item.ath}
|
|
|
+ scale={0.5}
|
|
|
+ edge="top"
|
|
|
+ bg={false}
|
|
|
+ distorted={true}
|
|
|
+ onClick={() => alert("点击了 " + name)}
|
|
|
+ onOver={() => setHotspotHoverName(name)}
|
|
|
+ onOut={() => setHotspotHoverName('')}
|
|
|
+ >
|
|
|
+ <div className={classNames(name === hotspotHoverName && styles.hotspotActive, styles.hotspot)}>
|
|
|
+ <span className={styles.hotspotLabel}>建筑名</span>
|
|
|
+ <div className={styles.hotspotPointer} />
|
|
|
+ </div>
|
|
|
+ </HotSpot>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </Krpano>
|
|
|
+
|
|
|
{/* 右下角的详情按钮 */}
|
|
|
<div
|
|
|
className="B1toTab3"
|