feat(): 点位设置
parent
bd14cecf03
commit
aa79676ee2
|
|
@ -1,59 +1,10 @@
|
||||||
<template>
|
<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>
|
|
||||||
<map style="width:100vw; height:100vh;margin-top:70px" id="map" :latitude="latitude" :longitude="longitude" :markers="markers"
|
|
||||||
:show-location="true" scale="13" :enable-satellite="enableSatellite" theme="satellite">
|
|
||||||
<cover-image src="/static/tabs/dingwei.png" class="location" @click="onControlTap"></cover-image>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
latitude: 31.52,
|
|
||||||
longitude: 114.76,
|
|
||||||
enableSatellite:true,
|
|
||||||
markers: [{
|
|
||||||
latitude: 31.52,
|
|
||||||
longitude: 114.76,
|
|
||||||
iconPath: '../../static/tabs/add.png',
|
|
||||||
width: "25",
|
|
||||||
height: "25"
|
|
||||||
}],
|
|
||||||
dingwei: '../../static/tabs/dingwei.png'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onControlTap(){
|
|
||||||
const map = uni.createMapContext("map");
|
|
||||||
map.moveToLocation()
|
|
||||||
},
|
|
||||||
nvueShow: function() {
|
|
||||||
const subnvue = uni.getSubNVueById('drawer') // 获取nvue
|
|
||||||
console.log(subnvue);
|
|
||||||
subnvue.show() // 显示nvue
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.nvueShow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.location{
|
|
||||||
position: absolute;
|
|
||||||
width: 35px;
|
|
||||||
height:35px;
|
|
||||||
bottom: 100px;
|
|
||||||
left:10px;
|
|
||||||
background-color: #fff;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -4,8 +4,12 @@
|
||||||
fontSize:'18px'
|
fontSize:'18px'
|
||||||
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
|
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<map style="width:100vw; height:100vh;margin-top:70px" id="map" :latitude="latitude" :longitude="longitude" :markers="markers"
|
<map :style="{
|
||||||
:show-location="true" scale="13" :enable-satellite="enableSatellite" theme="satellite">
|
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">
|
||||||
|
|
||||||
<cover-image src="/static/tabs/dingwei.png" class="location" @click="onControlTap"></cover-image>
|
<cover-image src="/static/tabs/dingwei.png" class="location" @click="onControlTap"></cover-image>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
|
|
@ -15,25 +19,83 @@
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
latitude: 31.52,
|
latitude: 31.495,
|
||||||
longitude: 114.76,
|
longitude: 114.767,
|
||||||
enableSatellite:true,
|
enableSatellite:false,
|
||||||
markers: [{
|
markers: [
|
||||||
latitude: 31.52,
|
{
|
||||||
longitude: 114.76,
|
latitude: 31.4954,
|
||||||
iconPath: '../../static/tabs/add.png',
|
longitude: 114.7693,
|
||||||
|
iconPath: '/static/tabs/add.png',
|
||||||
width: "25",
|
width: "25",
|
||||||
height: "25"
|
height: "25",
|
||||||
}],
|
id:1,
|
||||||
dingwei: '../../static/tabs/dingwei.png'
|
},
|
||||||
|
{
|
||||||
|
latitude: 31.4951,
|
||||||
|
longitude: 114.767,
|
||||||
|
iconPath: '/static/tabs/add.png',
|
||||||
|
width: "25",
|
||||||
|
height: "25",
|
||||||
|
id:2,
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
dingwei: '../../static/tabs/dingwei.png',
|
||||||
|
map:null,
|
||||||
|
windowHeight:0,
|
||||||
|
windowHeight:0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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")
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onControlTap(){
|
onControlTap(){
|
||||||
const map = uni.createMapContext("map");
|
this.$refs.map.moveToLocation({
|
||||||
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];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
marker(){
|
||||||
|
return this.markers.slice(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -42,7 +104,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
height:35px;
|
height:35px;
|
||||||
bottom: 100px;
|
bottom: 130px;
|
||||||
left:10px;
|
left:10px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue