Commit 928ff08c by 前端

修复bug

1 parent 2eff3920
......@@ -153,6 +153,7 @@ export default {
trackList: [], // 历史poi点
poiInfoWindow: null, // 当前的弹框
markerList: {}, // poi点标记列表
showMapText: false, //是否地图展示道路、标题
};
},
mounted() {
......@@ -164,20 +165,14 @@ export default {
// 地图初始化
initMap() {
let _this = this;
let plugins = [
"AMap.LngLat",
"AMap.AutoComplete",
"AMap.MassMarks",
"AMap.Geocoder",
];
let plugins = ["AMap.LngLat", "AMap.MassMarks", "AMap.Geocoder"];
_this.$mapInit({ plugins: plugins }).then((AMap) => {
_this.mapLoading = false;
window.AMap = AMap;
_this.map = mapService.init("map", {
zoom: 15,
viewMode: "3D",
showIndoorMap: false,
showLabel: true,
showLabel: false,
});
_this.bindSearch();
_this.initMapEvent();
......@@ -346,7 +341,7 @@ export default {
// 绑定搜索
bindSearch() {
const _this = this;
AMap.plugin("AMap.AutoComplete", function () {
let autoComplete = new AMap.AutoComplete({
input: "poiMapSearch",
});
......@@ -360,6 +355,7 @@ export default {
_this.addPoiMarker(_params, "search");
});
});
},
// 返回列表页面
......@@ -483,6 +479,7 @@ export default {
_this.getInfo();
}
_this.trackList = res.data || [];
_this.showRoadTitle();
}
});
},
......@@ -501,7 +498,7 @@ export default {
_obj.lng = arr[0];
_obj.lat = arr[1];
}
console.log(_obj)
console.log(_obj);
_this.addPoiMarker(_obj, "", true);
});
},
......@@ -533,6 +530,13 @@ export default {
}, 1000);
}
},
// 展示隐藏地图标题
showRoadTitle() {
let _road = new AMap.TileLayer.RoadNet();
let _title = new AMap.TileLayer();
this.map.add([_title]);
},
},
};
</script>
......
......@@ -779,7 +779,7 @@ export default {
let _config = { version: "1.4.2" };
_config.AMapUI = {
version: "1.1",
plugins: ["ui/misc/PathSimplifier"],
plugins: ["/misc/PathSimplifier"],
};
_this.$mapInit(_config).then((AMap) => {
......
......@@ -237,11 +237,12 @@ export default {
"AMap.MassMarks",
"AMap.MarkerCluster",
"AMap.Bounds",
"AMap.MouseTool"
]);
_this.$mapInit({ plugins: plugins }).then((AMap) => {
_this.mapLoading = false;
window.AMap = AMap;
_this.map = mapService.init("map", { zoom: 11 });
_this.map = mapService.init("map", { zoom: 11, showLabel: false });
_this.mouseTool = new AMap.MouseTool(_this.map);
var autoComplete = new AMap.AutoComplete({
input: "tipInput",
......@@ -259,6 +260,9 @@ export default {
if (_query.type == "full" && _query.leftLngLat) {
this.initPage(_query);
}
// 给地图添加文字图层
_this.map.add([new AMap.TileLayer()]);
});
},
......
......@@ -3,13 +3,13 @@ import { CONSTANT } from "@/constant";
export const mapInit = params => {
return new Promise((resolve,reject) => {
let options = params || {};
let plugins = options.plugins|| CONSTANT.MAP_PLUGINS;
let version = options.version || '2.0';
// let plugins = options.plugins|| CONSTANT.MAP_PLUGINS;
// let version = options.version || '2.0';
if(window.AMap){
resolve(window.AMap)
return false;
}
let mapConfig ={};
let mapConfig ={...options};
mapConfig.key = CONSTANT.MAP_KEY; // 申请好的Web端开发者Key,首次调用 load 时必填
mapConfig.version = options.version || '2.0';; // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
mapConfig.plugins = options.plugins|| CONSTANT.MAP_PLUGINS;// 需要使用的的插件列表,如比例尺'AMap.Scale'等
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!