功能优化
This commit is contained in:
parent
7509262765
commit
211e864671
|
|
@ -7,12 +7,14 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= webpackConfig.name %></title>
|
||||
<script src="<%= BASE_URL %>/static/map/map_load.js" type="text/javascript"></script>
|
||||
<!-- <script src="<%= BASE_URL %>/static/map/map_load.js" type="text/javascript"></script>-->
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<!-- <script async src="https://api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<!-- <script src="https://api.map.baidu.com/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<!-- <script type="text/javascript" src="https://api.map.baidu.com/library/TrackAnimation/src/TrackAnimation_min.js"></script>-->
|
||||
<!-- <script async src="http://10.1.0.142:2000/mybaidu/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<script async src="http://10.1.0.142:2000/api.map.baidu.com/api?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<script src="http://10.1.0.142:2000/api.map.baidu.com/getscript?v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||||
<!-- http://192.168.1.100/api.map.baidu.com/getscript?v=2.0&ak=你的key&services=&t=20170104214439-->
|
||||
<!-- <script src="http://10.1.0.142:2000/mybaidu/api?type=webgl&v=2.0&ak=cClgLBaLgGUdQDilX9dGvieL"></script>-->
|
||||
<!-- <script type="text/javascript" src="http://10.1.0.142:2000/mybaidu/library/TrackAnimation/src/TrackAnimation_min.js"></script>-->
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -538,15 +538,15 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
//在线地图 new BMapGL
|
||||
//离线地图 new window.BMap
|
||||
this_.map = new window.BMap.Map('map-container'); // 创建地图实例
|
||||
this_.map = new BMapGL.Map('map-container'); // 创建地图实例
|
||||
let point;
|
||||
if (this_.form.lon != null && this_.form.lon !== '' && this_.form.lat != null && this_.form.lat !== '') {
|
||||
console.log(this_.form.lat, this_.form.lon);
|
||||
point = new window.BMap.Point(this_.form.lon, this_.form.lat);
|
||||
let marker = new window.BMap.Marker(point); // 创建标点
|
||||
point = new BMapGL.Point(this_.form.lon, this_.form.lat);
|
||||
let marker = new BMapGL.Marker(point); // 创建标点
|
||||
this_.map.addOverlay(marker);
|
||||
} else {
|
||||
point = new window.BMap.Point(117.13805, 31.8734); // 创建点坐标
|
||||
point = new BMapGL.Point(117.13805, 31.8734); // 创建点坐标
|
||||
}
|
||||
|
||||
this_.map.centerAndZoom(point, 14); // 初始化地图,设置中心点坐标和地图级别
|
||||
|
|
@ -560,7 +560,7 @@ export default {
|
|||
this_.map.disablePinchToZoom(); // 禁用多点触控缩放
|
||||
this_.map.disableKeyboard(); // 禁用键盘操作
|
||||
|
||||
var geoc = new window.BMap.Geocoder();
|
||||
var geoc = new BMapGL.Geocoder();
|
||||
|
||||
this_.map.addEventListener('click', function (e) {
|
||||
var pt = e.latlng;
|
||||
|
|
@ -571,8 +571,8 @@ export default {
|
|||
this_.form.lat = e.latlng.lat;
|
||||
});
|
||||
this_.map.clearOverlays();
|
||||
point = new window.BMap.Point(e.latlng.lng, e.latlng.lat);
|
||||
let marker = new window.BMap.Marker(point); // 创建标点
|
||||
point = new BMapGL.Point(e.latlng.lng, e.latlng.lat);
|
||||
let marker = new BMapGL.Marker(point); // 创建标点
|
||||
this_.map.addOverlay(marker);
|
||||
});
|
||||
});
|
||||
|
|
@ -581,7 +581,7 @@ export default {
|
|||
onSearchAddress() {
|
||||
|
||||
// 创建地址
|
||||
const myGeo = new window.BMap.Geocoder()
|
||||
const myGeo = new BMapGL.Geocoder()
|
||||
const _this = this
|
||||
myGeo.getPoint(
|
||||
this.searchAddress,
|
||||
|
|
@ -592,13 +592,13 @@ export default {
|
|||
|
||||
_this.map.centerAndZoom(point, 16)
|
||||
_this.map.addOverlay(
|
||||
new window.BMap.Marker(point, {
|
||||
new BMapGL.Marker(point, {
|
||||
title: _this.searchAddress,
|
||||
}),
|
||||
)
|
||||
// 根据坐标得到地址描述
|
||||
myGeo.getLocation(
|
||||
new window.BMap.Point(lng, lat),
|
||||
new BMapGL.Point(lng, lat),
|
||||
function (result) {
|
||||
if (result) {
|
||||
let addComp = result.addressComponents
|
||||
|
|
|
|||
Loading…
Reference in New Issue