|
@ -17,8 +17,8 @@ const tabs = [ |
|
|
{ name: '应急避难场所', tab: 'yjbns', className: 'emergency_button' }, |
|
|
{ name: '应急避难场所', tab: 'yjbns', className: 'emergency_button' }, |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
function Map (props) { |
|
|
function Map(props) { |
|
|
const { dispatch, actions, emergencyList, propTab,setLongitudeLatitude } = props; |
|
|
const { dispatch, actions, emergencyList, propTab, setLongitudeLatitude } = props; |
|
|
const [delay, setDelay] = useState(true) |
|
|
const [delay, setDelay] = useState(true) |
|
|
const [tab, setTab] = useState('xfyjwz') |
|
|
const [tab, setTab] = useState('xfyjwz') |
|
|
const [visible, setVisible] = useState(false) |
|
|
const [visible, setVisible] = useState(false) |
|
@ -231,7 +231,7 @@ function Map (props) { |
|
|
// driving.clear() //清除路线
|
|
|
// driving.clear() //清除路线
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function drawRoute (route) { |
|
|
function drawRoute(route) { |
|
|
var path = parseRouteToPath(route) |
|
|
var path = parseRouteToPath(route) |
|
|
|
|
|
|
|
|
var routeLine = new AMap.Polyline({ |
|
|
var routeLine = new AMap.Polyline({ |
|
@ -256,13 +256,13 @@ function Map (props) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//计算两点距离
|
|
|
//计算两点距离
|
|
|
function computeDis (p1, p2) { |
|
|
function computeDis(p1, p2) { |
|
|
return Math.round(p1.distance(p2)); |
|
|
return Math.round(p1.distance(p2)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 解析DrivingRoute对象,构造成AMap.Polyline的path参数需要的格式
|
|
|
// 解析DrivingRoute对象,构造成AMap.Polyline的path参数需要的格式
|
|
|
// DrivingResult对象结构参考文档 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DriveRoute
|
|
|
// DrivingResult对象结构参考文档 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DriveRoute
|
|
|
function parseRouteToPath (route) { |
|
|
function parseRouteToPath(route) { |
|
|
var path = [] |
|
|
var path = [] |
|
|
for (var i = 0, l = route.steps.length; i < l; i++) { |
|
|
for (var i = 0, l = route.steps.length; i < l; i++) { |
|
|
var step = route.steps[i] |
|
|
var step = route.steps[i] |
|
@ -300,24 +300,25 @@ function Map (props) { |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div className='alarm_confirm'> |
|
|
{ |
|
|
<div className='hande_button' |
|
|
propTab == 'overview' && <div className='alarm_confirm'> |
|
|
onClick={() => { |
|
|
<div className='hande_button' |
|
|
map.clearInfoWindow(); |
|
|
onClick={() => { |
|
|
if (emergencyList['xfjy']?.length > 0) { |
|
|
map.clearInfoWindow(); |
|
|
const list = emergencyList['xfjy'].sort((b, a) => computeDis( |
|
|
if (emergencyList['xfjy']?.length > 0) { |
|
|
new AMap.LngLat(x.longitude, x.latitude), |
|
|
const list = emergencyList['xfjy'].sort((b, a) => computeDis( |
|
|
new AMap.LngLat(b.location?.split(',')[0], b.location?.split(',')[1]) |
|
|
new AMap.LngLat(x.longitude, x.latitude), |
|
|
) - computeDis( |
|
|
new AMap.LngLat(b.location?.split(',')[0], b.location?.split(',')[1]) |
|
|
new AMap.LngLat(x.longitude, x.latitude), |
|
|
) - computeDis( |
|
|
new AMap.LngLat(a.location?.split(',')[0], a.location?.split(',')[1]) |
|
|
new AMap.LngLat(x.longitude, x.latitude), |
|
|
)) |
|
|
new AMap.LngLat(a.location?.split(',')[0], a.location?.split(',')[1]) |
|
|
const location = list[0]?.location |
|
|
)) |
|
|
drawDrivings([x.longitude, x.latitude], location.split(','), x, list[0]) |
|
|
const location = list[0]?.location |
|
|
} |
|
|
drawDrivings([x.longitude, x.latitude], location.split(','), x, list[0]) |
|
|
}} |
|
|
} |
|
|
>一键护航</div> |
|
|
}} |
|
|
</div> |
|
|
>一键护航</div> |
|
|
|
|
|
</div>} |
|
|
</div>, |
|
|
</div>, |
|
|
document.getElementById(`alarmcontentid${x.location}`)); |
|
|
document.getElementById(`alarmcontentid${x.location}`)); |
|
|
} |
|
|
} |
|
|