From 31ad252341e3614daab677a9cf2e37f62489484e Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 18 Nov 2022 18:35:12 +0800
Subject: [PATCH] initial v1.3.0
---
src/hooks/use-g-map-tsa.ts | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/hooks/use-g-map-tsa.ts b/src/hooks/use-g-map-tsa.ts
index 6db59d8..fe3a398 100644
--- a/src/hooks/use-g-map-tsa.ts
+++ b/src/hooks/use-g-map-tsa.ts
@@ -3,18 +3,19 @@
import { ELocalStorageKey } from '/@/types'
import { getDeviceBySn } from '/@/api/manage'
import { message } from 'ant-design-vue'
+import dockIcon from '/@/assets/icons/dock.png'
+import rcIcon from '/@/assets/icons/rc.png'
+import droneIcon from '/@/assets/icons/drone.png'
export function deviceTsaUpdate () {
const root = getRoot()
const AMap = root.$aMap
- const icons: {
- [key: string]: string
- } = {
- 'sub-device': '/@/assets/icons/drone.png',
- 'gateway': '/@/assets/icons/rc.png',
- 'dock': '/@/assets/icons/dock.png'
- }
+ const icons = new Map([
+ ['sub-device', droneIcon],
+ ['gateway', rcIcon],
+ ['dock', dockIcon]
+ ])
const markers = store.state.markerInfo.coverMap
const paths = store.state.markerInfo.pathMap
@@ -33,12 +34,17 @@
function initIcon (type: string) {
return new AMap.Icon({
- image: icons[type],
- imageSize: new AMap.Size(40, 40)
+ image: icons.get(type),
+ imageSize: new AMap.Size(40, 40),
+ size: new AMap.Size(40, 40)
})
}
function initMarker (type: string, name: string, sn: string, lng?: number, lat?: number) {
+ if (AMap === undefined) {
+ location.reload()
+ return
+ }
if (markers[sn]) {
return
}
@@ -50,7 +56,6 @@
offset: [0, -20],
})
root.$map.add(markers[sn])
-
// markers[sn].on('moving', function (e: any) {
// let path = paths[sn]
// if (!path) {
--
Gitblit v1.9.3