Your Name 3 년 전
부모
커밋
6e841e5b20
3개의 변경된 파일18개의 추가작업 그리고 15개의 파일을 삭제
  1. 16
    8
      src/pages/index/buildingAround/index.jsx
  2. 1
    1
      src/pages/index/buildingAround/index.scss
  3. 1
    6
      src/pages/index/findHouseFromMap/index.jsx

+ 16
- 8
src/pages/index/buildingAround/index.jsx 파일 보기

20
   const [markers, setMarkers] = useState([])
20
   const [markers, setMarkers] = useState([])
21
   const mapCtx = useRef()
21
   const mapCtx = useRef()
22
 
22
 
23
-  const CutNav = (id) => {
23
+  const CutNav = (inx) => {
24
     return () => {
24
     return () => {
25
-      setCurrentNavId(id)
25
+      setCurrentNavId(inx)
26
     }
26
     }
27
   }
27
   }
28
 
28
 
64
         { longitude: center.longitude, latitude: center.latitude },
64
         { longitude: center.longitude, latitude: center.latitude },
65
         { longitude: marker.longitude, latitude: marker.latitude }
65
         { longitude: marker.longitude, latitude: marker.latitude }
66
       ]
66
       ]
67
-      mapCtx.current.includePoints({ points, padding: [32] })
67
+      mapCtx.current.includePoints({ points, padding: [64] })
68
     }
68
     }
69
   }
69
   }
70
 
70
 
100
         if (res.mapJson) {
100
         if (res.mapJson) {
101
           const pois = JSON.parse(res.mapJson).map(poi => ({ ...poi, data: JSON.parse(poi.data) }))
101
           const pois = JSON.parse(res.mapJson).map(poi => ({ ...poi, data: JSON.parse(poi.data) }))
102
           setNavList(pois)
102
           setNavList(pois)
103
-          setCurrentNavId(pois[0].key)
104
-          setList(pois[0].data)
105
         }
103
         }
106
 
104
 
107
       } else {
105
       } else {
116
 
114
 
117
   }, [id])
115
   }, [id])
118
 
116
 
117
+  useEffect(() => {
118
+    if (NavList && NavList.length) {
119
+      const { key, data } = NavList[CurrentNavId]
120
+      setList(data)
121
+
122
+      const tags = DetailInfo[key] || ''
123
+      setOtherList(tags.split(',').filter(Boolean))
124
+    }
125
+  }, [NavList, CurrentNavId, DetailInfo])
126
+
119
   const TypeCalc = (key) => {
127
   const TypeCalc = (key) => {
120
     switch (key) {
128
     switch (key) {
121
       case 'Transport':
129
       case 'Transport':
172
 
180
 
173
           <view className='Nav flex-h'>
181
           <view className='Nav flex-h'>
174
             {
182
             {
175
-              NavList.map((item) => (
176
-                <view className={item.key === CurrentNavId ? 'flex-item active' : 'flex-item'} key={item.key}>
177
-                  <text onClick={CutNav(item.key)}>{`${TypeCalc(item.key)}(${item.data.length})`}</text>
183
+              NavList.map((item, inx) => (
184
+                <view className={inx === CurrentNavId ? 'flex-item active' : 'flex-item'} key={item.key}>
185
+                  <text onClick={CutNav(inx)}>{`${TypeCalc(item.key)}(${item.data.length})`}</text>
178
                 </view>
186
                 </view>
179
               ))
187
               ))
180
             }
188
             }

+ 1
- 1
src/pages/index/buildingAround/index.scss 파일 보기

12
     background: #eee;
12
     background: #eee;
13
     >view {
13
     >view {
14
       width: 100%;
14
       width: 100%;
15
-      height: calc(100vh - 600px);
15
+      height: calc(100vh - 700px);
16
       position: relative;
16
       position: relative;
17
       overflow: hidden;
17
       overflow: hidden;
18
 
18
 

+ 1
- 6
src/pages/index/findHouseFromMap/index.jsx 파일 보기

21
   }
21
   }
22
 
22
 
23
   const handleMarker = (e) => {
23
   const handleMarker = (e) => {
24
-    const { markerId } = e
24
+    const { markerId } = e.detail
25
     const building = list[markerId - 1];
25
     const building = list[markerId - 1];
26
     setCurrent(building||{});
26
     setCurrent(building||{});
27
     setShowInfo(true)
27
     setShowInfo(true)
92
           borderRadius: 2,
92
           borderRadius: 2,
93
           borderColor: 'rgba(0,0,0, .1)',
93
           borderColor: 'rgba(0,0,0, .1)',
94
         }
94
         }
95
-        // customCallout: {
96
-        //   anchorY: 0,
97
-        //   anchorX: 0,
98
-        //   display: 'ALWAYS',
99
-        // }
100
       }
95
       }
101
     })
96
     })
102
 
97