humiao 2023-09-28 09:37:15 +08:00
commit e48d0643a4
3 changed files with 59 additions and 2 deletions

View File

@ -23,8 +23,9 @@ VUE_APP_BASE_IMG_URL = http://123.132.248.154:9231
VUE_APP_WEBSOCKET_URL = ws://123.132.248.154:9225/ws
#VUE_APP_BASE_API = http://221.2.83.254:7001/api
#VUE_APP_BASE_IMG_URL = http://221.2.83.254:7001
#VUE_APP_BASE_API = https://fx.hopetrytech.com:7001/api
#VUE_APP_BASE_IMG_URL = https://fx.hopetrytech.com:7001
#VUE_APP_WEBSOCKET_URL = ws://221.2.83.254:9002/ws
#VUE_APP_BASE_API = http://123.132.248.154:9224/api

View File

@ -0,0 +1,52 @@
const currentUsers = []
export function handlerData(newUsers){
// 判断是否是第一次传入
if(currentUsers.length == 0){
currentUsers = newUsers;
}
// 添加数据
for(let i=0;i<newUsers.length;i++){
let obj = currentUsers.find((item,index)=>{
return item.createId == newUsers[i].createId;
})
if(!obj){
currentUsers.push(newUsers[i]);
}
}
// 更新和删除数据
for(let i=0;i<currentUsers.length;i++){
for(let j=0;j<newUsers.length;j++){
// 如果在新数据中有则更新数据
if(currentUsers[i].createId == newUsers[j].createId){
currentUsers[i] = newUsers[j];
}else{ // 如果在新数据中没有则删除数据
currentUsers.slice(j,1);
}
}
}
return currentUsers;
}
export function updateGraphic(graphicLayer,currentUsers){
// graphicLayer.eachGraphic((graphic) => {
// let obj = currentUsers.find((item,index)=>{
// return item.createId == graphic
// })
// if (graphic.isPrivate) {
// return
// }
// graphic.addDynamicPosition(position, time) // 按time秒运动至指定位置
// })
}

View File

@ -26,6 +26,7 @@ import AppConfig from '../../../../public/config/app.json'
import { parse } from '../lib/handleGeojson.js';
import * as turf from '@turf/turf'
import { isJson } from "../../../utils/index";
import { handlerData } from "../lib/userSport";
export default {
name: 'monitorbox',
@ -156,6 +157,9 @@ export default {
res.data.forEach(item =>{
this.pointData.push(item)
})
// let currentUsers = handlerData(this.pointData);
// console.log("currentUsers",currentUsers);
this.addLayerPoint()
console.log('this.markGraphicLayerArr',this.markGraphicLayerArr)
})