提交 d1600848 作者: 18928357778

添-首页-地图-自适应显示所有点位

上级 fd6533f6
...@@ -95,6 +95,8 @@ export default function MapComponent() { ...@@ -95,6 +95,8 @@ export default function MapComponent() {
}); });
if(markerList.length) MAP?.add(markerList);setMarkerCol([...markerList]); if(markerList.length) MAP?.add(markerList);setMarkerCol([...markerList]);
} }
//自适应显示多个点位
MAP?.setFitView();
} }
const showFlyerBitmap = async (index:number,data?:UserInfoType,pageSize?:number) => { const showFlyerBitmap = async (index:number,data?:UserInfoType,pageSize?:number) => {
const res = await api.listFlyerBitmap({ const res = await api.listFlyerBitmap({
...@@ -112,6 +114,8 @@ export default function MapComponent() { ...@@ -112,6 +114,8 @@ export default function MapComponent() {
}); });
if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList) if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList)
} }
//自适应显示多个点位
MAP?.setFitView();
} }
const showUavBitmap = async (index:number,data?:UserInfoType) => { const showUavBitmap = async (index:number,data?:UserInfoType) => {
const res = await api.listUavBitmap({ const res = await api.listUavBitmap({
...@@ -129,11 +133,12 @@ export default function MapComponent() { ...@@ -129,11 +133,12 @@ export default function MapComponent() {
}); });
if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList) if(markerList.length) MAP?.add(markerList);setMarkerCol(markerList)
} }
//自适应显示多个点位
MAP?.setFitView();
} }
//添加点位 //添加点位
const mapEntiy = async (index: number,data?:UserInfoType) => { const mapEntiy = async (index: number,data?:UserInfoType) => {
MAP?.remove(markerCol); MAP?.remove(markerCol);
if (index === 0) { if (index === 0) {
showPositioningInfo(index,data) showPositioningInfo(index,data)
}else if (index === 1) { }else if (index === 1) {
......
...@@ -102,6 +102,8 @@ export default function MoreServicePoints() { ...@@ -102,6 +102,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList); if (markerList.length) MAP?.add(markerList);
setMarkerCol([...markerList]); setMarkerCol([...markerList]);
} }
//自适应显示多个点位
MAP?.setFitView();
}; };
const showFlyerBitmap = async ( const showFlyerBitmap = async (
index: number, index: number,
...@@ -125,6 +127,8 @@ export default function MoreServicePoints() { ...@@ -125,6 +127,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList); if (markerList.length) MAP?.add(markerList);
setMarkerCol(markerList); setMarkerCol(markerList);
} }
//自适应显示多个点位
MAP?.setFitView();
}; };
const showUavBitmap = async (index: number, data?: UserInfoType) => { const showUavBitmap = async (index: number, data?: UserInfoType) => {
const res = await api.listUavBitmap({ const res = await api.listUavBitmap({
...@@ -144,6 +148,8 @@ export default function MoreServicePoints() { ...@@ -144,6 +148,8 @@ export default function MoreServicePoints() {
if (markerList.length) MAP?.add(markerList); if (markerList.length) MAP?.add(markerList);
setMarkerCol(markerList); setMarkerCol(markerList);
} }
//自适应显示多个点位
MAP?.setFitView();
}; };
//添加点位 //添加点位
const mapEntiy = async (index: number, data?: UserInfoType) => { const mapEntiy = async (index: number, data?: UserInfoType) => {
...@@ -180,9 +186,14 @@ export default function MoreServicePoints() { ...@@ -180,9 +186,14 @@ export default function MoreServicePoints() {
return marker; return marker;
}; };
const moveTo = (item: any) => { const moveTo = (item: any,index:number) => {
console.log(markerCol); // const p = markerCol[index].getPosition()
// var infoWindow = new Amap.InfoWindow({
// position: p,
// offset: new Amap.Pixel(20, -10),
// content: item.dizhi
// });
// infoWindow.open(MAP);
if (item.dizhi) { if (item.dizhi) {
return MAP?.setCenter([item.jd, item.wd]); return MAP?.setCenter([item.jd, item.wd]);
} else if (item.flyerName || item.uavName) { } else if (item.flyerName || item.uavName) {
...@@ -231,10 +242,10 @@ export default function MoreServicePoints() { ...@@ -231,10 +242,10 @@ export default function MoreServicePoints() {
<div className="left"> <div className="left">
<div className="left-title">服务网点</div> <div className="left-title">服务网点</div>
<div className="left-content"> <div className="left-content">
{servicePoints.map((item: any) => ( {servicePoints.map((item: any,index:number) => (
<div <div
key={item.id} key={item.id}
onClick={() => moveTo(item)} onClick={() => moveTo(item,index)}
className="left-content-item" className="left-content-item"
title={item.dizhi || item.flyerName || item.uavName} title={item.dizhi || item.flyerName || item.uavName}
> >
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论