From a40ba543c8c5dc08669e3a37059ba39bf1ce284c Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sun, 09 May 2021 12:50:49 +0800
Subject: [PATCH] 小程序地图
---
public/xcxh5map/map.html | 36 ++++++++++++++++++++++++++----------
1 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/public/xcxh5map/map.html b/public/xcxh5map/map.html
index 671da15..3afa9b5 100644
--- a/public/xcxh5map/map.html
+++ b/public/xcxh5map/map.html
@@ -7,9 +7,11 @@
<link rel="stylesheet" href="./leaflet.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="./leaflet.js"></script>
- <script src="./moni.js"></script>
+ <!-- <script src="./moni.js"></script> -->
+ <script src="./getUrlData.js"></script>
<link rel="stylesheet" href="./MarkerCluster.css" />
<link rel="stylesheet" href="./MarkerCluster.Default.css" />
+ <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script src="./leaflet.markercluster-src.js"></script>
<title>map</title>
<style type="text/css">
@@ -29,9 +31,12 @@
<body>
<div id="map"></div>
+ <script>
+ var map = null,
+ getdata = null;
+ </script>
<script type="text/javascript">
- var map = null;
- function beginJuheMap(map) {
+ function beginJuheMap(map, data) {
map = L.map('map', { //初始化地图
center: [31.87, 120.54],
zoom: 12,
@@ -63,9 +68,9 @@
busIcon = new transportIcon({
iconUrl: './img/red.png'
});
- console.log(datalist, 43545343)
- for (var i = 0; i < datalist.length; i++) {
- var a = datalist[i];
+ console.log(data, 43545343)
+ for (var i = 0; i < data.length; i++) {
+ var a = data[i];
var title = a.title;
if (a.state == 0) {
var marker = L.marker([a.jd, a.wd], {
@@ -88,13 +93,24 @@
}
map.addLayer(markers);
- markers.on('click', function (a) {
- console.log(a.layer, 11111111111);
- });
+ // markers.on('click', function (a) {
+ // console.log(a.layer, 11111111111);
+ // });
}
- beginJuheMap(map);
</script>
+ <script>
+ window.onload = () => {
+ getdata = JSON.parse(decodeURI(getQueryVariable('data')));
+ // var dataListUrl = window.location.href;
+ // decodeURI(dataListUrl);
+ console.log(getdata)
+ beginJuheMap(map, getdata);
+ wx.miniProgram.getEnv(function (res) {
+ console.log(res.miniprogram) // true
+ })
+ }
+ </script>
</body>
</html>
\ No newline at end of file
--
Gitblit v1.9.3