| | |
| | | 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: { |
| | |
| | | // 介绍 |
| | | 'introduceText', |
| | | // 全景地址 |
| | | 'panoramaUrl' |
| | | 'panoramaUrl', |
| | | 'twoOrThree' |
| | | ]) |
| | | }, |
| | | created () { |
| | |
| | | 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 () { |
| | |
| | | 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"); |
| | |
| | | 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} |
| | |
| | | </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"); |
| | |
| | | } |
| | | }, |
| | | destroyed () { |
| | | if (this.ourLayer != null) { |
| | | this.ourLayer.remove() |
| | | this.ourLayer = null |
| | | if (ourLayer != null) { |
| | | ourLayer.remove() |
| | | ourLayer = null |
| | | } |
| | | |
| | | this.$store.commit('SET_DETAILSPOPUP', false) |