first commit

This commit is contained in:
wang_yp 2024-12-02 16:03:04 +08:00
parent cf98c949cd
commit bf61fd7815
11 changed files with 60 additions and 9 deletions

View File

@ -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 { interface makersInf {
userIdentity: string, userIdentity: string,
marker: any marker: any
@ -10,15 +13,37 @@ class MapUtl {
static addMaker(data: any) { static addMaker(data: any) {
const { lng, lat, title, users } = data; 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; // if (MapUtl.loadMap === null) return;
const marker = new MapUtl.loadMap.Marker({ const marker = new MapUtl.loadMap.Marker({
position: new MapUtl.loadMap.LngLat(lng, lat), position: new MapUtl.loadMap.LngLat(lng, lat),
title: title, title: title,
icon: new MapUtl.loadMap.Icon({
imageSize: [20, 20],
image: mk,
style: {
backgroundImage:"red"
}// 默认的样式名
}),
}); });
var content = [ var content = [
"<div><b>姓名 :" + users?.user_name + "</b>", "<div><b>姓名 :" + users?.user_name + "</b>",
"职位 : " + users.pos_held, "职位 : " + users.pos_held,
"电话 : " + users.tel, "电话 : " + users.tel,
"部门 : " + dep,
"</div>", "</div>",
]; ];
var infoWindow = new MapUtl.loadMap.InfoWindow({ var infoWindow = new MapUtl.loadMap.InfoWindow({

View File

@ -21,7 +21,7 @@ import MinusCircleOutlined from "@ant-design/icons/lib/icons/MinusCircleOutlined
const { Option } = Select; const { Option } = Select;
const Dispath = (props: Store) => { const Dispath = (props: Store) => {
const { trainingStore, trainingCatStore } = props; const { trainingStore, trainingCatStore,homeStore } = props;
const formRef = React.useRef<FormInstance>(null); const formRef = React.useRef<FormInstance>(null);
const [isModalOpen, setIsModalOpen] = useState<boolean>(false); const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const [projectConfig, setProjectConfig] = useState<any>([]); const [projectConfig, setProjectConfig] = useState<any>([]);
@ -97,7 +97,10 @@ const Dispath = (props: Store) => {
count: Number(values.count), count: Number(values.count),
}; };
data.task_video = task_videos; data.task_video = task_videos;
trainingStore.add(data); trainingStore.add(data).then(()=>{
homeStore.getNewTask()
});
setIsModalOpen(false); setIsModalOpen(false);
}; };
const handleSearch = (newValue: string) => { 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));

View File

@ -44,9 +44,11 @@ const Emr = (props: Store) => {
}); });
} }
data.task_video = task_video; data.task_video = task_video;
emergencyStore.add(data); emergencyStore.add(data).then(()=>{
homeStore.getNewTask()
});
setIsModalOpen(false); setIsModalOpen(false);
homeStore.getNewTask();
}; };
const handleSearch = (newValue: string) => { const handleSearch = (newValue: string) => {
if (newValue === "") return; if (newValue === "") return;

View File

@ -6,14 +6,31 @@ import { Modal } from "antd";
import { Store } from "antd/es/form/interface"; import { Store } from "antd/es/form/interface";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import MapUtl from "@/components/map/mapUtil";
const Orgin = (props: Store) => { const Orgin = (props: Store) => {
const { homeStore } = props; const { homeStore } = props;
const [isModalOpen, setIsModalOpen] = useState<boolean>(false); const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const [isSelf, setIsSelf] = useState<boolean>(false); const [isSelf, setIsSelf] = useState<boolean>(false);
const getRaud = (m: number,n:number) => {
var num = Math.floor(Math.random()*(m - n) + n);
return num
};
useEffect(() => { useEffect(() => {
homeStore.getOgCount(); homeStore.getOgCount();
homeStore.getVideoUrlList(); 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]); }, [homeStore]);
const showModal = () => { const showModal = () => {
setIsModalOpen(true); setIsModalOpen(true);

View File

@ -15,7 +15,6 @@ const HomeVideo = (props: Store) => {
}, [homeStore]); }, [homeStore]);
return ( return (
<div> <div>
<span style={{ color: "#fff" }}></span>
{homeStore.showVideo ? ( {homeStore.showVideo ? (
<div <div
className="homeVideoBox" className="homeVideoBox"

View File

@ -39,7 +39,6 @@ const Videos = (props: Store) => {
player?.autoplay(videoJsOptions?.autoplay); player?.autoplay(videoJsOptions?.autoplay);
player.src(videoJsOptions?.sources); player.src(videoJsOptions?.sources);
} }
console.log(videoJsOptions.sources)
return () => { return () => {
if (playerRef.current) { if (playerRef.current) {
playerRef.current.dispose(); playerRef.current.dispose();

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
src/static/map-maker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -13,6 +13,8 @@ class HomeConfig {
static mm: string = "/v1/public/mm" static mm: string = "/v1/public/mm"
static rm: string = "/v1/public/rm" static rm: string = "/v1/public/rm"
static ae: string = "/v1/public/ae" static ae: string = "/v1/public/ae"
static con: string = "/v1/user/mapMakerUser"
static newTask: string = "/v1/user/newTask" static newTask: string = "/v1/user/newTask"
static taskulist: string = "/v1/public/taskInUser" static taskulist: string = "/v1/public/taskInUser"
static deviceList: string = "/api/v1/devicesconfig" //设备列表 static deviceList: string = "/api/v1/devicesconfig" //设备列表
@ -54,6 +56,10 @@ class HomeStore extends BaseStore<TagDataType> {
async getAe() { async getAe() {
return await baseHttp.get(HomeConfig.ae, {}); return await baseHttp.get(HomeConfig.ae, {});
} }
// 获取联系人
async getContact() {
return await baseHttp.get(HomeConfig.con, {});
}
// 获取视频推流连接 // 获取视频推流连接
async getVideoUrlList() { async getVideoUrlList() {

View File

@ -5,7 +5,7 @@ import BaseStore from "./baseStore";
import { UserDataType, UserInfos } from "@/model/userModel"; import { UserDataType, UserInfos } from "@/model/userModel";
import { message } from "antd"; import { message } from "antd";
class UserConfig { class UserConfig {
static LOGINURI: string = "/v1/anth/login" static LOGINURI: string = "/v1/anth/login/pc"
static LIST: string = "/v1/user/list" static LIST: string = "/v1/user/list"
static ADD: string = "/v1/user" static ADD: string = "/v1/user"
static DELETE: string = "/v1/user" static DELETE: string = "/v1/user"