From 75caf8524a5934b16176764f8d56d77d11cd4d2c Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 04 Dec 2023 15:55:03 +0800
Subject: [PATCH] 校区切换处理---接口传参

---
 src/components/arcNavBar/index.vue |   57 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/src/components/arcNavBar/index.vue b/src/components/arcNavBar/index.vue
index 59e970b..cf41d18 100644
--- a/src/components/arcNavBar/index.vue
+++ b/src/components/arcNavBar/index.vue
@@ -8,12 +8,12 @@
             <img class="close deblurring" :src="publicPath + 'img/navicon/close.png'" alt @click="closeModel" />
         </template>
         <template slot="public-box-content">
-            <div class="tab" v-show="false">
+            <!-- <div class="tab">
                 <ul>
                     <li :class="{ on: item.flag }" v-for="(item, index) in titleList" :key="index"
                         @click="topNavClick(item, index)">{{ item.title }}</li>
                 </ul>
-            </div>
+            </div> -->
             <ul>
                 <li v-for="(item, index) in itemNavList" :key="index" @click="mapPopup(item)">
                     <img :src="item.icon" alt />
@@ -39,6 +39,7 @@
 import { Icon, Style, Fill, Text, Stroke } from 'ol/style.js'
 
 let currentOrgLayer = null
+let time
 
 export default {
     name: 'ArcNavBar',
@@ -50,7 +51,11 @@
             titleList: []
         }
     },
+
+    inject: ["layoutElement"],
+
     props: {},
+
     computed: {
         ...mapGetters([
             'popupBgUrl',
@@ -70,8 +75,10 @@
             'twoOrThree'
         ])
     },
+
     created () {
     },
+
     mounted () {
         this.$nextTick(() => {
             currentOrgLayer = new VectorLayer({
@@ -82,27 +89,36 @@
             this.map2D.addLayer(currentOrgLayer)
         })
     },
+
     watch: {
         arcNavBarCode: {
             immediate: true,
             handler (newCode, oldCode) {
-                this.titleList = []
-                getList().then((res) => {
-                    res.data.data.forEach((item) => {
-                        this.titleList.push({
-                            title: item.dictValue,
-                            flag: false,
-                            key: item.dictKey
-                        })
-                    })
+                // this.titleList = []
+                // getList().then((res) => {
+                //     res.data.data.forEach((item) => {
+                //         this.titleList.push({
+                //             title: item.dictValue,
+                //             flag: false,
+                //             key: item.dictKey
+                //         })
+                //     })
 
-                    this.titleList[0].flag = true
+                //     this.titleList[0].flag = true
 
-                    this.getChilsNavs(this.titleList[0].key)
-                })
+
+                // })
+
+                time = setInterval(() => {
+                    if (this.layoutElement.campusValue) {
+                        this.getChilsNavs(this.layoutElement.campusValue)
+                        clearInterval(time)
+                    }
+                }, 100)
             }
-        }
+        },
     },
+
     methods: {
 
         coordinate (item) {
@@ -129,7 +145,16 @@
 
             this.itemNavList = []
 
-            currentOrgLayer.getSource().clear()
+            if (currentOrgLayer) {
+                currentOrgLayer.getSource().clear()
+            } else {
+                currentOrgLayer = new VectorLayer({
+                    // 图标图层
+                    zIndex: 9,
+                    source: new VectorSource(),
+                })
+                this.map2D.addLayer(currentOrgLayer)
+            }
 
             getChildNavList({ campus: campus, type: this.arcNavBarCode }).then(
                 (res) => {

--
Gitblit v1.9.3