|
@@ -2,12 +2,12 @@ import React, { useEffect, useState } from "react";
|
|
import styles from "./index.module.scss";
|
|
import styles from "./index.module.scss";
|
|
import classNames from "classnames";
|
|
import classNames from "classnames";
|
|
import { envUrl } from "@/utils/env";
|
|
import { envUrl } from "@/utils/env";
|
|
-import { imgLodingFu, maoData2, mapData1 } from "./data";
|
|
|
|
|
|
+import { MapType, imgLodingFu, maoData2, mapData1 } from "./data";
|
|
import iconImg1 from "@/assets/img/map/icon1.png";
|
|
import iconImg1 from "@/assets/img/map/icon1.png";
|
|
import iconImg1Ac from "@/assets/img/map/icon1Ac.png";
|
|
import iconImg1Ac from "@/assets/img/map/icon1Ac.png";
|
|
import iconImg2 from "@/assets/img/map/icon2.png";
|
|
import iconImg2 from "@/assets/img/map/icon2.png";
|
|
import iconImg2Ac from "@/assets/img/map/icon2Ac.png";
|
|
import iconImg2Ac from "@/assets/img/map/icon2Ac.png";
|
|
-import MapSon from "./MapSon";
|
|
|
|
|
|
+import MapSon from "./Iframe";
|
|
import ImgLoding from "@/components/ImgLoding";
|
|
import ImgLoding from "@/components/ImgLoding";
|
|
import { baseURL } from "@/utils/http";
|
|
import { baseURL } from "@/utils/http";
|
|
|
|
|
|
@@ -18,7 +18,8 @@ type Props = {
|
|
|
|
|
|
function A0Map({ type, sonChaneType }: Props) {
|
|
function A0Map({ type, sonChaneType }: Props) {
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- // console.log(123,type);
|
|
|
|
|
|
+ setSonPage(null);
|
|
|
|
+ setCheckedData1(null);
|
|
|
|
|
|
// if (type === 3) setMapSon(0);
|
|
// if (type === 3) setMapSon(0);
|
|
if (type !== 2) setMapSon(0);
|
|
if (type !== 2) setMapSon(0);
|
|
@@ -30,6 +31,9 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
// 鼠标hover
|
|
// 鼠标hover
|
|
const [isHover, setIsHover] = useState(0);
|
|
const [isHover, setIsHover] = useState(0);
|
|
|
|
|
|
|
|
+ const [sonPage, setSonPage] = useState<string | null>(null);
|
|
|
|
+ const [checkedData1, setCheckedData1] = useState<MapType | null>(null);
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className={styles.A0Map}>
|
|
<div className={styles.A0Map}>
|
|
{/* 大图片加载中 */}
|
|
{/* 大图片加载中 */}
|
|
@@ -44,19 +48,19 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
)}
|
|
)}
|
|
>
|
|
>
|
|
{/* 定位大图标 */}
|
|
{/* 定位大图标 */}
|
|
- {mapData1.map((v) => (
|
|
|
|
|
|
+ {mapData1.map((v, index) => (
|
|
<div
|
|
<div
|
|
onMouseEnter={() => setIsHover(v.id)}
|
|
onMouseEnter={() => setIsHover(v.id)}
|
|
onMouseLeave={() => setIsHover(0)}
|
|
onMouseLeave={() => setIsHover(0)}
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- setMapSon(v.imgId);
|
|
|
|
- sonChaneType(2);
|
|
|
|
|
|
+ setCheckedData1(v);
|
|
|
|
+ setSonPage(v.filename);
|
|
}}
|
|
}}
|
|
key={v.id}
|
|
key={v.id}
|
|
className="A0iconBox"
|
|
className="A0iconBox"
|
|
style={{ top: v.y, left: v.x, zIndex: v.ind }}
|
|
style={{ top: v.y, left: v.x, zIndex: v.ind }}
|
|
>
|
|
>
|
|
- <div className="iconNum">{v.id}</div>
|
|
|
|
|
|
+ <div className="iconNum">{index + 1}</div>
|
|
|
|
|
|
<img className="iconImg1" src={iconImg1} alt="" />
|
|
<img className="iconImg1" src={iconImg1} alt="" />
|
|
<img className="iconImg2" src={iconImg1Ac} alt="" />
|
|
<img className="iconImg2" src={iconImg1Ac} alt="" />
|
|
@@ -87,7 +91,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
{maoData2.map((v) => (
|
|
{maoData2.map((v) => (
|
|
<div
|
|
<div
|
|
onClick={() => {
|
|
onClick={() => {
|
|
- window.open(baseURL + v.link);
|
|
|
|
|
|
+ window.open(v.link.startsWith('http') ? v.link : baseURL + v.link);
|
|
// setMapSon(v.imgId);
|
|
// setMapSon(v.imgId);
|
|
sonChaneType(3);
|
|
sonChaneType(3);
|
|
}}
|
|
}}
|
|
@@ -116,7 +120,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
<div
|
|
<div
|
|
className={classNames(
|
|
className={classNames(
|
|
"ic2HoverBox",
|
|
"ic2HoverBox",
|
|
- v.type === "right" ? "ic2HoverBox2" : ""
|
|
|
|
|
|
+ v.type === "right" ? "ic2HoverBox2" : v.type === "center" ? "ic2HoverBox3" : ""
|
|
)}
|
|
)}
|
|
>
|
|
>
|
|
<div className="ic2HoverBoxll">{v.name}</div>
|
|
<div className="ic2HoverBoxll">{v.name}</div>
|
|
@@ -138,7 +142,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{/* 二级地图 */}
|
|
{/* 二级地图 */}
|
|
- {mapSon ? <MapSon sId={mapSon} /> : null}
|
|
|
|
|
|
+ {(sonPage && checkedData1) ? <MapSon title={checkedData1.name} filename={sonPage} /> : null}
|
|
|
|
|
|
{/* <div className="yunBox">
|
|
{/* <div className="yunBox">
|
|
<div className="yunSon1"></div>
|
|
<div className="yunSon1"></div>
|