first commit

This commit is contained in:
wang_yp 2024-12-04 02:54:51 +08:00
parent ed062c2c4c
commit 15c6892955
4 changed files with 36 additions and 7 deletions

View File

@ -65,5 +65,5 @@ export default function MapContainer() {
amap.setFitView();
};
return <div id="container" style={{ height: "100vh" }}></div>;
return <div id="container" style={{ height: "100vh",width:"100%" }}></div>;
}

View File

@ -1,9 +1,11 @@
import MapContainer from "@/components/map/MapComponent";
import MapUtl from "@/components/map/mapUtil";
import { Button, Modal } from "antd";
import { Button, message, Modal } from "antd";
import { inject, observer } from "mobx-react";
import { useState } from "react";
const Move = () => {
const Move = (props) => {
const { usrStore, id } = props;
const [isOpen, setOpen] = useState<boolean>(false);
return (
<>
@ -18,11 +20,13 @@ const Move = () => {
</Button>
<Modal
title={"轨迹回放"}
width={1200}
width={"80%"}
open={isOpen}
centered
okText="确定"
cancelText="取消"
footer={null}
destroyOnClose={true}
onCancel={() => {
setOpen(false);
}}
@ -32,7 +36,21 @@ const Move = () => {
type="dashed"
size="small"
onClick={() => {
MapUtl.polyline([[116.478935,39.997761],[116.478939,39.997825],[116.478912,39.998549],[116.478912,39.998549],[116.478998,39.998555],[116.478998,39.998555],[116.479282,39.99856],[116.479658,39.998528],[116.480151,39.998453],[116.480784,39.998302],[116.480784,39.998302],[116.481149,39.998184],[116.481573,39.997997],[116.481863,39.997846],[116.482072,39.997718],[116.482362,39.997718],[116.483633,39.998935],[116.48367,39.998968],[116.484648,39.999861]])
usrStore.getSite(id).then((res) => {
let data: any = [];
if (res.data && res.data.record) {
res.data.record.forEach((element) => {
data.push([element.long, element.lat]);
});
if (data.length === 0) {
message.info("暂无轨迹数据");
return;
}
if (data.length > 0) {
MapUtl.polyline(data);
}
}
});
}}
>
@ -44,4 +62,6 @@ const Move = () => {
</>
);
};
export default Move;
// getSite
export default inject("usrStore")(observer(Move));

View File

@ -113,7 +113,7 @@ const User = (props: Store) => {
>
</Button>
<Move />
<Move id={record.identity}/>
<Button
type="dashed"
danger

View File

@ -16,6 +16,8 @@ class UserConfig {
static serch: string = "/v1/user/serch"
static getPatrol: string = "/v1/user/getPatrol"
static videoLogin: string = "api/v1/login"
static siteList: string = "/v1/user/site"
}
@ -36,6 +38,7 @@ class UserStore extends BaseStore<UserDataType> {
setPoverDe: action,
setUserDetaul: action,
getPatrol: action,
getSite: action,
_userinfo: observable,
isNeedLogin: observable,
poverDetail: observable,
@ -60,6 +63,12 @@ class UserStore extends BaseStore<UserDataType> {
return await baseHttp.get(UserConfig.getPatrol, {})
}
async getSite(id) {
return await baseHttp.get(UserConfig.siteList + "/" + id, {})
}
get userInfo(): UserInfos {
if (!this._userinfo.token) {
let token = window.localStorage.getItem("token")