|
@@ -33,6 +33,7 @@ window._AMapSecurityConfig = {
|
|
|
};
|
|
};
|
|
|
const radius = 2500 //圆半径
|
|
const radius = 2500 //圆半径
|
|
|
var map
|
|
var map
|
|
|
|
|
+var mapCircle
|
|
|
var AMapOut
|
|
var AMapOut
|
|
|
var infoWindow
|
|
var infoWindow
|
|
|
var placeSearch = ''
|
|
var placeSearch = ''
|
|
@@ -55,7 +56,8 @@ export default {
|
|
|
latitude: 22.5436,
|
|
latitude: 22.5436,
|
|
|
longitude: 114.057999,
|
|
longitude: 114.057999,
|
|
|
institutionList: [], //获取的机构
|
|
institutionList: [], //获取的机构
|
|
|
- markers:[]
|
|
|
|
|
|
|
+ markers:[],
|
|
|
|
|
+ addMarkersList:[]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -63,11 +65,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
window.jumpDetailTap=(id)=>{
|
|
window.jumpDetailTap=(id)=>{
|
|
|
|
|
+
|
|
|
console.log('跳转到详情页:'+id);
|
|
console.log('跳转到详情页:'+id);
|
|
|
|
|
+ // console.log( idTwo)
|
|
|
|
|
+ // let id = idOne+idTwo
|
|
|
this.$router.push({path:'/detail',query:{institutionsId:id}})
|
|
this.$router.push({path:'/detail',query:{institutionsId:id}})
|
|
|
}
|
|
}
|
|
|
this.getInstitutional()
|
|
this.getInstitutional()
|
|
|
- // this.getInstitutions_search()
|
|
|
|
|
|
|
+ this.getInstitutions_search()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
async getInstitutional() {
|
|
async getInstitutional() {
|
|
@@ -76,11 +81,12 @@ export default {
|
|
|
this.categorieList = institutionalData.data
|
|
this.categorieList = institutionalData.data
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- async getInstitutions_search(naturesType) {
|
|
|
|
|
- console.log('tab点击2:'+naturesType)
|
|
|
|
|
|
|
+ async getInstitutions_search() {
|
|
|
|
|
+ console.log('tab点击2:')
|
|
|
|
|
+ this.removeMarkers()
|
|
|
var institutionSearch = await institutions_search({
|
|
var institutionSearch = await institutions_search({
|
|
|
"radius": radius,
|
|
"radius": radius,
|
|
|
- "institutionalTypeList": naturesType,
|
|
|
|
|
|
|
+ "institutionalTypeList": this.categoryId,
|
|
|
"lat": this.latitude,
|
|
"lat": this.latitude,
|
|
|
"lng": this.longitude
|
|
"lng": this.longitude
|
|
|
})
|
|
})
|
|
@@ -96,34 +102,53 @@ export default {
|
|
|
this.addMarkers();
|
|
this.addMarkers();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ removeMarkers:function() {
|
|
|
|
|
+ if(this.addMarkersList.length>0) {
|
|
|
|
|
+ map.clearInfoWindow()
|
|
|
|
|
+ map.remove(this.addMarkersList)
|
|
|
|
|
+ this.markers = []
|
|
|
|
|
+ this.addMarkersList = []
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
addMarkers() {
|
|
addMarkers() {
|
|
|
- this.markers.forEach((item, index) => {
|
|
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ that.markers.forEach((item, index) => {
|
|
|
let markerContent = '' +
|
|
let markerContent = '' +
|
|
|
'<div class="custom-content-marker">' +
|
|
'<div class="custom-content-marker">' +
|
|
|
' <img :src="item.iconPath" />' +
|
|
' <img :src="item.iconPath" />' +
|
|
|
'</div>';
|
|
'</div>';
|
|
|
- var marker = new AMapOut.Marker({
|
|
|
|
|
|
|
+ let marker = new AMapOut.Marker({
|
|
|
position: new AMapOut.LngLat(item.longitude,item.latitude),
|
|
position: new AMapOut.LngLat(item.longitude,item.latitude),
|
|
|
// content:markerContent,
|
|
// content:markerContent,
|
|
|
offset: new AMapOut.Pixel(0, 0),
|
|
offset: new AMapOut.Pixel(0, 0),
|
|
|
icon: item.iconPath, // 添加 Icon 图标 URL
|
|
icon: item.iconPath, // 添加 Icon 图标 URL
|
|
|
- title: item.id
|
|
|
|
|
|
|
+ title: item.id,
|
|
|
|
|
+ extData:item.id
|
|
|
});
|
|
});
|
|
|
marker.on('click', markerTap);
|
|
marker.on('click', markerTap);
|
|
|
- function markerTap(e) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ function markerTap(e) {
|
|
|
console.log('markerTap:')
|
|
console.log('markerTap:')
|
|
|
console.log(e)
|
|
console.log(e)
|
|
|
|
|
+ console.log( marker.getExtData())
|
|
|
|
|
+ console.log( item.id)
|
|
|
// var positionInfo = map.getPosition()
|
|
// var positionInfo = map.getPosition()
|
|
|
// console.log('positionInfo:')
|
|
// console.log('positionInfo:')
|
|
|
// console.log(positionInfo)
|
|
// console.log(positionInfo)
|
|
|
// 在地图上打开信息窗体
|
|
// 在地图上打开信息窗体
|
|
|
|
|
+ let subIdOne =item.id.substring(0,item.id.length-6)
|
|
|
|
|
+ let subIdTwo =item.id.substring(item.id.length-6)
|
|
|
|
|
+ console.log(subIdOne + ':' +subIdTwo)
|
|
|
|
|
+
|
|
|
|
|
+ let idTemp = item.id
|
|
|
var windowContent =
|
|
var windowContent =
|
|
|
- '<div class="customCallout" onclick="jumpDetailTap('+ `${item.id}`+')">' +
|
|
|
|
|
|
|
+ '<div class="customCallout" onclick="jumpDetailTap('+ `${idTemp}`+')">' +
|
|
|
'<div class="customCallout_top">' +
|
|
'<div class="customCallout_top">' +
|
|
|
'<img class="icon" src=' + `${item.coverImgUrl}` + ' />' +
|
|
'<img class="icon" src=' + `${item.coverImgUrl}` + ' />' +
|
|
|
'<div class="callout-right">' +
|
|
'<div class="callout-right">' +
|
|
|
'<div class="title">' +
|
|
'<div class="title">' +
|
|
|
- `${item.name}` +
|
|
|
|
|
|
|
+ `${item.name}` +`${idTemp}`+
|
|
|
'</div>'+
|
|
'</div>'+
|
|
|
'<div class="name">' +
|
|
'<div class="name">' +
|
|
|
`${item.contact}` + `${item.phone}` +
|
|
`${item.contact}` + `${item.phone}` +
|
|
@@ -143,11 +168,13 @@ export default {
|
|
|
// });
|
|
// });
|
|
|
|
|
|
|
|
infoWindow.open(map, [e.lnglat.lng,e.lnglat.lat]);
|
|
infoWindow.open(map, [e.lnglat.lng,e.lnglat.lat]);
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ that.addMarkersList.push(marker)
|
|
|
map.add(marker)
|
|
map.add(marker)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
formatData(e, index) {
|
|
formatData(e, index) {
|
|
|
var mapIcon = this.getMapIcon(e.institutionalTypeId)
|
|
var mapIcon = this.getMapIcon(e.institutionalTypeId)
|
|
|
return {
|
|
return {
|
|
@@ -231,6 +258,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
async mapInit(){
|
|
async mapInit(){
|
|
|
|
|
+ let that = this;
|
|
|
AMapOut = await AMapLoader.load({
|
|
AMapOut = await AMapLoader.load({
|
|
|
"key": "017ac002b4b1a16ec87b2182b17bbed9", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
"key": "017ac002b4b1a16ec87b2182b17bbed9", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
"version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
"version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
@@ -238,12 +266,12 @@ export default {
|
|
|
})
|
|
})
|
|
|
map =new AMapOut.Map('container_home', {
|
|
map =new AMapOut.Map('container_home', {
|
|
|
// center: [117.743109, 36.862989],
|
|
// center: [117.743109, 36.862989],
|
|
|
- center: [114.057999, 22.5436],
|
|
|
|
|
- zoom: 11,
|
|
|
|
|
|
|
+ center: [that.longitude,that.latitude],
|
|
|
|
|
+ zoom: 13,
|
|
|
resizeEnable : true
|
|
resizeEnable : true
|
|
|
});
|
|
});
|
|
|
- var circle = new AMapOut.Circle({
|
|
|
|
|
- center: new AMapOut.LngLat("114.057999", "22.5436"), // 圆心位置
|
|
|
|
|
|
|
+ mapCircle = new AMapOut.Circle({
|
|
|
|
|
+ center: new AMapOut.LngLat(that.longitude,that.latitude), // 圆心位置
|
|
|
radius: radius, //半径
|
|
radius: radius, //半径
|
|
|
strokeColor: "#fff", //线颜色
|
|
strokeColor: "#fff", //线颜色
|
|
|
strokeOpacity: 1, //线透明度
|
|
strokeOpacity: 1, //线透明度
|
|
@@ -251,7 +279,7 @@ export default {
|
|
|
fillColor: '#3B82F670',
|
|
fillColor: '#3B82F670',
|
|
|
fillOpacity: 0.35 //填充透明度
|
|
fillOpacity: 0.35 //填充透明度
|
|
|
});
|
|
});
|
|
|
- map.add(circle);
|
|
|
|
|
|
|
+ map.add(mapCircle);
|
|
|
|
|
|
|
|
var autoOptions = {
|
|
var autoOptions = {
|
|
|
city: "邹平",
|
|
city: "邹平",
|
|
@@ -259,7 +287,15 @@ export default {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var autocomplete =new AMapOut.AutoComplete(autoOptions);
|
|
var autocomplete =new AMapOut.AutoComplete(autoOptions);
|
|
|
-
|
|
|
|
|
|
|
+ autocomplete.on("select", function selectAddress(e) {
|
|
|
|
|
+ that.latitude = e.poi.location.lat
|
|
|
|
|
+ that.longitude = e.poi.location.lng
|
|
|
|
|
+ map.setCenter([that.longitude,that.latitude],true,500)
|
|
|
|
|
+ mapCircle.setCenter(new AMapOut.LngLat(that.longitude,that.latitude))
|
|
|
|
|
+ that.removeMarkers();
|
|
|
|
|
+ that.getInstitutions_search()
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// var windowContent =
|
|
// var windowContent =
|
|
|
// '<div class="custom-content-window">' +
|
|
// '<div class="custom-content-window">' +
|
|
|
// '测试跳转跳转调准大幅度' +
|
|
// '测试跳转跳转调准大幅度' +
|