瀏覽代碼

fix-点击大点右侧展陈不高亮的问题

shaogen1995 1 年之前
父節點
當前提交
9f40bdb82c
共有 1 個文件被更改,包括 18 次插入8 次删除
  1. 18 8
      pc/src/pages/A0Map/index.tsx

+ 18 - 8
pc/src/pages/A0Map/index.tsx

@@ -18,11 +18,11 @@ type Props = {
 
 function A0Map({ type, sonChaneType }: Props) {
   useEffect(() => {
-    setSonPage(null);
-    setCheckedData1(null);
-
-    // if (type === 3) setMapSon(0);
-    if (type !== 2) setMapSon(0);
+    if (type !== 2) {
+      setSonPage(null);
+      setCheckedData1(null);
+      setMapSon(0);
+    }
   }, [type]);
 
   // 控制二级地图的显示
@@ -55,6 +55,8 @@ function A0Map({ type, sonChaneType }: Props) {
             onClick={() => {
               setCheckedData1(v);
               setSonPage(v.filename);
+
+              sonChaneType(2);
             }}
             key={v.id}
             className="A0iconBox"
@@ -91,7 +93,9 @@ function A0Map({ type, sonChaneType }: Props) {
         {maoData2.map((v) => (
           <div
             onClick={() => {
-              window.open(v.link.startsWith('http') ? v.link : baseURL + v.link);
+              window.open(
+                v.link.startsWith("http") ? v.link : baseURL + v.link
+              );
               // setMapSon(v.imgId);
               sonChaneType(3);
             }}
@@ -120,7 +124,11 @@ function A0Map({ type, sonChaneType }: Props) {
             <div
               className={classNames(
                 "ic2HoverBox",
-                v.type === "right" ? "ic2HoverBox2" : v.type === "center" ? "ic2HoverBox3" : ""
+                v.type === "right"
+                  ? "ic2HoverBox2"
+                  : v.type === "center"
+                  ? "ic2HoverBox3"
+                  : ""
               )}
             >
               <div className="ic2HoverBoxll">{v.name}</div>
@@ -142,7 +150,9 @@ function A0Map({ type, sonChaneType }: Props) {
       </div>
 
       {/* 二级地图 */}
-      {(sonPage && checkedData1) ? <MapSon title={checkedData1.name} filename={sonPage} /> : null}
+      {sonPage && checkedData1 ? (
+        <MapSon title={checkedData1.name} filename={sonPage} />
+      ) : null}
 
       {/* <div className="yunBox">
         <div className="yunSon1"></div>