fix(amap):core

This commit is contained in:
wang_yp 2024-10-16 00:48:26 +08:00
parent 9b9a3a7f9e
commit fd954a753a
4 changed files with 32 additions and 8 deletions

View File

@ -4,11 +4,11 @@ import { Store } from "antd/es/form/interface";
import { ColumnsType } from "antd/lib/table";
import { inject, observer } from "mobx-react";
import { useEffect, useState } from "react";
interface EmUser {
interface EmUserInterface {
emergencyStore?: Store;
id?: string;
}
const EmUser = (props: EmUser) => {
const EmUser = (props: EmUserInterface) => {
const { emergencyStore, id } = props;
const [ulist, setUlist] = useState<number | null>(0);
@ -22,9 +22,14 @@ const EmUser = (props: EmUser) => {
{ title: "民兵名称", dataIndex: "user_name" },
{ title: "民兵描述", dataIndex: "remark" },
{ title: "民兵账号", dataIndex: "account" },
{ title: "是否接收任务", dataIndex: "is_accept",render(value, record, index) {
return value ? "是" : "否";
}, },
{
title: "是否接收任务",
dataIndex: "acce_status",
render(value, record, index) {
return value ? "是" : "否";
}
},
{ title: "拒绝原因", dataIndex: "reject" },
];
return (
<>

View File

@ -42,9 +42,9 @@ const Emergency = (props: Store) => {
{ title: "任务描述", dataIndex: "desc" },
{
title: "完成状态",
dataIndex: "status",
dataIndex: "accomplish",
render: (status) =>
status === 0 ? (
status === 1 ? (
<span style={{ color: "black" }}></span>
) : (
<span style={{ color: "green" }}></span>

View File

@ -3,6 +3,7 @@ import { action, makeObservable, observable } from "mobx";
import baseHttp from "@/service/base";
import BaseStore from "./baseStore";
import { TagDataType } from "@/model/userModel";
import MapUtl from "@/components/map/mapUtil";
class HomeConfig {
static os: string = "public/os"
@ -12,6 +13,7 @@ class HomeConfig {
static rm: string = "public/rm"
static ae: string = "public/ae"
static newTask: string = "user/newTask"
static taskulist: string = "public/taskInUser"
}
class HomeStore extends BaseStore<TagDataType> {
constructor() {
@ -21,7 +23,9 @@ class HomeStore extends BaseStore<TagDataType> {
ogMap: observable,
alist: observable,
showVideo: observable,
ulist: observable,
showVideoHandler: action,
getTaskUserList: action,
})
}
@ -48,15 +52,30 @@ class HomeStore extends BaseStore<TagDataType> {
async getNewTask() {
let res = await baseHttp.get(HomeConfig.newTask, {});
if (res.data?.record) {
this.getTaskUserList()
this.showVideoHandler(true)
}
}
async getTaskUserList() {
let res = await baseHttp.get(HomeConfig.taskulist, {});
if (res.data?.record?.ulist && res.data?.record.ulist.length > 0) {
res.data?.record?.ulist.forEach(element => {
MapUtl.addMaker({
lng: element.long,
lat: element.lat,
title: element.user_name,
users: element
})
});
}
}
showVideoHandler(status) {
this.showVideo = status
}
ogMap!: Object;
showVideo!: boolean;
alist!: Array<any>;
ulist!: Array<any>;
}
const homeStore = new HomeStore()
export default homeStore;

View File

@ -61,7 +61,7 @@ export type AutoReconnectOptions = boolean | {
}
}
public hert(){
this.times = setTimeout(() => this.send({"type":"heartbeat"}), 3000)
this.times = setInterval(() => this.send({"type":"heartbeat"}), 3000)
}
private shouldReconnect(): boolean {
if (typeof this.autoReconnect === 'boolean') {