diff --git a/src/components/map/mapUtil.ts b/src/components/map/mapUtil.ts
index 554cc07..f9bfca3 100644
--- a/src/components/map/mapUtil.ts
+++ b/src/components/map/mapUtil.ts
@@ -1,3 +1,6 @@
+import makers from "../../static/map-maker.png";
+import makers1 from "../../static/map-maker (1).png";
+import makers2 from "../../static/map-maker (2).png";
interface makersInf {
userIdentity: string,
marker: any
@@ -10,15 +13,37 @@ class MapUtl {
static addMaker(data: any) {
const { lng, lat, title, users } = data;
+ let mk,dep = "";
+ if(users?.militia_type===1){
+ mk = makers
+ dep = "民兵"
+ }
+ if(users?.grid_user===1){
+ mk = makers1
+ dep = "网格员"
+ }
+ if(users?.patrol_user===1){
+ mk = makers2
+ dep = "巡防大队"
+ }
+
// if (MapUtl.loadMap === null) return;
const marker = new MapUtl.loadMap.Marker({
position: new MapUtl.loadMap.LngLat(lng, lat),
title: title,
+ icon: new MapUtl.loadMap.Icon({
+ imageSize: [20, 20],
+ image: mk,
+ style: {
+ backgroundImage:"red"
+ }// 默认的样式名
+ }),
});
var content = [
"
姓名 :" + users?.user_name + "",
"职位 : " + users.pos_held,
"电话 : " + users.tel,
+ "部门 : " + dep,
"
",
];
var infoWindow = new MapUtl.loadMap.InfoWindow({
diff --git a/src/pages/home/homeBottom/dispath.tsx b/src/pages/home/homeBottom/dispath.tsx
index 8841025..8662ff1 100644
--- a/src/pages/home/homeBottom/dispath.tsx
+++ b/src/pages/home/homeBottom/dispath.tsx
@@ -21,7 +21,7 @@ import MinusCircleOutlined from "@ant-design/icons/lib/icons/MinusCircleOutlined
const { Option } = Select;
const Dispath = (props: Store) => {
- const { trainingStore, trainingCatStore } = props;
+ const { trainingStore, trainingCatStore,homeStore } = props;
const formRef = React.useRef(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [projectConfig, setProjectConfig] = useState([]);
@@ -97,7 +97,10 @@ const Dispath = (props: Store) => {
count: Number(values.count),
};
data.task_video = task_videos;
- trainingStore.add(data);
+ trainingStore.add(data).then(()=>{
+ homeStore.getNewTask()
+ });
+
setIsModalOpen(false);
};
const handleSearch = (newValue: string) => {
@@ -253,4 +256,4 @@ const Dispath = (props: Store) => {
>
);
};
-export default inject("trainingStore", "trainingCatStore")(observer(Dispath));
+export default inject("trainingStore", "trainingCatStore","homeStore")(observer(Dispath));
diff --git a/src/pages/home/homeBottom/emr.tsx b/src/pages/home/homeBottom/emr.tsx
index afdc05a..a98bc98 100644
--- a/src/pages/home/homeBottom/emr.tsx
+++ b/src/pages/home/homeBottom/emr.tsx
@@ -44,9 +44,11 @@ const Emr = (props: Store) => {
});
}
data.task_video = task_video;
- emergencyStore.add(data);
+ emergencyStore.add(data).then(()=>{
+ homeStore.getNewTask()
+ });
setIsModalOpen(false);
- homeStore.getNewTask();
+
};
const handleSearch = (newValue: string) => {
if (newValue === "") return;
diff --git a/src/pages/home/homeLeft/orgin.tsx b/src/pages/home/homeLeft/orgin.tsx
index 43c6603..b907454 100644
--- a/src/pages/home/homeLeft/orgin.tsx
+++ b/src/pages/home/homeLeft/orgin.tsx
@@ -6,14 +6,31 @@ import { Modal } from "antd";
import { Store } from "antd/es/form/interface";
import { inject, observer } from "mobx-react";
import { useEffect, useState } from "react";
+import MapUtl from "@/components/map/mapUtil";
const Orgin = (props: Store) => {
const { homeStore } = props;
const [isModalOpen, setIsModalOpen] = useState(false);
const [isSelf, setIsSelf] = useState(false);
-
+ const getRaud = (m: number,n:number) => {
+ var num = Math.floor(Math.random()*(m - n) + n);
+ return num
+ };
useEffect(() => {
homeStore.getOgCount();
homeStore.getVideoUrlList();
+ homeStore.getContact().then((res)=>{
+ let list = res.data.record;
+ list.forEach(element => {
+ let lng = "103.8"+getRaud(2000,12000)
+ let lat = "30.5"+getRaud(1000,12000)
+ MapUtl.addMaker({
+ lng:lng,
+ lat:lat,
+ title:element.user_name,
+ users:element
+ })
+ });
+ })
}, [homeStore]);
const showModal = () => {
setIsModalOpen(true);
diff --git a/src/pages/home/home_video.tsx b/src/pages/home/home_video.tsx
index 62a9548..c32bc73 100644
--- a/src/pages/home/home_video.tsx
+++ b/src/pages/home/home_video.tsx
@@ -15,7 +15,6 @@ const HomeVideo = (props: Store) => {
}, [homeStore]);
return (
-
隐藏
{homeStore.showVideo ? (
{
player?.autoplay(videoJsOptions?.autoplay);
player.src(videoJsOptions?.sources);
}
- console.log(videoJsOptions.sources)
return () => {
if (playerRef.current) {
playerRef.current.dispose();
diff --git a/src/static/map-maker (1).png b/src/static/map-maker (1).png
new file mode 100644
index 0000000..428f7fb
Binary files /dev/null and b/src/static/map-maker (1).png differ
diff --git a/src/static/map-maker (2).png b/src/static/map-maker (2).png
new file mode 100644
index 0000000..ff36446
Binary files /dev/null and b/src/static/map-maker (2).png differ
diff --git a/src/static/map-maker.png b/src/static/map-maker.png
new file mode 100644
index 0000000..7a310b0
Binary files /dev/null and b/src/static/map-maker.png differ
diff --git a/src/store/home.ts b/src/store/home.ts
index e1ae6b5..5b8f175 100644
--- a/src/store/home.ts
+++ b/src/store/home.ts
@@ -13,6 +13,8 @@ class HomeConfig {
static mm: string = "/v1/public/mm"
static rm: string = "/v1/public/rm"
static ae: string = "/v1/public/ae"
+ static con: string = "/v1/user/mapMakerUser"
+
static newTask: string = "/v1/user/newTask"
static taskulist: string = "/v1/public/taskInUser"
static deviceList: string = "/api/v1/devicesconfig" //设备列表
@@ -54,6 +56,10 @@ class HomeStore extends BaseStore {
async getAe() {
return await baseHttp.get(HomeConfig.ae, {});
}
+ // 获取联系人
+ async getContact() {
+ return await baseHttp.get(HomeConfig.con, {});
+ }
// 获取视频推流连接
async getVideoUrlList() {
diff --git a/src/store/user.ts b/src/store/user.ts
index d1c5af8..3a90250 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -5,7 +5,7 @@ import BaseStore from "./baseStore";
import { UserDataType, UserInfos } from "@/model/userModel";
import { message } from "antd";
class UserConfig {
- static LOGINURI: string = "/v1/anth/login"
+ static LOGINURI: string = "/v1/anth/login/pc"
static LIST: string = "/v1/user/list"
static ADD: string = "/v1/user"
static DELETE: string = "/v1/user"