|
@@ -15,8 +15,8 @@ export default withLayout((props) => {
|
15
|
15
|
const [loc, setLoc] = useState([])
|
16
|
16
|
const [NavList, setNavList] = useState([])
|
17
|
17
|
const [CurrentNavId, setCurrentNavId] = useState(1)
|
18
|
|
- const [List, setList] = useState([{}, {}, {}, {}, {}, {}, {}, {}, {}])
|
19
|
|
- const [OtherList, setOtherList] = useState([{}, {}, {}, {}, {}, {}, {}, {}, {}])
|
|
18
|
+ const [List, setList] = useState([])
|
|
19
|
+ const [OtherList, setOtherList] = useState([])
|
20
|
20
|
const [markers, setMarkers] = useState([])
|
21
|
21
|
const mapCtx = useRef()
|
22
|
22
|
|
|
@@ -61,8 +61,8 @@ export default withLayout((props) => {
|
61
|
61
|
if (mapCtx.current) {
|
62
|
62
|
// 缩放地图,显示所有 marker
|
63
|
63
|
const points = [
|
64
|
|
- {longitude: center.longitude, latitude: center.latitude},
|
65
|
|
- {longitude: marker.longitude, latitude: marker.latitude}
|
|
64
|
+ { longitude: center.longitude, latitude: center.latitude },
|
|
65
|
+ { longitude: marker.longitude, latitude: marker.latitude }
|
66
|
66
|
]
|
67
|
67
|
mapCtx.current.includePoints({ points, padding: [32] })
|
68
|
68
|
}
|
|
@@ -98,12 +98,12 @@ export default withLayout((props) => {
|
98
|
98
|
}])
|
99
|
99
|
setDetailInfo(res || {})
|
100
|
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
|
102
|
setNavList(pois)
|
103
|
103
|
setCurrentNavId(pois[0].key)
|
104
|
104
|
setList(pois[0].data)
|
105
|
105
|
}
|
106
|
|
-
|
|
106
|
+
|
107
|
107
|
} else {
|
108
|
108
|
Taro.showToast({
|
109
|
109
|
title: '当前楼盘未设置位置信息',
|
|
@@ -116,6 +116,25 @@ export default withLayout((props) => {
|
116
|
116
|
|
117
|
117
|
}, [id])
|
118
|
118
|
|
|
119
|
+ const TypeCalc = (key) => {
|
|
120
|
+ switch (key) {
|
|
121
|
+ case 'Transport':
|
|
122
|
+ return '交通'
|
|
123
|
+ case 'Mall':
|
|
124
|
+ return '商业'
|
|
125
|
+ case 'Edu':
|
|
126
|
+ return '学校'
|
|
127
|
+ case 'Hospital':
|
|
128
|
+ return '医院'
|
|
129
|
+ case 'Bank':
|
|
130
|
+ return '银行'
|
|
131
|
+ case 'Restaurant':
|
|
132
|
+ return '餐饮'
|
|
133
|
+ default:
|
|
134
|
+ return ''
|
|
135
|
+ }
|
|
136
|
+ }
|
|
137
|
+
|
119
|
138
|
return (
|
120
|
139
|
<view className='Page buildingAround'>
|
121
|
140
|
|
|
@@ -153,9 +172,9 @@ export default withLayout((props) => {
|
153
|
172
|
|
154
|
173
|
<view className='Nav flex-h'>
|
155
|
174
|
{
|
156
|
|
- NavList.map((item, index) => (
|
|
175
|
+ NavList.map((item) => (
|
157
|
176
|
<view className={item.key === CurrentNavId ? 'flex-item active' : 'flex-item'} key={item.key}>
|
158
|
|
- <text onClick={CutNav(item.key)}>{`${item.label}(${item.data.length})`}</text>
|
|
177
|
+ <text onClick={CutNav(item.key)}>{`${TypeCalc(item.key)}(${item.data.length})`}</text>
|
159
|
178
|
</view>
|
160
|
179
|
))
|
161
|
180
|
}
|
|
@@ -175,12 +194,15 @@ export default withLayout((props) => {
|
175
|
194
|
<text>{item.name}</text>
|
176
|
195
|
</view>
|
177
|
196
|
<text className='iconfont icon-dingwei'></text>
|
178
|
|
- <text className='distance'>{`${item.distance}m`}</text>
|
|
197
|
+ <text className='distance'>{`${item.distance || '-'}m`}</text>
|
179
|
198
|
</view>
|
180
|
199
|
))
|
181
|
200
|
}
|
182
|
201
|
</view>
|
183
|
|
- <text>其他</text>
|
|
202
|
+ {
|
|
203
|
+ OtherList.length > 0 &&
|
|
204
|
+ <text>其他</text>
|
|
205
|
+ }
|
184
|
206
|
<view className='List'>
|
185
|
207
|
{
|
186
|
208
|
OtherList.map((item, index) => (
|