tsg-app/pages/zhjs/subnvue/index.nvue

112 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-11-20 13:24:31 +08:00
<template>
<view class="zhjs-container">
<u-navbar title="综合监视" :autoBack="true" :titleStyle="{
fontSize:'18px'
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
</u-navbar>
2024-11-20 16:33:41 +08:00
<map :style="{
height: windowHeight + 'px',
top: '-' + statusBarHeight + 'px'
}" id="map" ref="map" :latitude="latitude" :longitude="longitude" :markers="marker"
:show-location="true" scale="16.5" :enable-satellite="enableSatellite" theme="satellite" @markertap="markertap">
2024-11-20 13:24:31 +08:00
<cover-image src="/static/tabs/dingwei.png" class="location" @click="onControlTap"></cover-image>
</map>
</view>
</template>
<script>
export default {
data() {
return {
2024-11-20 16:33:41 +08:00
latitude: 31.495,
longitude: 114.767,
enableSatellite:false,
markers: [
{
latitude: 31.4954,
longitude: 114.7693,
iconPath: '/static/tabs/add.png',
width: "25",
height: "25",
id:1,
},
{
latitude: 31.4951,
longitude: 114.767,
iconPath: '/static/tabs/add.png',
2024-11-20 13:24:31 +08:00
width: "25",
2024-11-20 16:33:41 +08:00
height: "25",
id:2,
}
],
dingwei: '../../static/tabs/dingwei.png',
map:null,
windowHeight:0,
windowHeight:0
2024-11-20 13:24:31 +08:00
}
},
2024-11-20 16:33:41 +08:00
created() {
let that = this;
uni.getSystemInfo({
success(res) {
that.windowHeight = res.windowHeight;
that.windowHeight = res.windowHeight + res.statusBarHeight;
that.statusBarHeight = res.statusBarHeight;
that.navTop = res.statusBarHeight + 10;
}
})
},
onReady() {
this.map = uni.createMapContext("map")
},
2024-11-20 13:24:31 +08:00
methods: {
onControlTap(){
2024-11-20 16:33:41 +08:00
this.$refs.map.moveToLocation({
latitude: 31.495,
longitude: 114.767
})
},
markertap(e){
const newMarker = this.markers
newMarker.forEach(((item,i) => {
if(item.id === e.detail.markerId){
item.height=55;
item.width=55;
item.label={
content:"测试",
color:"#57a7f0",
bgColor:"transparent"
}
}else{
item.height=25;
item.width=25;
item.label={
content:" ",
bgColor:"transparent"
}
}
}));
console.log("newMarker",newMarker);
this.markers = [...newMarker];
2024-11-20 13:24:31 +08:00
}
},
2024-11-20 16:33:41 +08:00
computed:{
marker(){
return this.markers.slice(0)
}
}
}
2024-11-20 13:24:31 +08:00
</script>
<style lang="scss">
.location{
position: absolute;
width: 35px;
height:35px;
2024-11-20 16:33:41 +08:00
bottom: 130px;
2024-11-20 13:24:31 +08:00
left:10px;
background-color: #fff;
padding: 5px;
}
</style>