|
|
@@ -2,46 +2,40 @@ import React, { useEffect, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import classNames from "classnames";
|
|
|
import { envUrl } from "@/utils/env";
|
|
|
-import { MapType, imgLodingFu, maoData2, mapData1 } from "./data";
|
|
|
+import { imgLodingFu, maoData2, mapData1 } from "./data";
|
|
|
import iconImg1 from "@/assets/img/map/icon1.png";
|
|
|
import iconImg1Ac from "@/assets/img/map/icon1Ac.png";
|
|
|
import iconImg2 from "@/assets/img/map/icon2.png";
|
|
|
import iconImg2Ac from "@/assets/img/map/icon2Ac.png";
|
|
|
-import MapSon from "./Iframe";
|
|
|
import ImgLoding from "@/components/ImgLoding";
|
|
|
import { baseURL } from "@/utils/http";
|
|
|
+import MapSon from "./MapSon";
|
|
|
|
|
|
type Props = {
|
|
|
type: number;
|
|
|
+ // 给父亲切换右侧高亮
|
|
|
sonChaneType: (val: number) => void;
|
|
|
};
|
|
|
|
|
|
function A0Map({ type, sonChaneType }: Props) {
|
|
|
useEffect(() => {
|
|
|
- if (type !== 2) {
|
|
|
- setSonPage(null);
|
|
|
- setCheckedData1(null);
|
|
|
- setMapSon(0);
|
|
|
- }
|
|
|
+ if (type !== 2) setUnityId(0);
|
|
|
}, [type]);
|
|
|
|
|
|
- // 控制二级地图的显示
|
|
|
- const [mapSon, setMapSon] = useState(0);
|
|
|
+ // 控制左下角的返回按钮 和 unity 页面的显示
|
|
|
+ const [unityId, setUnityId] = useState(0);
|
|
|
|
|
|
// 鼠标hover
|
|
|
const [isHover, setIsHover] = useState(0);
|
|
|
|
|
|
- const [sonPage, setSonPage] = useState<string | null>(null);
|
|
|
- const [checkedData1, setCheckedData1] = useState<MapType | null>(null);
|
|
|
-
|
|
|
return (
|
|
|
<div className={styles.A0Map}>
|
|
|
{/* 大图片加载中 */}
|
|
|
- <ImgLoding id={mapSon} />
|
|
|
+ <ImgLoding id={0} />
|
|
|
|
|
|
{/* 一级地图盒子 */}
|
|
|
<div
|
|
|
- style={{ opacity: mapSon ? "0" : "1" }}
|
|
|
+ style={{ opacity: unityId ? "0" : "1" }}
|
|
|
className={classNames(
|
|
|
"mapMain",
|
|
|
type === 2 ? "mapMain2" : type === 3 ? "mapMain3" : ""
|
|
|
@@ -53,9 +47,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
|
onMouseEnter={() => setIsHover(v.id)}
|
|
|
onMouseLeave={() => setIsHover(0)}
|
|
|
onClick={() => {
|
|
|
- setCheckedData1(v);
|
|
|
- setSonPage(v.filename);
|
|
|
-
|
|
|
+ setUnityId(v.imgId);
|
|
|
sonChaneType(2);
|
|
|
}}
|
|
|
key={v.id}
|
|
|
@@ -96,7 +88,6 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
|
window.open(
|
|
|
v.link.startsWith("http") ? v.link : baseURL + v.link
|
|
|
);
|
|
|
- // setMapSon(v.imgId);
|
|
|
sonChaneType(3);
|
|
|
}}
|
|
|
key={v.id}
|
|
|
@@ -150,20 +141,12 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
|
</div>
|
|
|
|
|
|
{/* 二级地图 */}
|
|
|
- {sonPage && checkedData1 ? (
|
|
|
- <MapSon title={checkedData1.name} filename={sonPage} />
|
|
|
- ) : null}
|
|
|
-
|
|
|
- {/* <div className="yunBox">
|
|
|
- <div className="yunSon1"></div>
|
|
|
- <div className="yunSon2"></div>
|
|
|
- <div className="yunSon3"></div>
|
|
|
- </div> */}
|
|
|
+ {unityId ? <MapSon sId={unityId} /> : null}
|
|
|
|
|
|
{/* 左下角的返回 */}
|
|
|
- {mapSon ? (
|
|
|
- <div className="sonToBack" onClick={() => setMapSon(0)}>
|
|
|
- <img src={`${envUrl}/map/map${mapSon}.png`} alt="" />
|
|
|
+ {unityId ? (
|
|
|
+ <div className="sonToBack" onClick={() => setUnityId(0)}>
|
|
|
+ <img src={`${envUrl}/App/main1/map${unityId}.png`} alt="" />
|
|
|
</div>
|
|
|
) : null}
|
|
|
</div>
|