qa-regulatory-gwj-app/pages/map/map.vue

53 lines
1.1 KiB
Vue
Raw Normal View History

2023-11-07 10:08:37 +08:00
<template>
<web-view :src="url" @message="fnMessage"></web-view>
2023-11-07 10:08:37 +08:00
</template>
<script>
import gcoord from '@/common/gcoord.js'
2023-11-07 10:08:37 +08:00
export default {
data() {
return {
url: '',
longitude: '',
latitude: ''
2023-11-07 10:08:37 +08:00
}
},
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: "获取位置失败",
});
}
});
2023-11-07 10:08:37 +08:00
},
methods: {
fnInitMapUrl() {
this.url = ('https://skqhdg.porthebei.com:9004/map/map.html?longitude=' + this.longitude + '&latitude=' + this.latitude + 't=' +
new Date().getTime());
2023-11-07 10:08:37 +08:00
},
fnMessage(event) {
const eventChannel = this.getOpenerEventChannel();
2024-10-10 10:14:31 +08:00
eventChannel.emit('acceptDataFromOpenedPage', {
data: event.detail.data[0]
});
2023-11-07 10:08:37 +08:00
uni.navigateBack();
},
2023-11-07 10:08:37 +08:00
}
}
</script>
<style>
2023-11-07 10:08:37 +08:00
</style>