校园-江西科技师范大学-前端
shuishen
2023-12-04 75caf8524a5934b16176764f8d56d77d11cd4d2c
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) => {