From 4f55f7d94198eca8eba9ae6b85af19a07cac2f79 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 29 Apr 2022 17:23:55 +0800
Subject: [PATCH] 内容修改
---
src/components/serviceNavBar/index.vue | 74 +++++++++++++++++++++++++++++--------
1 files changed, 58 insertions(+), 16 deletions(-)
diff --git a/src/components/serviceNavBar/index.vue b/src/components/serviceNavBar/index.vue
index 000369e..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,7 +69,8 @@
// 介绍
'introduceText',
// 全景地址
- 'panoramaUrl'
+ 'panoramaUrl',
+ 'twoOrThree'
])
},
created () {
@@ -89,6 +91,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: {
closeModel () {
@@ -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