地图插件更新

pull/3/head
liujun 2023-12-11 17:15:23 +08:00
parent 782eb04212
commit fbcb460ad1
26 changed files with 88 additions and 31 deletions

File diff suppressed because one or more lines are too long

60
hybrid/html/newMap.html Normal file
View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=e8a16137fd226a62a23cc7ba5c9c78ce" type="text/javascript">
</script>
<script src="./js/uni.webview.1.5.4.js"></script>
<body onLoad="onLoad()">
<div id="mapDiv" style="position:absolute;width:100vw; height:100vh"></div>
</body>
<style>
* {
margin: 0;
padding: 0;
}
</style>
<script>
var map;
var zoom = 14;
function getUrlParam(name) {
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
const r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURI(r[2]);
return "";
}
function onLoad() {
map = new T.Map('mapDiv');
var imageURL = "http://t0.tianditu.gov.cn/img_w/wmts?" +
"SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
"&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=e8a16137fd226a62a23cc7ba5c9c78ce";
lay = new T.TileLayer(imageURL, {minZoom: 1, maxZoom: 18});
var config = {layers: [lay]};
map = new T.Map("mapDiv", config);
map.centerAndZoom(new T.LngLat(getUrlParam('longitude'), getUrlParam('latitude')), zoom);
map.enableScrollWheelZoom();
addMapClick()
}
function addMapClick() {
map.addEventListener("click", MapClick);
}
function MapClick(event) {
var marker = new T.Marker(new T.LngLat(event.lnglat.getLng(), event.lnglat.getLat()));
map.clearOverLays();
map.addOverLay(marker);
console.log(event.lnglat.getLng(), event.lnglat.getLat());
uni.postMessage({
data: {
"longitue": event.lnglat.getLng(),
"latitude": event.lnglat.getLat(),
}
})
}
</script>
</html>

View File

@ -331,6 +331,10 @@
"path" : "pages/map/map", "path" : "pages/map/map",
"style" : {} "style" : {}
}, },
{
"path" : "pages/map/mapPro",
"style" : {}
},
{ {
"path": "pages/application/high-risk-work/home", "path": "pages/application/high-risk-work/home",
"style": {} "style": {}

View File

@ -312,7 +312,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -315,7 +315,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -315,7 +315,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -263,7 +263,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -265,7 +265,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -290,7 +290,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1598,7 +1598,7 @@
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1161,7 +1161,7 @@
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1426,7 +1426,7 @@ export default {
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function(e) { acceptDataFromOpenedPage: function(e) {

View File

@ -1286,7 +1286,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1220,7 +1220,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1212,7 +1212,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1305,7 +1305,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1190,7 +1190,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -530,7 +530,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -897,17 +897,12 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {
// console.log(e.data)
// console.info(e.data.longitue)
_this.$set( _this.pd, 'WORK_LONGITUDE', e.data.longitue ) _this.$set( _this.pd, 'WORK_LONGITUDE', e.data.longitue )
_this.$set( _this.pd, 'WORK_LATITUDE', e.data.latitude ) _this.$set( _this.pd, 'WORK_LATITUDE', e.data.latitude )
// _this.pd.WORK_LONGITUDE = e.data.longitue;
// _this.pd.WORK_LATITUDE = e.data.latitude;
// console.info(_this.pd)
} }
}, },
}) })

View File

@ -994,15 +994,12 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {
// console.log(e.data)
// console.info(e.data.longitue)
_this.pd.WORK_LONGITUDE = e.data.longitue; _this.pd.WORK_LONGITUDE = e.data.longitue;
_this.pd.WORK_LATITUDE = e.data.latitude; _this.pd.WORK_LATITUDE = e.data.latitude;
// console.info(_this.pd)
} }
}, },
}) })

View File

@ -716,7 +716,7 @@ export default {
chooseLocation() { chooseLocation() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -742,7 +742,7 @@ export default {
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -1158,7 +1158,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function(e) { acceptDataFromOpenedPage: function(e) {

View File

@ -1409,7 +1409,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function(e) { acceptDataFromOpenedPage: function(e) {

View File

@ -1240,7 +1240,7 @@ export default {
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {

View File

@ -212,7 +212,7 @@
showMapModal() { showMapModal() {
var _this = this var _this = this
uni.navigateTo({ uni.navigateTo({
url: '/pages/map/map', url: '/pages/map/mapPro',
events: { events: {
// //
acceptDataFromOpenedPage: function (e) { acceptDataFromOpenedPage: function (e) {