|
@@ -6,6 +6,7 @@ import { useSelector } from "react-redux";
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
import { HotSpot, Krpano } from "@dage/krpano";
|
|
import { HotSpot, Krpano } from "@dage/krpano";
|
|
import classNames from "classnames";
|
|
import classNames from "classnames";
|
|
|
|
+import { baseUrl } from "@/index";
|
|
function B1Village() {
|
|
function B1Village() {
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
|
|
|
|
@@ -15,30 +16,34 @@ function B1Village() {
|
|
const villageData = useSelector(
|
|
const villageData = useSelector(
|
|
(state: RootState) => state.A0Layout.dataAll.village
|
|
(state: RootState) => state.A0Layout.dataAll.village
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ //当前村落的 信息
|
|
const curVillage = useMemo(
|
|
const curVillage = useMemo(
|
|
- () => villageData.find((i) => i.id === Number(uId)) || villageData[0],
|
|
|
|
|
|
+ () =>
|
|
|
|
+ villageData.find((i) => i.id === Number(uId))?.info ||
|
|
|
|
+ villageData[0].info,
|
|
[uId, villageData]
|
|
[uId, villageData]
|
|
);
|
|
);
|
|
|
|
|
|
- const architec = useSelector(
|
|
|
|
- (state: RootState) => state.A0Layout.dataAll.architec
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const query = new URLSearchParams(location.search);
|
|
const query = new URLSearchParams(location.search);
|
|
const param = query.get("id");
|
|
const param = query.get("id");
|
|
- console.log("村落页面获取id", param);
|
|
|
|
|
|
+ // console.log("村落页面获取id", param);
|
|
setUid(param!);
|
|
setUid(param!);
|
|
}, [location.search]);
|
|
}, [location.search]);
|
|
|
|
|
|
|
|
+ // 详情 索引
|
|
|
|
+ const [infoInd, setInfoInd] = useState(-1);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className={styles.B1Village}>
|
|
<div className={styles.B1Village}>
|
|
|
|
+ {/* 全景相关 */}
|
|
<Krpano
|
|
<Krpano
|
|
className={styles.villageKrpano}
|
|
className={styles.villageKrpano}
|
|
xml="/scene.xml"
|
|
xml="/scene.xml"
|
|
currentScene={curScene}
|
|
currentScene={curScene}
|
|
>
|
|
>
|
|
- {curVillage.info.map((item) => {
|
|
|
|
|
|
+ {curVillage.map((item, index) => {
|
|
const name = `hotspot${item.id}`;
|
|
const name = `hotspot${item.id}`;
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -46,24 +51,25 @@ function B1Village() {
|
|
key={name}
|
|
key={name}
|
|
name={name}
|
|
name={name}
|
|
type="text"
|
|
type="text"
|
|
- // @ts-ignore
|
|
|
|
atv={item.atv}
|
|
atv={item.atv}
|
|
ath={item.ath}
|
|
ath={item.ath}
|
|
scale={0.5}
|
|
scale={0.5}
|
|
edge="top"
|
|
edge="top"
|
|
bg={false}
|
|
bg={false}
|
|
distorted={true}
|
|
distorted={true}
|
|
- onClick={() => alert("点击了 " + name)}
|
|
|
|
|
|
+ onClick={() => setInfoInd(index)}
|
|
onOver={() => setHotspotHoverName(name)}
|
|
onOver={() => setHotspotHoverName(name)}
|
|
onOut={() => setHotspotHoverName("")}
|
|
onOut={() => setHotspotHoverName("")}
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
className={classNames(
|
|
className={classNames(
|
|
- name === hotspotHoverName && styles.hotspotActive,
|
|
|
|
|
|
+ name === hotspotHoverName || index === infoInd
|
|
|
|
+ ? styles.hotspotActive
|
|
|
|
+ : "",
|
|
styles.hotspot
|
|
styles.hotspot
|
|
)}
|
|
)}
|
|
>
|
|
>
|
|
- <span className={styles.hotspotLabel}>建筑名</span>
|
|
|
|
|
|
+ <span className={styles.hotspotLabel}>{item.label}</span>
|
|
<div className={styles.hotspotPointer} />
|
|
<div className={styles.hotspotPointer} />
|
|
</div>
|
|
</div>
|
|
</HotSpot>
|
|
</HotSpot>
|
|
@@ -71,6 +77,67 @@ function B1Village() {
|
|
})}
|
|
})}
|
|
</Krpano>
|
|
</Krpano>
|
|
|
|
|
|
|
|
+ {/* 点击建筑出来的左侧详情 */}
|
|
|
|
+ <div className={classNames("B1info", infoInd !== -1 ? "B1infoAc" : "")}>
|
|
|
|
+ <div className="B1infoMain">
|
|
|
|
+ {curVillage.map((v, i) => (
|
|
|
|
+ <div
|
|
|
|
+ className={classNames(
|
|
|
|
+ "B1infoRow",
|
|
|
|
+ i === infoInd ? "B1infoRowAc" : ""
|
|
|
|
+ )}
|
|
|
|
+ key={v.id}
|
|
|
|
+ >
|
|
|
|
+ {/* 大名字 */}
|
|
|
|
+ <div className="B1infoMainName">
|
|
|
|
+ <img
|
|
|
|
+ src={`${baseUrl}/B1Village/pc/${uId}/name${v.id}.png`}
|
|
|
|
+ alt=""
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ {/* 底部介绍 */}
|
|
|
|
+ <div className="B1infoFloo">
|
|
|
|
+ <div
|
|
|
|
+ className="B1infoFloo1 mySorrl"
|
|
|
|
+ dangerouslySetInnerHTML={{ __html: v.txt }}
|
|
|
|
+ ></div>
|
|
|
|
+ {/* 左右箭头 */}
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => setInfoInd(infoInd - 1)}
|
|
|
|
+ className={classNames(
|
|
|
|
+ "B1infoAr B1infoAr1",
|
|
|
|
+ infoInd === 0 ? "B1infoArNone" : ""
|
|
|
|
+ )}
|
|
|
|
+ hidden={curVillage.length <= 1}
|
|
|
|
+ ></div>
|
|
|
|
+ <div
|
|
|
|
+ onClick={() => setInfoInd(infoInd + 1)}
|
|
|
|
+ className={classNames(
|
|
|
|
+ "B1infoAr B1infoAr2",
|
|
|
|
+ infoInd >= curVillage.length - 1 ? "B1infoArNone" : ""
|
|
|
|
+ )}
|
|
|
|
+ hidden={curVillage.length <= 1}
|
|
|
|
+ ></div>
|
|
|
|
+ <div
|
|
|
|
+ className="B1infoFlooBtn"
|
|
|
|
+ onClick={() =>
|
|
|
|
+ history.push(`/architecInfo?id=${v.architecId}`)
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ 查看
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ {/* 右侧的打点定位 */}
|
|
|
|
+ <div className="B1infoRloc"></div>
|
|
|
|
+ {v.buildArr.map((v2) => (
|
|
|
|
+ <div className={classNames("B1infoRloc",)} key={v2.id}></div>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ <div onClick={() => setInfoInd(-1)}></div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
{/* 右下角的详情按钮 */}
|
|
{/* 右下角的详情按钮 */}
|
|
<div
|
|
<div
|
|
className="B1toTab3"
|
|
className="B1toTab3"
|