功能优化

This commit is contained in:
hayu 2024-12-12 20:50:51 +08:00
parent 7509262765
commit 211e864671
2 changed files with 14 additions and 12 deletions

View File

@ -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>

View File

@ -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