From 9650dd9f1d1088118af59ded79f5cce18fdb7280 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 24 Feb 2023 19:36:13 +0800
Subject: [PATCH] Fixed some issues

---
 src/hooks/use-g-map-tsa.ts |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/hooks/use-g-map-tsa.ts b/src/hooks/use-g-map-tsa.ts
index fe3a398..cb29ff8 100644
--- a/src/hooks/use-g-map-tsa.ts
+++ b/src/hooks/use-g-map-tsa.ts
@@ -6,21 +6,20 @@
 import dockIcon from '/@/assets/icons/dock.png'
 import rcIcon from '/@/assets/icons/rc.png'
 import droneIcon from '/@/assets/icons/drone.png'
+import { EDeviceTypeName } from '/@/types'
 
 export function deviceTsaUpdate () {
   const root = getRoot()
   const AMap = root.$aMap
 
   const icons = new Map([
-    ['sub-device', droneIcon],
-    ['gateway', rcIcon],
-    ['dock', dockIcon]
+    [EDeviceTypeName.Aircraft, droneIcon],
+    [EDeviceTypeName.Gateway, rcIcon],
+    [EDeviceTypeName.Dock, dockIcon]
   ])
   const markers = store.state.markerInfo.coverMap
   const paths = store.state.markerInfo.pathMap
 
-  // Fix: 航迹初始化报错
-  // TODO: 从时序上解决
   let trackLine = null as any
   function getTrackLineInstance () {
     if (!trackLine) {
@@ -32,7 +31,7 @@
     return trackLine
   }
 
-  function initIcon (type: string) {
+  function initIcon (type: number) {
     return new AMap.Icon({
       image: icons.get(type),
       imageSize: new AMap.Size(40, 40),
@@ -40,11 +39,7 @@
     })
   }
 
-  function initMarker (type: string, name: string, sn: string, lng?: number, lat?: number) {
-    if (AMap === undefined) {
-      location.reload()
-      return
-    }
+  function initMarker (type: number, name: string, sn: string, lng?: number, lat?: number) {
     if (markers[sn]) {
       return
     }

--
Gitblit v1.9.3