qa-prevention-xgf-app/pages/map/index.vue

53 lines
1.1 KiB
Vue
Raw Permalink Normal View History

2024-06-27 17:49:52 +08:00
<template>
<web-view :src="url" @message="fnMessage"></web-view>
2024-06-27 17:49:52 +08:00
</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('acceptLocationData', {
data: event.detail.data[0]
});
uni.navigateBack();
},
}
}
2024-06-27 17:49:52 +08:00
</script>
<style>
</style>