|
|
@ -8,6 +8,7 @@ import ajax from "@/services"; |
|
|
|
import "./index.scss"; |
|
|
|
import { compileString } from "sass"; |
|
|
|
import Rerm from "./blue-point.png"; |
|
|
|
import { constant } from "lodash"; |
|
|
|
let timer = null; |
|
|
|
function SelectGaodeLngLat(props) { |
|
|
|
const { |
|
|
@ -65,9 +66,9 @@ function SelectGaodeLngLat(props) { |
|
|
|
setLnglat([add.lng, add.lat]); |
|
|
|
getLntLat([add.lng, add.lat]); |
|
|
|
}; |
|
|
|
function getLocationMessage() { |
|
|
|
function getLocationMessage(v) { |
|
|
|
// const lat_lng = lnglat.reverse().join(","); |
|
|
|
const lat_lng = lnglat.join(","); |
|
|
|
const lat_lng = v ? v.join(",") : lnglat.join(","); |
|
|
|
ajax.getLocationNameByLngLat({ lat_lng }).then((res) => { |
|
|
|
if (res.status === 20000) { |
|
|
|
setAddress(res.data.address); |
|
|
@ -79,7 +80,9 @@ function SelectGaodeLngLat(props) { |
|
|
|
useEffect(() => { |
|
|
|
onChange(address); |
|
|
|
}, [address]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
getLocationMessage(lnglat) |
|
|
|
}, [lnglat]); |
|
|
|
return ( |
|
|
|
<div className="SelectLnglat"> |
|
|
|
<Button |
|
|
@ -199,6 +202,7 @@ function ModalMap(props) { |
|
|
|
// onClick(info) |
|
|
|
setLnglat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); |
|
|
|
getLntLat([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]); |
|
|
|
//addMarker([e.lnglat.lng.toFixed(4), e.lnglat.lat.toFixed(4)]) |
|
|
|
}) |
|
|
|
mapRef.current = map |
|
|
|
}; |
|
|
@ -211,7 +215,7 @@ function ModalMap(props) { |
|
|
|
<img src='${Rerm}' /> |
|
|
|
</div>`; |
|
|
|
const addMarker = (data) => { |
|
|
|
if(data.length==0) return |
|
|
|
if (data.length == 0) return |
|
|
|
if (Marker) { |
|
|
|
map.remove(Marker); |
|
|
|
} |
|
|
|