$(document).ready(function () { $('.save').click(function () { let array = []; let committee = {type: 1, phone: $('#committee').val(), cmptId: getCmptId()}; let aid = {type: 2, phone: $('#aid').val(), cmptId: getCmptId()}; array.push(committee); array.push(aid); $.ajax({ url: '/gk/contact/save', data: JSON.stringify(array), contentType: "application/json", type: 'post', success: function (data) { if (data.status) { layer.msg('更新成功', {icon: 1, time: 1500}); } } }) }); var map = { mapContainer: 'map', instance: null, initMap: function () { console.log(map.mapContainer) var satelliteTile = L.tileLayer('https://mt0.google.cn/vt/lyrs=y&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}&s=Galil&scale=2', { id: 'satelliteTile', maxZoom: 20 }); var terrainTile = L.tileLayer('https://mt0.google.cn/vt/lyrs=p&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}&s=Galil&scale=2', { id: 'terrainTile', maxZoom: 20 }); var googleTile = L.tileLayer('https://mt0.google.cn/vt/lyrs=m&hl=zh-CN&gl=CN&x={x}&y={y}&z={z}&s=Galil&scale=2', { id: 'googleTile', maxZoom: 20 }); map.instance = L.map(map.mapContainer, { fullscreenControl: true, // OR fullscreenControl: { pseudoFullscreen: false // if true, fullscreen to page width and height }, zoomControl: false, layers: [satelliteTile] }).setView([39.90923, 116.397428], 4); var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 18}); //map.instance.addLayer(osm); var baseLayers = { "谷歌卫星": satelliteTile, "谷歌地形": terrainTile, "谷歌默认": googleTile }; //地图类型 L.control.layers(baseLayers, null, {position: 'topleft'}).addTo(map.instance); L.control.scale({position: 'topleft', imperial: false}).addTo(map.instance); } } map.initMap(); })