diff --git a/src/assets/images/error-img-new.png b/src/assets/images/error-img-new.png new file mode 100644 index 0000000..b00cb93 Binary files /dev/null and b/src/assets/images/error-img-new.png differ diff --git a/src/components/SelectGaodeLngLat/blue-point.png b/src/components/SelectGaodeLngLat/blue-point.png new file mode 100644 index 0000000..ee86a76 Binary files /dev/null and b/src/components/SelectGaodeLngLat/blue-point.png differ diff --git a/src/components/SelectGaodeLngLat/index.jsx b/src/components/SelectGaodeLngLat/index.jsx index 7f1b24b..69eaa1e 100644 --- a/src/components/SelectGaodeLngLat/index.jsx +++ b/src/components/SelectGaodeLngLat/index.jsx @@ -6,7 +6,9 @@ import "leaflet/dist/leaflet.css"; import "leaflet.chinatmsproviders"; 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 { @@ -17,6 +19,7 @@ function SelectGaodeLngLat(props) { onChange = () => { }, } = props; const [lnglat, setLnglat] = useState([]); + const [marker, setMarker] = useState([]); const [address, setAddress] = useState(""); const [searchLnglatValue, setSearchLnglatValue] = useState([]); const [getLngLabel, setGetLngLabel] = useState([]) @@ -59,12 +62,13 @@ function SelectGaodeLngLat(props) { let add = getLngLabel.filter((ele) => ele.value == data)[0] || []; console.log(add); // setSearchLnglatValue([ add.lng,add.lat]) + setMarker([add.lng, add.lat]) 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); @@ -76,7 +80,9 @@ function SelectGaodeLngLat(props) { useEffect(() => { onChange(address); }, [address]); - + useEffect(() => { + getLocationMessage(lnglat) + }, [lnglat]); return (