53 lines
1.1 KiB
Vue
53 lines
1.1 KiB
Vue
<template>
|
|
<web-view :src="url" @message="fnMessage"></web-view>
|
|
</template>
|
|
|
|
<script>
|
|
import gcoord from '@/common/gcoord.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
url: '',
|
|
longitude: '',
|
|
latitude: ''
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
uni.getLocation({
|
|
type: 'GCJ02',
|
|
success: (res) => {
|
|
var result = gcoord.transform(
|
|
[res.longitude, res.latitude],
|
|
gcoord.GCJ02,
|
|
gcoord.BD09
|
|
);
|
|
this.longitude = result[0]
|
|
this.latitude = result[1]
|
|
this.fnInitMapUrl();
|
|
},
|
|
fail: () => {
|
|
uni.showToast({
|
|
title: "获取位置失败",
|
|
});
|
|
}
|
|
});
|
|
},
|
|
methods: {
|
|
fnInitMapUrl() {
|
|
this.url = ('https://skqhdg.porthebei.com:9004/map/map.html?longitude=' + this.longitude + '&latitude=' + this.latitude + 't=' +
|
|
new Date().getTime());
|
|
},
|
|
fnMessage(event) {
|
|
const eventChannel = this.getOpenerEventChannel();
|
|
eventChannel.emit('acceptDataFromOpenedPage', {
|
|
data: event.detail.data[0]
|
|
});
|
|
uni.navigateBack();
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|