Browse Source

fix():bug修改

tags/PMS_V1.0.0_Alpha5
xingjx 1 year ago
parent
commit
6e2c1017b1
  1. 10
      src/components/SelectGaodeLngLat/index.jsx

10
src/components/SelectGaodeLngLat/index.jsx

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

Loading…
Cancel
Save