From 2411eb9a84f290fdb44852278c314df826ceb160 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 15 Apr 2022 13:56:47 +0800
Subject: [PATCH] 1
---
src/components/serviceNavBar/index.vue | 76 +++++++++++++++++++++++++++++--------
1 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/src/components/serviceNavBar/index.vue b/src/components/serviceNavBar/index.vue
index 90c57d2..cfb87ff 100644
--- a/src/components/serviceNavBar/index.vue
+++ b/src/components/serviceNavBar/index.vue
@@ -36,12 +36,13 @@
import { mapGetters } from 'vuex'
import { getList, getLifeList } from '@/api/pc/service/index'
+let ourLayer = null
+
export default {
name: 'ServiceNavBar',
data () {
return {
- itemNavList: [],
- ourLayer: null
+ itemNavList: []
}
},
props: {
@@ -68,12 +69,13 @@
// 介绍
'introduceText',
// 全景地址
- 'panoramaUrl'
+ 'panoramaUrl',
+ 'twoOrThree'
])
},
created () {
this.titleList = []
- // 三江校区//"土木楼"//"科学园"//"黄河路"//"红旗校区"
+ // 三江社区//"土木楼"//"科学园"//"黄河路"//"红旗社区"
getList().then((res) => {
res.data.data.forEach((item) => {
// console.log(item, "see");
@@ -88,6 +90,26 @@
this.getChilsNavs(this.titleList[0].key)
})
+ },
+ watch: {
+ twoOrThree: {
+ handler (newData, oldData) {
+ if (newData == '三 维') {
+ if (ourLayer != null) {
+ ourLayer.eachOverlay((item) => {
+ item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 0)
+ })
+ }
+ } else {
+ if (ourLayer != null) {
+ ourLayer.eachOverlay((item) => {
+ item.position = new global.DC.Position(Number(item.position.lng), Number(item.position.lat), 150)
+ })
+ }
+ }
+ },
+ immediate: true
+ }
},
mounted () { },
methods: {
@@ -108,13 +130,13 @@
const that = this
// console.log(this.arcCode, "see22");
// 判断是否是当前所需要图层并创建 属性为 this.arrCode
- if (this.ourLayer != null) {
- this.ourLayer.clear()
+ if (ourLayer != null) {
+ ourLayer.clear()
} else {
- this.ourLayer = new global.DC.HtmlLayer('Layer' + this.arcCode)
- global.viewer.addLayer(this.ourLayer)
+ ourLayer = new global.DC.HtmlLayer('Layer' + this.arcCode)
+ global.viewer.addLayer(ourLayer)
}
- // console.log(this.ourLayer, "see");
+ // console.log(ourLayer, "see");
getLifeList({ lifetype: this.arcCode, campus: campus }).then((res) => {
res.data.data.records.forEach((item) => {
// console.log(item, "see");
@@ -124,15 +146,19 @@
details: item
})
// 创建图标 做生活设施分层标签
- that.addDivIcon(item, this.ourLayer)
+ that.addDivIcon(item, ourLayer)
})
})
},
addDivIcon (item, mylayer) {
const that = this
- const divIcon = new global.DC.DivIcon(
- new global.DC.Position(Number(item.jd), Number(item.wd), 0),
- `
+
+ let divIcon = null
+
+ if (this.twoOrThree == '三 维') {
+ divIcon = new global.DC.DivIcon(
+ new global.DC.Position(Number(item.jd), Number(item.wd), 0),
+ `
<div class="tag-entitys-box">
<div class="tag-content">
${item.mechanismname}
@@ -142,7 +168,23 @@
</div>
</div>
`
- )
+ )
+ } else {
+ divIcon = new global.DC.DivIcon(
+ new global.DC.Position(Number(item.jd), Number(item.wd), 150),
+ `
+ <div class="tag-entitys-box">
+ <div class="tag-content">
+ ${item.mechanismname}
+ </div>
+ <div class="tag-angle-content">
+ <img src="https://map.hit.edu.cn/images/tarrow_xq.png">
+ </div>
+ </div>
+ `
+ )
+ }
+
// 订阅事件
divIcon.on(global.DC.MouseEventType.CLICK, (e) => {
// console.log(item, "see");
@@ -212,9 +254,9 @@
}
},
destroyed () {
- if (this.ourLayer != null) {
- this.ourLayer.remove()
- this.ourLayer = null
+ if (ourLayer != null) {
+ ourLayer.remove()
+ ourLayer = null
}
this.$store.commit('SET_DETAILSPOPUP', false)
--
Gitblit v1.9.3