Commit 0429a23667c9cf7717082873a91dc619626ea373

Authored by fengtao
1 parent c109aeca

feat(src/views): 设备地理位置组件,设备在线时显示为绿色,离线时显示为红色,待激活为黄色标,不然全是灰色,而且不注意还不好发现

... ... @@ -233,13 +233,15 @@ const dataHandle = (newData: dataJsonType) => {
233 233 // 记录新标记
234 234 if (mapMarkerType.value === MarkerEnum.MARKER) {
235 235 newData.markers.forEach((markerItem: dataJsonMarkersType) => {
  236 + console.log("🚀 ~ newData.markers.forEach ~ markerItem:", markerItem.extraInfo.deviceState)
236 237 const markerInstance = new AMapIns.Marker({
237 238 position: [markerItem.position[0], markerItem.position[1]],
238 239 offset: new AMapIns.Pixel(-13, 5),
239 240 icon: new AMapIns.Icon({
240   - image: iconMarker.value,
241   - size: new AMapIns.Size(22, 22), //图标所处区域大小
242   - imageSize: new AMapIns.Size(22, 22) //图标大小
  241 + // image: iconMarker.value,
  242 + image: markerItem.extraInfo.deviceState === 'ONLINE' ? online : markerItem.extraInfo.deviceState === 'INACTIVE' ? inactive : offline,
  243 + size: new AMapIns.Size(35, 35), //图标所处区域大小
  244 + imageSize: new AMapIns.Size(35, 35) //图标大小
243 245 })
244 246 })
245 247 // 原作者这种方式添加,属于JS API 1.4.8版本的
... ...