添加地图显示

This commit is contained in:
wangxiaowei 2024-09-28 22:54:46 +08:00
parent 734e34a7c3
commit d974c4fa8e
4 changed files with 78 additions and 0 deletions

@ -0,0 +1,61 @@
<template>
<view>
<map id="map" longitude="120.7092" latitude="30.76388" :markers="poiList"
:style="{'height': windowHeight + 'px', 'width': '100%'}" @tap="getLocation"></map>
</view>
</template>
<script>
import {
mapActions,
mapMutations,
mapGetters
} from 'vuex'
export default {
data() {
return {
poiList: [],
windowHeight: 0,
lat: 0,
lng: 0
}
},
onLoad() {
this.windowHeight = uni.getSystemInfoSync().windowHeight
console.log(this.cityInfo)
console.log(this.cityInfo.gcj02_lat)
console.log(this.cityInfo.gcj02_lng)
this.poiList = [{
id: 1,
// latitude: this.cityInfo.gcj02_lat,
// longitude: this.cityInfo.gcj02_lng,
latitude: 30.76388,
longitude: 120.7092,
iconPath: '/bundle_b/static/mark.png',
marker: '/bundle_b/static/mark.png',
width: 40,
height: 40,
alpha: 1
}]
},
methods: {
...mapActions(['initLocationFunc']),
...mapMutations(['setCityInfo']),
getLocation(e) {
console.log(this.poiList)
console.log('e=', e)
this.poiList[0].latitude = e.detail.latitude
this.poiList[0].longitude = e.detail.longitude
},
},
computed: {
...mapGetters(['cityInfo'])
}
}
</script>
<style>
</style>

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

BIN
bundle_b/static/mark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -1168,6 +1168,15 @@
"auth": false
}
},
{
"path": "pages/local_map/index",
"style": {
"navigationBarTitleText": "站点设置"
},
"meta": {
"auth": false
}
},
{
"path": "pages/local_settled/index",
"style": {