From 90d2818e8140e05855e3ad596a6a0982cdd4b807 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 04 Dec 2023 16:13:21 +0800
Subject: [PATCH] 校区切换,弹窗显隐逻辑处理

---
 src/components/map/index.vue |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index c738bb9..47e1069 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -59,7 +59,8 @@
         fullExtent: [
             112.51302281804038, -0.17416638494176828, 112.76131189483516,
             0.000004509395743004334,
-        ]
+        ],
+        polygonUrl: 'https://fkxt.jxstnu.edu.cn/changjing/lkarcgisapp'
     },
     {
         key: 2,
@@ -73,7 +74,8 @@
         ],
         fullExtent: [
             115.76861782444642, 28.63584422760626, 115.82432471553928, 28.663308794331794,
-        ]
+        ],
+        polygonUrl: ''
     }
 ]
 
@@ -159,10 +161,17 @@
                 this.campusCut(newData)
 
                 this.$nextTick(() => {
-                    this.$refs.leftNav.initialize(newData)
+                    this.$store.commit('SET_DETAILSPOPUP', false)
+                    this.$store.commit('SET_MONITORPOPUP', false)
+                    this.$store.commit('SET_PANORAMAPOPUP', false)
+
                     this.$store.commit('SET_ARCNAVBARFLAG', false)
                     this.$store.commit('SET_SEARCHPOPUPFLAG', false)
                     this.$store.commit('SET_SEARCHPOPUPFLAG', false)
+
+                    this.$refs.leftNav.initialize(newData)
+
+                    this.createdLayers(newData)
                 })
             }
         }
@@ -203,10 +212,6 @@
         const that = this
         this.map2D.setTarget('viewer-container')
         this.$nextTick(() => {
-            this.$refs.leftNav.initialize()
-
-            this.createdLayers()
-
             that.map2D.on('pointermove', that.mouseMoveEvent)
 
             this.map2D.on("singleclick", function (event) {
@@ -228,8 +233,13 @@
         })
     },
     methods: {
-        createdLayers () {
+        createdLayers (campusKey) {
             const that = this
+            let curCampus = campusLayers.find(item => item.key == campusKey)
+
+            if (architecturePolygon) {
+                this.map2D.removeLayer(architecturePolygon)
+            }
 
             architecturePolygon = new VectorLayer({
                 // 图标图层
@@ -240,7 +250,7 @@
 
             axios
                 .get(
-                    'https://fkxt.jxstnu.edu.cn/changjing/lkarcgisapp?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson'
+                    curCampus.polygonUrl + '?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson'
                 )
                 .then((resultData) => {
                     resultData.data.features.forEach((item) => {

--
Gitblit v1.9.3