提供3D旋转和覆盖物标签隐藏/显示切换

This commit is contained in:
aixianling
2022-11-09 18:00:57 +08:00
parent e7d1bd2af0
commit b2b85d4f2d
3 changed files with 24 additions and 6 deletions

View File

@@ -59,7 +59,8 @@ export default {
// mods,
chartList,
map: null,
lib: null
lib: null,
timer: null
}
},
computed: {
@@ -122,13 +123,14 @@ export default {
},
renderMap(count = 0) {
let {lib: AMap, map} = this
this.timer && clearInterval(this.timer)
if (AMap) {
let infoWin = new AMap.InfoWindow({content: ""})
map.clearMap()
let markers = this.values.filter(e => e.lng).map(e => {
return new AMap.Marker({
map,
content: e.content || `<div class="marker">
content: e.content || `<div class="marker ${this.data.alwaysShow ? 'showLabel' : ''}">
<img src="${e.icon}"/>
<span>${e.label}</span>
</div>`,
@@ -147,7 +149,10 @@ export default {
})
})
map.setFitView(markers)
this.data.is3d && map.setPitch(60)
this.data.is3d && map.setPitch(65)
if (this.data.is3dAround == 1) {
this.timer = setInterval(() => map?.setRotation(360, false, 16000))
}
} else if (count < 10) {
console.log("正在加载...%s", count)
setTimeout(() => this.renderMap(++count), 1000)
@@ -220,7 +225,7 @@ export default {
display: none;
}
&:hover > span {
&:hover > span, &.showLabel > span {
position: absolute;
left: 50%;
bottom: 0;

View File

@@ -101,6 +101,12 @@
<AiAreaGet :instance="instance" :valueLevel="3" v-model="config.areaId" placeholder="地图展示的中心"/>
</div>
</div>
<div class="layout-config__item">
<label>显示标签</label>
<div class="layout-config__item--right">
<ai-select v-model="config.alwaysShow" :selectList="dict.getDict('yesOrNo')"/>
</div>
</div>
<div class="layout-config__item">
<label>展示光轨</label>
<div class="layout-config__item--right">
@@ -119,6 +125,12 @@
<ai-select v-model="config.is3d" :selectList="dict.getDict('yesOrNo')"/>
</div>
</div>
<div class="layout-config__item layout-config__item--input" v-if="config.is3d==1">
<label>3D环绕</label>
<div class="layout-config__item--right">
<ai-select v-model="config.is3dAround" :selectList="dict.getDict('yesOrNo')"/>
</div>
</div>
</template>
<div class="layout-config__item" v-if="config.type === 'summary'">
<label>数据汇总</label>

View File

@@ -533,13 +533,14 @@ const components = [
dynamicData: [],
staticData: [
{
content: '中卫慧通',
label: '中卫慧通',
lng: 117.1339399,
lat: 36.7190487,
}
],
api: '',
thumb: 'https://cdn.cunwuyun.cn/dvcp/dv/tpl/map.png'
thumb: 'https://cdn.cunwuyun.cn/dvcp/dv/tpl/map.png',
is3dAround: '0'
}
]
},