|
@@ -1,4 +1,4 @@
|
|
-import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
|
|
|
+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";
|
|
@@ -8,9 +8,7 @@ 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 "./MapSon";
|
|
-import { useSelector } from "react-redux";
|
|
|
|
-import { RootState } from "@/store";
|
|
|
|
-import { domShowFu } from "@/utils/domShow";
|
|
|
|
|
|
+import ImgLoding from "@/components/ImgLoding";
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
type: number;
|
|
type: number;
|
|
@@ -18,78 +16,22 @@ type Props = {
|
|
};
|
|
};
|
|
|
|
|
|
function A0Map({ type, sonChaneType }: Props) {
|
|
function A0Map({ type, sonChaneType }: Props) {
|
|
-
|
|
|
|
-
|
|
|
|
- useEffect(()=>{
|
|
|
|
- if(type===3) setMapSon(0)
|
|
|
|
- },[type])
|
|
|
|
-
|
|
|
|
- // 进页面显示加载中
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- domShowFu("#AsyncSpinLoding", true);
|
|
|
|
- }, []);
|
|
|
|
-
|
|
|
|
- // 一级地图 图片的加载
|
|
|
|
- const imgLodingArr = useSelector(
|
|
|
|
- (state: RootState) => state.A0layout.imgLodingArr
|
|
|
|
- );
|
|
|
|
|
|
+ if (type === 3) setMapSon(0);
|
|
|
|
+ }, [type]);
|
|
|
|
|
|
// 控制二级地图的显示
|
|
// 控制二级地图的显示
|
|
const [mapSon, setMapSon] = useState(0);
|
|
const [mapSon, setMapSon] = useState(0);
|
|
|
|
|
|
- // 大图片是否已经加载完
|
|
|
|
- const isImgLodingFu = useCallback(() => {
|
|
|
|
- let flag = false;
|
|
|
|
-
|
|
|
|
- if (imgLodingArr.includes(mapSon)) {
|
|
|
|
- domShowFu("#AsyncSpinLoding", false);
|
|
|
|
- flag = true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return flag;
|
|
|
|
- }, [imgLodingArr, mapSon]);
|
|
|
|
-
|
|
|
|
- // 开场动画帧的变化
|
|
|
|
- const [moveInd, setMoveInd] = useState(0);
|
|
|
|
- const moveTime = useRef(-1);
|
|
|
|
- const moveYun = useCallback(() => {
|
|
|
|
- if (!isImgLodingFu()) {
|
|
|
|
- clearInterval(moveTime.current);
|
|
|
|
- let num = 0;
|
|
|
|
- moveTime.current = window.setInterval(() => {
|
|
|
|
- setMoveInd(num);
|
|
|
|
- num++;
|
|
|
|
- if (num > 30 || isImgLodingFu()) {
|
|
|
|
- clearInterval(moveTime.current);
|
|
|
|
- }
|
|
|
|
- }, 50);
|
|
|
|
- }
|
|
|
|
- }, [isImgLodingFu]);
|
|
|
|
-
|
|
|
|
- useEffect(() => {
|
|
|
|
- moveYun();
|
|
|
|
-
|
|
|
|
- return () => {
|
|
|
|
- clearInterval(moveTime.current);
|
|
|
|
- };
|
|
|
|
- }, [moveYun]);
|
|
|
|
-
|
|
|
|
// 鼠标hover
|
|
// 鼠标hover
|
|
const [isHover, setIsHover] = useState(0);
|
|
const [isHover, setIsHover] = useState(0);
|
|
|
|
|
|
return (
|
|
return (
|
|
<div className={styles.A0Map}>
|
|
<div className={styles.A0Map}>
|
|
- {/* 开场动画帧 */}
|
|
|
|
- <div
|
|
|
|
- className={classNames(
|
|
|
|
- "videoBoxMove",
|
|
|
|
- isImgLodingFu() ? "videoBoxHide" : ""
|
|
|
|
- )}
|
|
|
|
- >
|
|
|
|
- <img src={`${envUrl}/yunMove/yan_${moveInd}.png`} alt="" />
|
|
|
|
- </div>
|
|
|
|
|
|
+ {/* 大图片加载中 */}
|
|
|
|
+ <ImgLoding id={mapSon} />
|
|
|
|
|
|
- {/* 一级地图 */}
|
|
|
|
|
|
+ {/* 一级地图盒子 */}
|
|
<div
|
|
<div
|
|
className={classNames(
|
|
className={classNames(
|
|
"mapMain",
|
|
"mapMain",
|
|
@@ -147,7 +89,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
key={v.id}
|
|
key={v.id}
|
|
className={classNames(
|
|
className={classNames(
|
|
"A0iconSmBox",
|
|
"A0iconSmBox",
|
|
- v.type === "right" ? "A0iconSmBoxR" : ""
|
|
|
|
|
|
+ v.loc === "顶部" ? "A0iconSmBoxR" : ""
|
|
)}
|
|
)}
|
|
style={{
|
|
style={{
|
|
top: v.y,
|
|
top: v.y,
|
|
@@ -180,6 +122,7 @@ function A0Map({ type, sonChaneType }: Props) {
|
|
</div>
|
|
</div>
|
|
))}
|
|
))}
|
|
|
|
|
|
|
|
+ {/* 一级地图 图片 */}
|
|
<div className="mapBac">
|
|
<div className="mapBac">
|
|
<img
|
|
<img
|
|
onLoad={() => imgLodingFu(0)}
|
|
onLoad={() => imgLodingFu(0)}
|