Your Name 3 лет назад
Родитель
Сommit
6e841e5b20

+ 16
- 8
src/pages/index/buildingAround/index.jsx Просмотреть файл

@@ -20,9 +20,9 @@ export default withLayout((props) => {
20 20
   const [markers, setMarkers] = useState([])
21 21
   const mapCtx = useRef()
22 22
 
23
-  const CutNav = (id) => {
23
+  const CutNav = (inx) => {
24 24
     return () => {
25
-      setCurrentNavId(id)
25
+      setCurrentNavId(inx)
26 26
     }
27 27
   }
28 28
 
@@ -64,7 +64,7 @@ export default withLayout((props) => {
64 64
         { longitude: center.longitude, latitude: center.latitude },
65 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,8 +100,6 @@ export default withLayout((props) => {
100 100
         if (res.mapJson) {
101 101
           const pois = JSON.parse(res.mapJson).map(poi => ({ ...poi, data: JSON.parse(poi.data) }))
102 102
           setNavList(pois)
103
-          setCurrentNavId(pois[0].key)
104
-          setList(pois[0].data)
105 103
         }
106 104
 
107 105
       } else {
@@ -116,6 +114,16 @@ export default withLayout((props) => {
116 114
 
117 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 127
   const TypeCalc = (key) => {
120 128
     switch (key) {
121 129
       case 'Transport':
@@ -172,9 +180,9 @@ export default withLayout((props) => {
172 180
 
173 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 186
                 </view>
179 187
               ))
180 188
             }

+ 1
- 1
src/pages/index/buildingAround/index.scss Просмотреть файл

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

+ 1
- 6
src/pages/index/findHouseFromMap/index.jsx Просмотреть файл

@@ -21,7 +21,7 @@ export default withLayout((props) => {
21 21
   }
22 22
 
23 23
   const handleMarker = (e) => {
24
-    const { markerId } = e
24
+    const { markerId } = e.detail
25 25
     const building = list[markerId - 1];
26 26
     setCurrent(building||{});
27 27
     setShowInfo(true)
@@ -92,11 +92,6 @@ export default withLayout((props) => {
92 92
           borderRadius: 2,
93 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