Commit f5782dde authored by baixian's avatar baixian

选点优化

parent e8c3d503
...@@ -84,38 +84,44 @@ class SelectPlaceMap extends React.Component { ...@@ -84,38 +84,44 @@ class SelectPlaceMap extends React.Component {
that.infoArray.forEach((ele) => { that.infoArray.forEach((ele) => {
ele.setMap(null); ele.setMap(null);
}); });
console.log(res, 'res');
showLatlng = new qq.maps.LatLng(res.result.location.lat, res.result.location.lng); showLatlng = new qq.maps.LatLng(res.result.location.lat, res.result.location.lng);
const title = res.result.address_component.province + res.result.address_component.city + res.result.formatted_addresses.rough; let title = '';
dispatch({ if (res.result.address_component.province) {
type: 'schooladd/updateState', title = res.result.address_component.province + res.result.address_component.city + res.result.formatted_addresses.rough;
payload: { dispatch({
longitude: res.result.location.lng, type: 'schooladd/updateState',
latitude: res.result.location.lat, payload: {
locationAddress: title, longitude: res.result.location.lng,
province: res.result.address_component.province, latitude: res.result.location.lat,
city: res.result.address_component.city, locationAddress: title,
district: res.result.address_component.district, province: res.result.address_component.province,
}, city: res.result.address_component.city,
}); district: res.result.address_component.district,
},
});
}
// message.success('已将该地址导入为机构地址,不要忘记保存哦', 2); // message.success('已将该地址导入为机构地址,不要忘记保存哦', 2);
const pointMarker = new qq.maps.Marker({ const pointMarker = new qq.maps.Marker({
position: showLatlng, position: showLatlng,
map: that.map, map: that.map,
}); });
const info = new qq.maps.InfoWindow({ if (title != '') {
map: that.map, const info = new qq.maps.InfoWindow({
content: title, map: that.map,
position: showLatlng, content: title || '',
zIndex: 99, position: showLatlng,
visible: true, zIndex: 99,
}); visible: true,
qq.maps.event.addListener(pointMarker, 'click', () => { });
info.open(); qq.maps.event.addListener(pointMarker, 'click', () => {
info.setContent(title); info.open();
info.setPosition(showLatlng); info.setContent(title);
}); info.setPosition(showLatlng);
});
that.infoArray.push(info);
}
that.pointArray.push(pointMarker); that.pointArray.push(pointMarker);
that.infoArray.push(info);
that.setState({ that.setState({
locationList: [], locationList: [],
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment