fix(check)
This commit is contained in:
parent
50264ec154
commit
b418311a81
|
@ -93,7 +93,7 @@
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
"test": "node scripts/test.js"
|
"test": "node scripts/test.js"
|
||||||
},
|
},
|
||||||
"proxy":"http://127.0.0.1:12214",
|
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"react-app",
|
"react-app",
|
||||||
|
|
38
src/App.tsx
38
src/App.tsx
|
@ -1,43 +1,5 @@
|
||||||
import { Outlet } from "react-router";
|
import { Outlet } from "react-router";
|
||||||
import MapUtl from "./components/map/mapUtil";
|
|
||||||
import SocketService from "./util/socket";
|
|
||||||
const socketService = SocketService.getInstance();
|
|
||||||
const onMessage = (e: any) => {
|
|
||||||
let data = JSON.parse(e);
|
|
||||||
if (data.type === "accpt") {
|
|
||||||
let maker: any = null;
|
|
||||||
let body = JSON.parse(data.content.body);
|
|
||||||
MapUtl.makerList?.forEach((e) => {
|
|
||||||
if (e.userIdentity === body?.user.user_identity) {
|
|
||||||
maker = e.marker;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (maker) {
|
|
||||||
maker?.setPosition([body.address.long, body.address.lat]);
|
|
||||||
} else {
|
|
||||||
MapUtl.addMaker({
|
|
||||||
lng: body.address.long ?? 103.872802,
|
|
||||||
lat: body.address.lat ?? 30.523876,
|
|
||||||
title: body?.user.user_name,
|
|
||||||
users: body.user,
|
|
||||||
clicks:(v)=>{
|
|
||||||
console.log(v)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (data.type === "move") {
|
|
||||||
let maker: any = null;
|
|
||||||
let body = JSON.parse(data.content.body);
|
|
||||||
MapUtl.makerList?.forEach((e) => {
|
|
||||||
if (e.userIdentity === body?.user_identity) {
|
|
||||||
maker = e.marker;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
maker?.setPosition([body.long, body.lat]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
socketService.on("message", onMessage);
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -5,9 +5,10 @@ import { Store } from "antd/es/form/interface";
|
||||||
import MapUtl from "@/components/map/mapUtil";
|
import MapUtl from "@/components/map/mapUtil";
|
||||||
import MapContainerTow from "@/components/map/MapComponentTow";
|
import MapContainerTow from "@/components/map/MapComponentTow";
|
||||||
import MapUtlTow from "@/components/map/mapUtilTow";
|
import MapUtlTow from "@/components/map/mapUtilTow";
|
||||||
|
import SocketService from "@/util/socket";
|
||||||
|
const socketService = SocketService.getInstance();
|
||||||
const HomeCheck = (props: Store) => {
|
const HomeCheck = (props: Store) => {
|
||||||
const { homeStore ,usrStore} = props;
|
const { homeStore, usrStore } = props;
|
||||||
const [size, changeSize] = useState("1");
|
const [size, changeSize] = useState("1");
|
||||||
const [id, setId] = useState("");
|
const [id, setId] = useState("");
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
|
@ -22,8 +23,57 @@ const HomeCheck = (props: Store) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getUlist("1");
|
getUlist("1");
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
socketService.on("message", onMessage);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
const onMessage = (e: any) => {
|
||||||
|
let data = JSON.parse(e);
|
||||||
|
if (data.type === "accpt") {
|
||||||
|
let maker: any = null;
|
||||||
|
let body = JSON.parse(data.content.body);
|
||||||
|
MapUtl.makerList?.forEach((e) => {
|
||||||
|
if (e.userIdentity === body?.user.identity) {
|
||||||
|
maker = e.marker;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (maker) {
|
||||||
|
maker?.setPosition([body.address.long, body.address.lat]);
|
||||||
|
} else {
|
||||||
|
MapUtl.addMaker({
|
||||||
|
lng: body.address.long ,
|
||||||
|
lat: body.address.lat,
|
||||||
|
title: body?.user.user_name,
|
||||||
|
users: body.user,
|
||||||
|
clicks: (v) => {
|
||||||
|
setId(v);
|
||||||
|
setOpen(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (data.type === "move") {
|
||||||
|
let maker: any = null;
|
||||||
|
let body = JSON.parse(data.content.body);
|
||||||
|
MapUtl.makerList?.forEach((e) => {
|
||||||
|
if (e.userIdentity === body?.user?.identity) {
|
||||||
|
maker = e.marker;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!maker) {
|
||||||
|
MapUtl.addMaker({
|
||||||
|
lng: body.address?.long,
|
||||||
|
lat: body.address?.lat,
|
||||||
|
title: body?.user?.user_name,
|
||||||
|
users: body.user,
|
||||||
|
clicks: (v) => {
|
||||||
|
setId(v);
|
||||||
|
setOpen(true);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
maker?.setPosition([body.address.long, body.address.lat]);
|
||||||
|
}
|
||||||
|
};
|
||||||
const serchSD = () => {
|
const serchSD = () => {
|
||||||
if (times.length === 0) {
|
if (times.length === 0) {
|
||||||
message.error("请选择时间区间");
|
message.error("请选择时间区间");
|
||||||
|
@ -81,8 +131,8 @@ const HomeCheck = (props: Store) => {
|
||||||
title: element.user_name,
|
title: element.user_name,
|
||||||
users: element,
|
users: element,
|
||||||
clicks: (v) => {
|
clicks: (v) => {
|
||||||
setId(v)
|
setId(v);
|
||||||
setOpen(true)
|
setOpen(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -90,10 +140,37 @@ const HomeCheck = (props: Store) => {
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Radio.Group value={size} onChange={handleSizeChange} >
|
<Radio.Group value={size} onChange={handleSizeChange}>
|
||||||
<Radio.Button style={{backgroundColor:"rgba(15,86,147, 0.4)",border:"0px",color:"#fff"}} value="1">民兵</Radio.Button>
|
<Radio.Button
|
||||||
<Radio.Button style={{backgroundColor:"rgba(15,86,187, 0.4)",border:"0px",color:"#fff"}} value="2">网格员</Radio.Button>
|
style={{
|
||||||
<Radio.Button style={{backgroundColor:"rgba(15,86,147, 0.4)",border:"0px",color:"#fff"}} value="3">巡防</Radio.Button>
|
backgroundColor: "rgba(15,86,147, 0.4)",
|
||||||
|
border: "0px",
|
||||||
|
color: "#fff",
|
||||||
|
}}
|
||||||
|
value="1"
|
||||||
|
>
|
||||||
|
民兵
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button
|
||||||
|
style={{
|
||||||
|
backgroundColor: "rgba(15,86,187, 0.4)",
|
||||||
|
border: "0px",
|
||||||
|
color: "#fff",
|
||||||
|
}}
|
||||||
|
value="2"
|
||||||
|
>
|
||||||
|
网格员
|
||||||
|
</Radio.Button>
|
||||||
|
<Radio.Button
|
||||||
|
style={{
|
||||||
|
backgroundColor: "rgba(15,86,147, 0.4)",
|
||||||
|
border: "0px",
|
||||||
|
color: "#fff",
|
||||||
|
}}
|
||||||
|
value="3"
|
||||||
|
>
|
||||||
|
巡防
|
||||||
|
</Radio.Button>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
<Modal
|
<Modal
|
||||||
title={"轨迹回放"}
|
title={"轨迹回放"}
|
||||||
|
@ -134,4 +211,4 @@ const HomeCheck = (props: Store) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// export default HomeBottom;
|
// export default HomeBottom;
|
||||||
export default inject("homeStore","usrStore")(observer(HomeCheck));
|
export default inject("homeStore", "usrStore")(observer(HomeCheck));
|
||||||
|
|
|
@ -144,7 +144,6 @@ class HomeStore extends BaseStore<TagDataType> {
|
||||||
}
|
}
|
||||||
// this.getTaskUserList()
|
// this.getTaskUserList()
|
||||||
this.showVideoHandler(true)
|
this.showVideoHandler(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
return urls;
|
return urls;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue