You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.4 KiB

4 years ago
<template>
<view>
4 years ago
<map style="width: 100%; height: 100vh;position: relative;" @markertap="markertap" :latitude="info.latitude"
:longitude="info.longitude" :markers="covers"></map>
4 years ago
</view>
</template>
<script>
export default {
data() {
return {
4 years ago
info: {},
2 years ago
covers: [{
latitude: 31.297241,
longitude: 120.580792,
width: 30,
height: 30,
iconPath: '/static/img/location.png',
id: 1
}],
4 years ago
}
},
onLoad() {
4 years ago
this.openlocation();
4 years ago
},
onShareAppMessage() {
4 years ago
return this.util.shareInfo
4 years ago
},
methods: {
4 years ago
markertap() {
this.openlocation();
},
openlocation() {
2 years ago
this.loadInfo(function(res) {
console.log("123")
4 years ago
uni.openLocation({
latitude: res.latitude,
longitude: res.longitude,
name: res.name,
address: res.address
});
})
},
4 years ago
loadInfo(cb) {
var that = this;
this.util.request({
api: '/api/mobile/visit/introduce',
utilSuccess: function(res) {
res.latitude = parseFloat(res.latitude);
res.longitude = parseFloat(res.longitude);
2 years ago
that.info = res;
that.covers = []
4 years ago
that.covers.push({
latitude: res.latitude,
longitude: res.longitude,
2 years ago
width: 30,
height: 30,
4 years ago
iconPath: '/static/img/location.png'
});
cb(res);
},
utilFail: function(res) {
4 years ago
4 years ago
}
})
},
4 years ago
}
}
</script>
<style>
4 years ago
</style>