Commit f541e56ee3f9b220675f28d2831dbef22a74b65a
Merge branch 'ft' into 'main_dev'
pref: 更换首页核心流程指南静态图片和修复地理位置设备没有坐标,原因没有进行容错处理,服务端没有返回deviceInfo See merge request yunteng/thingskit-front!711
Showing
2 changed files
with
19 additions
and
21 deletions
... | ... | @@ -304,27 +304,25 @@ |
304 | 304 | unref(BMapInstance)?.clearOverlays(); |
305 | 305 | const markerList: MarkerList[] = []; |
306 | 306 | data.forEach((item) => { |
307 | - const { | |
308 | - alias, | |
309 | - name, | |
310 | - deviceState, | |
311 | - deviceInfo: { longitude, latitude }, | |
312 | - } = item; | |
313 | - const point = new BMap.Point(longitude, latitude); | |
314 | - const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx; | |
315 | - const myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30)); | |
316 | - const marker = new BMap.Marker(point, { icon: myIcon }); | |
317 | - const label = new BMap.Label(alias || name, { | |
318 | - position: point, | |
319 | - offset: new BMap.Size(-15, -45), | |
320 | - }); | |
321 | - label.setStyle({ | |
322 | - color: '#000', | |
323 | - borderRadius: '5px', | |
324 | - borderColor: '#ccc', | |
325 | - padding: '5px', | |
326 | - }); | |
327 | - markerList.push({ ...item, marker, label }); | |
307 | + const { alias, name, deviceState, deviceInfo } = item; | |
308 | + if (deviceInfo) { | |
309 | + const { longitude, latitude } = deviceInfo; | |
310 | + const point = new BMap.Point(longitude, latitude); | |
311 | + const rivet = deviceState === 'INACTIVE' ? djx : deviceState === 'ONLINE' ? zx : lx; | |
312 | + const myIcon = new BMap.Icon(rivet, new BMap.Size(20, 30)); | |
313 | + const marker = new BMap.Marker(point, { icon: myIcon }); | |
314 | + const label = new BMap.Label(alias || name, { | |
315 | + position: point, | |
316 | + offset: new BMap.Size(-15, -45), | |
317 | + }); | |
318 | + label.setStyle({ | |
319 | + color: '#000', | |
320 | + borderRadius: '5px', | |
321 | + borderColor: '#ccc', | |
322 | + padding: '5px', | |
323 | + }); | |
324 | + markerList.push({ ...item, marker, label }); | |
325 | + } | |
328 | 326 | }); |
329 | 327 | |
330 | 328 | markerList.forEach((record) => { | ... | ... |