guoxiaohuan vor 4 Jahren
Ursprung
Commit
a5f74680bf
1 geänderte Dateien mit 19 neuen und 26 gelöschten Zeilen
  1. 19 26
      src/App.vue

+ 19 - 26
src/App.vue

@@ -42,44 +42,37 @@ export default {
         ...mapActions(['getfmapID']),
         ...mapMutations(['SETHAVEFENGMAP']),
         getFengMap() {
-            if (!this.fmapID) {
-                this.getfmapID().then(() => {
-                    this.getMap()
-                })
-                return
-            }
-            this.getMap()
+            this.getfmapID().then(() => {
+                this.getMap()
+            })
         },
         getMap() {
-            if (!window.fengmapData) {
-                window.fengmapData = new SFengParser(
-                    `fengMap${this.id}`,
-                    `${this.mapServerURL}/fmap/${this.fmapID}`,
-                    this.key,
-                    this.appName,
-                    null,
-                    this.mapthemeUrl
-                )
-                window.fengmapData.loadMap(this.fmapID, () => {
-                    console.log('-------------')
-                    console.log(window.fengmapData)
-                    console.log(window.fengmapData.gnameToGid)
-                    console.log('-------------')
-                    // 获取主题数据
-                    window.fengmapData.loadTheme(`${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`).then(res => {
-                        this.SETHAVEFENGMAP()
-                    })
+            window.fengmapData = new SFengParser(
+                `fengMap${this.id}`,
+                `${this.mapServerURL}/fmap/${this.fmapID}`,
+                this.key,
+                this.appName,
+                null,
+                this.mapthemeUrl
+            )
+            window.fengmapData.loadMap(this.fmapID, () => {
+                // 获取主题数据
+                window.fengmapData.loadTheme(`${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`).then(res => {
+                    this.SETHAVEFENGMAP()
                 })
-            }
+            })
         }
     },
     watch: {
         plazaId(plazaId) {
             console.log('获取到id', plazaId)
+            window.fengmapData = null
             // 当获取到到项目id,请求底图
             if (plazaId) {
                 // 请求该项目下的楼层数据
                 this.getFengMap()
+            } else {
+                window.fengmapData = null
             }
         }
     }