shaogen1995 1 năm trước cách đây
mục cha
commit
2499895987
2 tập tin đã thay đổi với 22 bổ sung14 xóa
  1. 20 10
      code/src/pages/B1Village/index.tsx
  2. 2 4
      静态资源/staticData/dataTemp.js

+ 20 - 10
code/src/pages/B1Village/index.tsx

@@ -10,12 +10,15 @@ function B1Village() {
   const location = useLocation();
 
   const [uId, setUid] = useState("");
-  const [curScene, setCurScene] = useState('scene_zlc');
-  const [hotspotHoverName, setHotspotHoverName] = useState('');
+  const [curScene, setCurScene] = useState("scene_zlc");
+  const [hotspotHoverName, setHotspotHoverName] = useState("");
   const villageData = useSelector(
     (state: RootState) => state.A0Layout.dataAll.village
   );
-  const curVillage = useMemo(() => villageData.find(i => i.id === Number(uId)) || villageData[0], [uId, villageData])
+  const curVillage = useMemo(
+    () => villageData.find((i) => i.id === Number(uId)) || villageData[0],
+    [uId, villageData]
+  );
 
   const architec = useSelector(
     (state: RootState) => state.A0Layout.dataAll.architec
@@ -30,15 +33,17 @@ function B1Village() {
 
   return (
     <div className={styles.B1Village}>
-      <Krpano className={styles.villageKrpano}
+      <Krpano
+        className={styles.villageKrpano}
         xml="/scene.xml"
         currentScene={curScene}
-        >
-        {curVillage.info.map(item => {
+      >
+        {curVillage.info.map((item) => {
           const name = `hotspot${item.id}`;
 
           return (
-            <HotSpot key={name}
+            <HotSpot
+              key={name}
               name={name}
               type="text"
               // @ts-ignore
@@ -50,14 +55,19 @@ function B1Village() {
               distorted={true}
               onClick={() => alert("点击了 " + name)}
               onOver={() => setHotspotHoverName(name)}
-              onOut={() => setHotspotHoverName('')}
+              onOut={() => setHotspotHoverName("")}
             >
-              <div className={classNames(name === hotspotHoverName && styles.hotspotActive, styles.hotspot)}>
+              <div
+                className={classNames(
+                  name === hotspotHoverName && styles.hotspotActive,
+                  styles.hotspot
+                )}
+              >
                 <span className={styles.hotspotLabel}>建筑名</span>
                 <div className={styles.hotspotPointer} />
               </div>
             </HotSpot>
-          )
+          );
         })}
       </Krpano>
 

+ 2 - 4
静态资源/staticData/dataTemp.js

@@ -85,10 +85,9 @@ const staticDataTemp = {
       // 村落详情
       info: [
         {
-          // 要和下面的
           id: 1,
           // 是否有场景,有就填写场景码,没有为空
-          code: '',
+          code: '1196',
           label: '建筑名',
           // 垂直方向
           atv: 0,
@@ -96,10 +95,9 @@ const staticDataTemp = {
           ath: 0
         },
         {
-          // 要和下面的
           id: 2,
           // 是否有场景,有就填写场景码,没有为空
-          code: '',
+          code: '1196',
           label: '建筑名2',
           // 垂直方向
           atv: 0,