内网开发

This commit is contained in:
2023-11-09 11:12:08 +08:00
parent 336bcc662b
commit 75000d846b
34 changed files with 2153 additions and 283 deletions

View File

@@ -1,9 +1,7 @@
VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver' VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver'
VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d' VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d'
VUE_APP_API="http://work.ii999.live:19002/znzq" VUE_APP_API="http://work.ii999.live:19002/znzq"
VUE_APP_STATIC_FILE_Prefix='//119.45.242.222/static_file'
VUE_APP_STATIC_FILE_Prefix='https://119.45.242.222/static_file/'
VUE_APP_SRS_URL='webrtc://119.45.242.222/' VUE_APP_SRS_URL='webrtc://119.45.242.222/'
VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1' VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1'

7
hd-glasses-app/.env.hd Normal file
View File

@@ -0,0 +1,7 @@
VUE_APP_MAP_URL='https://172.16.3.19/geoserver'
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
VUE_APP_API="https://172.16.3.19/znzq"
VUE_APP_STATIC_FILE_Prefix='//172.16.3.19/static_file'
VUE_APP_SRS_URL='webrtc://172.16.3.19/'
VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1'

View File

@@ -1,7 +1,7 @@
VUE_APP_MAP_URL='http://172.16.2.2:8600/geoserver' VUE_APP_MAP_URL='https://172.16.3.19/geoserver'
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be' VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
VUE_APP_API="http://172.16.2.3:19000/znzq" VUE_APP_API="https://172.16.3.19/znzq"
VUE_APP_STATIC_FILE_Prefix='https://172.16.3.19/static_file' VUE_APP_STATIC_FILE_Prefix='//172.16.3.19/static_file'
VUE_APP_SRS_URL='webrtc://172.16.3.19/' VUE_APP_SRS_URL='webrtc://172.16.3.19/'
VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1' VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1'

View File

@@ -5,8 +5,8 @@
"scripts": { "scripts": {
"local-server": "vue-cli-service serve --mode local", "local-server": "vue-cli-service serve --mode local",
"serve": "vue-cli-service serve --mode dev", "serve": "vue-cli-service serve --mode dev",
"prod-serve": "vue-cli-service serve --mode prod", "prod-serve": "vue-cli-service serve --mode hd",
"build": "vue-cli-service build --mode prod", "build:hd": "vue-cli-service build --mode hd",
"build:online": "vue-cli-service build --mode dev", "build:online": "vue-cli-service build --mode dev",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },

View File

@@ -124,8 +124,8 @@ function SrsRtcPublisherAsync() {
// @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack // @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
stream.getTracks().forEach(function (track) { stream.getTracks().forEach(function (track) {
console.log("获取到一个流") // console.log("获取到一个流")
console.log(track.kind); // console.log(track.kind);
self.pc.addTrack(track); self.pc.addTrack(track);
// Notify about local track when stream is ok. // Notify about local track when stream is ok.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -6,7 +6,8 @@
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<template v-for="(item,index) in videoRoomSteamList"> <template v-for="(item,index) in videoRoomSteamList">
<div :key="item.webrtcUrl" class="swiper-slide"> <div :key="item.webrtcUrl" class="swiper-slide">
<video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay @click="videoClickAction(item.publishId)"></video> <video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay
@click="videoClickAction(item.publishId)"></video>
</div> </div>
</template> </template>
</div> </div>
@@ -27,13 +28,13 @@
<img :src="switchCameraImg"> <img :src="switchCameraImg">
</div> </div>
</div> </div>
</div>
<div class="callDownBox">
<div @click="videoDownAction"> <div @click="videoDownAction">
<div class="actionBtn callDownBox">
<img :src="callDwonImg"> <img :src="callDwonImg">
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- <video ref="localVideo" id="rtc_media_local_player" width="310" autoplay muted controls></video>--> <!-- <video ref="localVideo" id="rtc_media_local_player" width="310" autoplay muted controls></video>-->
<!-- <van-button type="primary" @click="playVideo">主要按钮</van-button>--> <!-- <van-button type="primary" @click="playVideo">主要按钮</van-button>-->
<!-- <van-button type="primary" @click="beginPublish">开始推流</van-button>--> <!-- <van-button type="primary" @click="beginPublish">开始推流</van-button>-->
@@ -82,18 +83,24 @@ export default {
cameraImg: "", cameraImg: "",
switchCameraImg: "", switchCameraImg: "",
callDwonImg: "", callDwonImg: "",
showConfirmDialog:0, showConfirmDialog: 0,
inviteName:0, inviteName: 0,
showInviteConfirmDialog: 0,
}; };
}, },
mounted() { mounted() {
console.log(location.href)
console.log(location.href)
console.log(location.href)
this.isPublish = this.$route.query.isPublish; this.isPublish = this.$route.query.isPublish;
this.isPlayer = this.$route.query.isPlayer; this.isPlayer = this.$route.query.isPlayer;
this.uid = this.$route.query.uid; this.uid = this.$route.query.uid;
this.roomId = this.$route.query.room; this.roomId = this.$route.query.room;
this.inviteName = this.$route.query.inviteName||''; this.inviteName = this.$route.query.inviteName || '';
this.topVideo = this.uid; this.topVideo = this.uid;
this.showConfirmDialog = this.$route.query.showConfirmDialog; this.showConfirmDialog = this.$route.query.showConfirmDialog;
this.showInviteConfirmDialog = this.$route.query.showInviteConfirmDialog;
this.voiceImg = getStatisFileUrl("/media/voice_open.png") this.voiceImg = getStatisFileUrl("/media/voice_open.png")
@@ -101,7 +108,12 @@ export default {
this.switchCameraImg = getStatisFileUrl("/media/switch.png") this.switchCameraImg = getStatisFileUrl("/media/switch.png")
this.callDwonImg = getStatisFileUrl("/media/call_down.png") this.callDwonImg = getStatisFileUrl("/media/call_down.png")
if(this.showConfirmDialog==1){ this.token = this.$route.query.token || "";
if (this.token > 10) {
localStorage.setItem("hd_token", this.token)
}
if (this.showConfirmDialog == 1) {
Dialog.confirm({ Dialog.confirm({
title: '是否接受?', title: '是否接受?',
message: `${this.inviteName}邀请你加入视频聊天`, message: `${this.inviteName}邀请你加入视频聊天`,
@@ -114,7 +126,20 @@ export default {
location.href = "uniwebview://action?function=refuseVideoInvite"; location.href = "uniwebview://action?function=refuseVideoInvite";
// on cancel // on cancel
}); });
}else { } else if (this.showInviteConfirmDialog == 1) {
Dialog.confirm({
title: '提示',
message: `确认是否发起视频聊天?`,
})
.then(() => {
this.init();
// on confirm
})
.catch(() => {
window.history.go(-1);
// on cancel
});
} else {
this.init(); this.init();
} }
@@ -126,11 +151,18 @@ export default {
this.leaveRoom(); this.leaveRoom();
}, },
methods: { methods: {
init(){ init() {
Notify({
message: '如视频不能播放,请点击视频列表中对应的用户上方的小视频',
duration: 10000,
type: 'primary'
});
if (this.isPublish == 1) { if (this.isPublish == 1) {
this.beginPublish() this.beginPublish()
} }
if (this.isPlayer == 1) { if (this.isPlayer == 1) {
this.getRoomVideoList();
this.roomTimer = setInterval(() => { this.roomTimer = setInterval(() => {
this.getRoomVideoList(); this.getRoomVideoList();
}, 2000) }, 2000)
@@ -147,33 +179,31 @@ export default {
//如果声音是开启状态 //如果声音是开启状态
if (!this.isCloseVoice) { if (!this.isCloseVoice) {
// 关闭声音 // 关闭声音
this.isCloseVoice=true this.isCloseVoice = true
this.voiceImg = getStatisFileUrl("/media/voice_close.png") this.voiceImg = getStatisFileUrl("/media/voice_close.png")
}else { } else {
// 打开声音 // 打开声音
this.isCloseVoice=false; this.isCloseVoice = false;
this.constraints.audio = true this.constraints.audio = true
this.voiceImg = getStatisFileUrl("/media/voice_open.png") this.voiceImg = getStatisFileUrl("/media/voice_open.png")
} }
console.log(this.isCloseVoice)
console.log(this.voiceImg)
this.beginPublish() this.beginPublish()
}, },
closeCamera() { closeCamera() {
this.constraints.video = false; this.constraints.video = false;
//如果视频是开启状态 //如果视频是开启状态
if (!this.isCloseCamera) { if (!this.isCloseCamera) {
this.constraints.video=false this.constraints.video = false
this.isCloseCamera=true this.isCloseCamera = true
this.cameraImg = getStatisFileUrl("/media/camera_close.png") this.cameraImg = getStatisFileUrl("/media/camera_close.png")
}else { } else {
let deviceId = { let deviceId = {
exact: "" exact: ""
} }
deviceId.exact = this.cameraDevices[this.cameraIndex].deviceId deviceId.exact = this.cameraDevices[this.cameraIndex].deviceId
this.constraints.video = {} this.constraints.video = {}
this.constraints.video.deviceId = deviceId this.constraints.video.deviceId = deviceId
this.isCloseCamera=false this.isCloseCamera = false
this.cameraImg = getStatisFileUrl("/media/camera_open.png") this.cameraImg = getStatisFileUrl("/media/camera_open.png")
} }
this.beginPublish() this.beginPublish()
@@ -257,6 +287,7 @@ export default {
}, },
playVideo(publishId = "", url = "") { playVideo(publishId = "", url = "") {
let _this = this;
let sdk = null; let sdk = null;
let video = null; let video = null;
// const _key=`${}` // const _key=`${}`
@@ -286,6 +317,7 @@ export default {
const topVideo = this.$refs.videoStreamtopVideo const topVideo = this.$refs.videoStreamtopVideo
topVideo.srcObject = sdk.stream; topVideo.srcObject = sdk.stream;
topVideo.onloadedmetadata = function (e) { topVideo.onloadedmetadata = function (e) {
topVideo.volume = 0
topVideo.play(); topVideo.play();
}; };
} }
@@ -293,6 +325,8 @@ export default {
video.srcObject = sdk.stream; video.srcObject = sdk.stream;
video.onloadedmetadata = function (e) { video.onloadedmetadata = function (e) {
if (publishId == _this.uid)
video.volume = 0
video.play(); video.play();
}; };
@@ -393,6 +427,8 @@ export default {
videoClickAction(publishId) { videoClickAction(publishId) {
this.topVideo = publishId; this.topVideo = publishId;
var video = eval('this.$refs.videoStream' + publishId)[0] var video = eval('this.$refs.videoStream' + publishId)[0]
video.play();
console.log(video.srcObject) console.log(video.srcObject)
this.$refs.videoStreamtopVideo.srcObject = video.srcObject; this.$refs.videoStreamtopVideo.srcObject = video.srcObject;
}, },
@@ -407,12 +443,14 @@ export default {
} }
}, },
videoDownAction(){ videoDownAction() {
location.href = "uniwebview://action?function=restartCamera"; location.href = "uniwebview://action?function=restartCamera";
if(this.showConfirmDialog==1){ this.publishSdk.close();
location.href = "uniwebview://action?function=restartCamera"; if (this.showConfirmDialog == 1) {
}else { console.log("挂断视频")
location.href = "uniwebview://action?function=refuseVideoInvite";
} else {
window.history.go(-1);
} }
} }
} }
@@ -421,8 +459,8 @@ export default {
<style lang="less"> <style lang="less">
.videoRoomContainer{ .videoRoomContainer {
width:100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #333030; background-color: #333030;
} }
@@ -459,37 +497,20 @@ export default {
width: 100px; width: 100px;
height: 100px; height: 100px;
border-radius: 100%; border-radius: 100%;
background:#000000; background: #000000;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
img{ img {
width: 50%; width: 50%;
height: 50%; height: 50%;
} }
} }
} }
.callDownBox{
margin-top: 150px;
display: flex;
flex-direction: row;
justify-content: space-around;
font-size: 16px;
div{
width: 100px;
height: 100px;
border-radius: 100%;
background:#DA4C4B;
display: flex;
justify-content: center;
align-items: center;
img{ .callDownBox {
width: 50%; background: #DA4C4B !important;
height: 50%;
}
}
} }
</style> </style>

View File

@@ -61,6 +61,7 @@ import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl} from "../utils/publicFun";
export default { export default {
data() { data() {
return { return {
@@ -125,9 +126,17 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log(location.href)
this.page = this.$route.query.page; this.page = this.$route.query.page;
this.pageType = this.$route.query.type; this.pageType = this.$route.query.type;
this.token = this.$route.query.token || "";
if (this.token > 10) {
localStorage.setItem("hd_token", this.token)
}
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")
if (hd_gps_location) { if (hd_gps_location) {
@@ -342,7 +351,7 @@ export default {
type: "featureMove", type: "featureMove",
geometry: geometryMove, geometry: geometryMove,
}); });
this.planningVectorLayer.set('id', 'planningVectorLayer'); // this.planningVectorLayer.set('id', 'planningVectorLayer');
//先清空 再清除 //先清空 再清除
this.map.removeLayer(this.planningVectorLayer) this.map.removeLayer(this.planningVectorLayer)
this.planningVectorLayer = new VectorLayer({ this.planningVectorLayer = new VectorLayer({
@@ -375,7 +384,7 @@ export default {
* 根据经纬度坐标添加摄像头要素 * 根据经纬度坐标添加摄像头要素
*/ */
addPoints(coordinate) { addPoints(coordinate) {
console.log("点击触发addPoints")
if (this.selectPoint.length > 0) { if (this.selectPoint.length > 0) {
this.coordinate = [] this.coordinate = []
this.map.removeLayer(this.pointLayer); this.map.removeLayer(this.pointLayer);
@@ -591,9 +600,12 @@ export default {
service.get(`/api/alarm/list`, { service.get(`/api/alarm/list`, {
params: { params: {
sendStatus: 1, sendStatus: "1",
disposition: "0",
pageNo: 1, pageNo: 1,
pageSize: 50 pageSize: 50,
column: "createTime",
order: "desc",
} }
}).then((res) => { }).then((res) => {
if (res.status == 200) { if (res.status == 200) {
@@ -601,11 +613,11 @@ export default {
this.alarmAnimation = null this.alarmAnimation = null
this.map.removeLayer(this.alarmLayer) this.map.removeLayer(this.alarmLayer)
this.alarmLayer = {}; this.alarmLayer = {};
res.data.result.records.map(record => { res.data.result.records.map((record, index) => {
try { try {
if (record.location != null) { if (record.location != null) {
this.addPointWidthCoordinate(record.location, "alarm", record) this.addPointWidthCoordinate(record.location, "alarm", record, index + 1)
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
@@ -618,14 +630,14 @@ export default {
switchFullScreen() { switchFullScreen() {
location.href = "uniwebview://action?function=switchBigScreen" location.href = "uniwebview://action?function=switchBigScreen"
}, },
addPointWidthCoordinate(coordinate, type, record) { addPointWidthCoordinate(coordinate, type, record, _index = 0) {
coordinate = coordinate.split(",") coordinate = coordinate.split(",")
coordinate = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857'); coordinate = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857');
// console.log("================addPointWidthCoordinate",coordinate) // console.log("================addPointWidthCoordinate",coordinate)
// 告警相关
if (type == 'alarm') { if (type == 'alarm') {
if (Object.keys(this.alarmLayer).length == 0) { if (Object.keys(this.alarmLayer).length == 0) {
// 创建图层 // 创建图层
@@ -641,61 +653,83 @@ export default {
}, 900); }, 900);
} }
const feature = new Feature({ const feature = new Feature({
geometry: new Point(coordinate), geometry: new Point(coordinate),
data: record, data: record,
type: 'alarm' type: 'alarm'
}); });
const alarmCategory_dictText=record.alarmCategory_dictText||"未知类型"
//临时智慧所,小红旗
if (record.alarmCategory == "1706273001850601474") {
// 设置要素的图标
feature.setStyle(
new Style({
// 设置图片效果
image: new Icon({
src: getStatisFileUrl("/map/hongqi.png"),
anchor: [0.5, 0.5],
scale: 0.3,
}),
text: new Text({
testAlign: 'center',
text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'],
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
}),
offsetY: -2
})
})
);
} else {
// 设置要素的图标 // 设置要素的图标
feature.setStyle( feature.setStyle(
new Style({ new Style({
// 设置图片效果 // 设置图片效果
image: new Icon({ image: new Icon({
src: getStatisFileUrl("/map/icon_paishuibeng_h.png"), src: getStatisFileUrl("/map/icon_paishuibeng_h.png"),
// anchor: [0.5, 0.5], anchor: [0.5, 0.5],
scale: 0.4, scale: 0.4,
}), }),
text: new Text({
testAlign: 'center',
text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'],
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
})
})
}) })
); );
}
// 要素添加到地图图层上 // 要素添加到地图图层上
this.alarmLayer.getSource().addFeature(feature); this.alarmLayer.getSource().addFeature(feature);
console.log("===============结束告警点位添加")
} }
//设备相关
if (type == 'equipment') { if (type == 'equipment') {
let alarmNum=record.alarmNum||0;
// 模拟数据
// record.isOnline="true";
// alarmNum=0;
const feature = new Feature({
geometry: new Point(coordinate),
data: record,
type: 'equipment'
});
if (Object.keys(this.equipmentLayer).length == 0) { if (Object.keys(this.equipmentLayer).length == 0) {
// 创建图层 // 创建图层
this.equipmentLayer = new VectorLayer({ this.equipmentLayer = new VectorLayer({
source: new VectorSource(), source: new VectorSource(),
}); });
// 图层添加到地图上
this.map.addLayer(this.equipmentLayer); this.map.addLayer(this.equipmentLayer);
} }
if (record.isOnline == "true") { // 设备离线 设置样式
const feature = new Feature({
geometry: new Point(coordinate),
data: record,
type: 'equipment'
});
// 设置要素的图标
feature.setStyle(
new Style({
// 设置图片效果
image: new Icon({
src: getStatisFileUrl("/map/Group_29@2x.png"),
// anchor: [0.5, 0.5],
scale: 0.4,
}),
})
);
// 要素添加到地图图层上
this.equipmentLayer.getSource().addFeature(feature);
}
if (record.isOnline == "false") { if (record.isOnline == "false") {
const feature = new Feature({
geometry: new Point(coordinate),
data: record,
type: 'equipment'
});
// 设置要素的图标 // 设置要素的图标
feature.setStyle( feature.setStyle(
new Style({ new Style({
@@ -707,16 +741,12 @@ export default {
}), }),
}) })
); );
// 要素添加到地图图层上
this.equipmentLayer.getSource().addFeature(feature);
} }
if (record.isAlarm == false) {
const feature = new Feature({
geometry: new Point(coordinate), if (record.isOnline == "true") {
data: record, // 未接受告警数量为0全部都接受 绿色
type: 'equipment' if(alarmNum==0){
});
// 设置要素的图标
feature.setStyle( feature.setStyle(
new Style({ new Style({
// 设置图片效果 // 设置图片效果
@@ -727,13 +757,32 @@ export default {
}), }),
}) })
); );
feature.on("click", (event) => {
console.log("告警图标被点击")
console.log(event)
})
// 要素添加到地图图层上
this.equipmentLayer.getSource().addFeature(feature);
} }
if(alarmNum>0){
feature.setStyle(
new Style({
// 设置图片效果
image: new Icon({
src: getStatisFileUrl("/map/Group_29@2x.png"),
// anchor: [0.5, 0.5],
scale: 0.4,
}),
text:new Text({
testAlign: 'center',
text: `${alarmNum}条告警未接受`,
font: 'bold 16px 微软雅黑',
fill: new Fill({
color: '#369FFF',
}),
// offsetX: 40,
offsetY: 26
})
})
);
}
}
this.equipmentLayer.getSource().addFeature(feature);
} }
@@ -810,23 +859,21 @@ export default {
this.map.addLayer(this.drawPlanningPathLayer); this.map.addLayer(this.drawPlanningPathLayer);
service.get(`/api/patrol/area/list`, { service.get(`/api/patrol/area/list`, {}).then((res) => {
}).then((res) => {
if (res.status == 200) { if (res.status == 200) {
console.log(res.data.result.records) console.log(res.data.result.records)
res.data.result.records.map((record) =>{ res.data.result.records.map((record) => {
console.log(record) console.log(record)
this.drawAreaLayer(record.areaName,JSON.parse(record.area)) this.drawAreaLayer(record.areaName, JSON.parse(record.area))
}) })
} }
}) })
}, },
drawAreaLayer(title,areaList) { drawAreaLayer(title, areaList) {
console.log(title) console.log(title)
areaList=areaList[0] areaList = areaList[0]
console.log(areaList) console.log(areaList)
const tempGeometryList = [] const tempGeometryList = []
@@ -837,7 +884,7 @@ export default {
tempGeometryList.push(tempGeometryList[0]) tempGeometryList.push(tempGeometryList[0])
const _list=[tempGeometryList] const _list = [tempGeometryList]
console.log(_list) console.log(_list)
@@ -847,7 +894,7 @@ export default {
const polygonFeature = new Feature({ const polygonFeature = new Feature({
geometry: polygonGeometry, geometry: polygonGeometry,
name:title name: title
}) })
polygonFeature.setStyle(new Style({ polygonFeature.setStyle(new Style({
@@ -859,10 +906,10 @@ export default {
color: 'rgba(255,255,0,0.1)' color: 'rgba(255,255,0,0.1)'
}), }),
text: new Text({ text: new Text({
testAlign:'center', testAlign: 'center',
text:title, text: title,
font:'bold 20px 微软雅黑', font: 'bold 20px 微软雅黑',
fill:new Fill({ fill: new Fill({
color: '#ffa502', color: '#ffa502',
}) })
}) })
@@ -992,7 +1039,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
font-size: 14px; font-size: 18px !important;
padding-top: 50px; padding-top: 50px;
.alarmDetailsBox { .alarmDetailsBox {

View File

@@ -59,7 +59,7 @@ import * as interaction from 'ol/interaction'; // 交互
import {OL as ol} from "plot-ol/plottingol"; import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON' import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
export default { export default {
data() { data() {
@@ -125,8 +125,12 @@ export default {
}; };
}, },
mounted() { mounted() {
this.page = this.$route.query.page; this.page = this.$route.query.page||getUrlParam("page");
this.pageType = this.$route.query.type; this.pageType = this.$route.query.type||getUrlParam("type");
this.token = this.$route.query.token ||getUrlParam("token");
localStorage.setItem("hd_token", this.token)
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")

View File

@@ -85,7 +85,9 @@ import * as interaction from 'ol/interaction'; // 交互
import {OL as ol} from "plot-ol/plottingol"; import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON' import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
import dayjs from "dayjs" import dayjs from "dayjs"
export default { export default {
@@ -99,6 +101,7 @@ export default {
pointLayer: {}, pointLayer: {},
canAddPoints: false, canAddPoints: false,
coordinate: [], coordinate: [],
routeOriginList: [],
route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]), route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]),
route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]), route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]),
geometryMove: {}, geometryMove: {},
@@ -117,6 +120,26 @@ export default {
scale: 1, //设置大小 scale: 1, //设置大小
}), }),
}), }),
startPoint: new Style({
text: new Text({
testAlign: 'center',
text: "起点",
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
})
})
}),
endPoint: new Style({
text: new Text({
testAlign: 'center',
text: "终点",
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
})
})
}),
featureMove: new Style({ featureMove: new Style({
image: new Circle({ image: new Circle({
radius: 7, radius: 7,
@@ -126,6 +149,12 @@ export default {
width: 2, width: 2,
}), }),
}), }),
text: new Text({
font: '16px Arial',
testAlign: 'left',
offsetX: 90,
offsetY: 1,
})
}), }),
}, },
vectorLayer: {}, vectorLayer: {},
@@ -153,14 +182,22 @@ export default {
planningVectorLayer: {}, planningVectorLayer: {},
parentPostMessageData: [], parentPostMessageData: [],
isCanDraw: true, isCanDraw: true,
moveUserId: "" moveUserId: "",
moveIndex: 0,
pointMoveTimer:null,
}; };
}, },
mounted() { mounted() {
this.page = this.$route.query.page; console.log(location.href)
this.pageType = this.$route.query.type; this.page = this.$route.query.page||getUrlParam("page");
this.equipmentId = this.$route.query.equipmentId; this.pageType = this.$route.query.type||getUrlParam("type");
this.moveUserId = this.$route.query.uerId; this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
this.token = this.$route.query.token ||getUrlParam("token");
localStorage.setItem("hd_token", this.token)
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")
@@ -344,8 +381,7 @@ export default {
const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857'); const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857');
const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857'); const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857');
console.log(startPoint)
console.log(endPoint)
const _points = `${startPoint[0]}#${startPoint[1]}@${endPoint[0]}#${endPoint[1]}` const _points = `${startPoint[0]}#${startPoint[1]}@${endPoint[0]}#${endPoint[1]}`
@@ -380,7 +416,8 @@ export default {
type: "featureMove", type: "featureMove",
geometry: geometryMove, geometry: geometryMove,
}); });
this.planningVectorLayer.set('id', 'planningVectorLayer');
// this.planningVectorLayer.set('id', 'planningVectorLayer');
//先清空 再清除 //先清空 再清除
this.map.removeLayer(this.planningVectorLayer) this.map.removeLayer(this.planningVectorLayer)
this.planningVectorLayer = new VectorLayer({ this.planningVectorLayer = new VectorLayer({
@@ -488,19 +525,71 @@ export default {
); );
this.geometryMove.setCoordinates(currentCoordinate); this.geometryMove.setCoordinates(currentCoordinate);
const vectorContext = getVectorContext(e); const vectorContext = getVectorContext(e);
this.styles.featureMove.getText().setText("13123")
vectorContext.setStyle(this.styles.featureMove); vectorContext.setStyle(this.styles.featureMove);
vectorContext.drawGeometry(this.geometryMove); vectorContext.drawGeometry(this.geometryMove);
this.map.render(); this.map.render();
},
moveFeatureByCoordinate(e) {
// console.warn(this.routeOriginList);
this.moveIndex = this.moveIndex + 1
if(this.moveIndex>=this.routeOriginList.length){
return false;
}
const currentCoordinate = this.routeOriginList[this.moveIndex]
this.geometryMove.setCoordinates(currentCoordinate);
const vectorContext = getVectorContext(e);
this.styles.featureMove.getText().setText("13123")
vectorContext.setStyle(this.styles.featureMove);
vectorContext.drawGeometry(this.geometryMove);
this.map.render();
}, },
startAnimation() { startAnimation() {
this.lastTime = Date.now(); this.pointMoveTimer=setInterval(()=>{
this.vectorLayer.on("postrender", this.moveFeature); this.moveIndex = this.moveIndex + 30
this.featureMove.setGeometry(null); //必须用null不能用{}
if(this.moveIndex>=this.routeOriginList.length){
this.moveIndex=0;
return false;
}
const currentCoordinate = this.routeOriginList[this.moveIndex]
console.log(currentCoordinate);
this.geometryMove.setCoordinates(currentCoordinate.location);
this.styles.featureMove.getText().setText(currentCoordinate.createTime)
this.featureMove.setStyle(this.styles.featureMove)
// this.featureMove.drawGeometry(this.geometryMove);
this.map.render();
},2000)
}, },
stopAnimation() { stopAnimation() {
this.featureMove.setGeometry(this.geometryMove); this.featureMove.setGeometry(this.geometryMove);
this.vectorLayer.un("postrender", this.moveFeature); this.vectorLayer.un("postrender", this.moveFeatureByCoordinate);
}, },
addAlarmPointNextAction() { addAlarmPointNextAction() {
if (this.selectPoint.length == 0) { if (this.selectPoint.length == 0) {
@@ -809,7 +898,7 @@ export default {
const tempGeometryList = [] const tempGeometryList = []
this.parentPostMessageData.map(item => { this.parentPostMessageData.map(item => {
tempGeometryList.push(ol.proj.transform(item,'EPSG:4326','EPSG:3857')) tempGeometryList.push(ol.proj.transform(item, 'EPSG:4326', 'EPSG:3857'))
}) })
console.log(tempGeometryList) console.log(tempGeometryList)
@@ -910,56 +999,106 @@ export default {
this.drawPlanningPathLayer.getSource().addFeature(polygonFeature) this.drawPlanningPathLayer.getSource().addFeature(polygonFeature)
}, },
showMoveHistory() { showMoveHistory() {
// 矢量地图源 if(this.pointMoveTimer!=null){
let vectorSource = new VectorSource(); clearTimeout(this.pointMoveTimer)
// 矢量地图 this.pointMoveTimer=null;
this.drawPlanningPathLayer = new VectorLayer({ }
source: vectorSource,
style: new Style({
stroke: new Stroke({
width: 6,
color: [237, 212, 0, 0.8],
}),
})
});
// console.log("================================================================showMoveHistory")
// console.log(this.startDate)
// console.log(dayjs(this.startDate).format('YYYY-MM-DD HH:mm'))
// console.log(this.endTime)
// console.log(dayjs(this.endTime).format('YYYY-MM-DD HH:mm'))
service.get(`/sys/equipment/trajectory`, { service.get(`/sys/equipment/trajectory`, {
params: { params: {
uerId: this.moveUserId, uerId: this.moveUserId,
equipmentId: this.equipmentId, equipmentId: this.equipmentId,
startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'), startTime: dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'), endTime: dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
pageSize:1000 pageSize: 2000,
// column: "createTime",
// order: "asc"
} }
}).then((res) => { }).then((res) => {
if (res.status == 200) { if (res.status == 200) {
this.showendDate=false
this.showstartDate=false this.showendDate = false
const _list=[] this.showstartDate = false
res.data.result.records.map((record,index) => { const _list = []
if(index==0){
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857') let records = res.data.result.records;
records.reverse();
records.map((record, index) => {
if (index == 0) {
const startPoint = ol.proj.transform(record.location.split(","), 'EPSG:4326', 'EPSG:3857')
this.map.getView().animate({ this.map.getView().animate({
center:startPoint, center: startPoint,
duration:1000, duration: 1000,
zoom:18 zoom: 18
}) })
} }
_list.push(record.location.split(",")) let _location = record.location.split(",");
_location = ol.proj.transform(_location, 'EPSG:4326', 'EPSG:3857')
_list.push(_location)
record.location = _location;
}) })
this.parentPostMessageData=_list
this.drawPcPostMessageDataLayer()
this.routeOriginList = records;
console.log(this.routeOriginList.length);
this.map.removeInteraction(this.draw) this.map.removeInteraction(this.draw)
this.map.removeInteraction(this.snap) this.map.removeInteraction(this.snap)
this.route = new LineString(_list)
setTimeout(() => {
this.moveFromStartToEnd()
}, 1000)
} }
}) })
},
moveFromStartToEnd() {
this.geometryMove = new Point(this.route.getFirstCoordinate());
this.featureMove = new Feature({
type: "featureMove",
geometry: this.geometryMove,
});
this.vectorLayer = new VectorLayer({
source: new VectorSource({
features: [
new Feature({
type: "route",
geometry: this.route,
}),
this.featureMove,
new Feature({
type: "startPoint",
geometry: new Point(this.route.getFirstCoordinate()),
}),
new Feature({
type: "endPoint",
geometry: new Point(this.route.getLastCoordinate()),
}),
],
}),
style: (feature) => {
return this.styles[feature.get("type")];
},
});
this.map.addLayer(this.vectorLayer);
this.startAnimation();
}, },
endDateConfirm(value) { endDateConfirm(value) {
console.log(dayjs(value)) console.log(dayjs(value))
@@ -967,15 +1106,15 @@ export default {
console.log(this.startDate) console.log(this.startDate)
if (dayjs(value).isBefore(dayjs(this.startDate))) { if (dayjs(value).isBefore(dayjs(this.startDate))) {
console.log("结束时间早于开始时间") console.log("结束时间早于开始时间")
Notify({ type: 'warning', message: '结束时间不可早于开始时间' }); Notify({type: 'warning', message: '结束时间不可早于开始时间'});
} else { } else {
console.log("开始时间早于结束时间") console.log("开始时间早于结束时间")
this.endDate = dayjs(value).toDate() this.endDate = dayjs(value).toDate()
console.log("打印结束时间") console.log("打印结束时间")
console.log(this.endDate) console.log(this.endDate)
setTimeout(()=>{ setTimeout(() => {
this.showMoveHistory() this.showMoveHistory()
},1000) }, 1000)
} }
}, },
@@ -985,12 +1124,12 @@ export default {
console.log(this.endDate) console.log(this.endDate)
if (dayjs(value).isBefore(dayjs(this.endDate))) { if (dayjs(value).isBefore(dayjs(this.endDate))) {
this.startDate = dayjs(value).toDate() this.startDate = dayjs(value).toDate()
setTimeout(()=>{ setTimeout(() => {
this.showMoveHistory() this.showMoveHistory()
},1000) }, 1000)
console.log("开始时间早于结束时间") console.log("开始时间早于结束时间")
} else { } else {
Notify({ type: 'warning', message: '开始时间不可晚于结束时间' }); Notify({type: 'warning', message: '开始时间不可晚于结束时间'});
console.log("结束时间早于开始时间") console.log("结束时间早于开始时间")
} }
} }

View File

@@ -78,9 +78,8 @@ import * as interaction from 'ol/interaction'; // 交互
import {OL as ol} from "plot-ol/plottingol"; import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON' import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun";
import dayjs from "dayjs" import dayjs from "dayjs"
export default { export default {
data() { data() {
return { return {
@@ -151,11 +150,17 @@ export default {
}; };
}, },
mounted() { mounted() {
this.page = this.$route.query.page; console.log(location.href)
this.pageType = this.$route.query.type;
this.equipmentId = this.$route.query.equipmentId; this.page = this.$route.query.page||getUrlParam("page");
this.moveUserId = this.$route.query.uerId; this.pageType = this.$route.query.type||getUrlParam("type");
this.workOrderNo = this.$route.query.workOrderNo||''; this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
this.workOrderNo = this.$route.query.workOrderNo||getUrlParam("workOrderNo");
this.token = this.$route.query.token ||getUrlParam("page");
localStorage.setItem("hd_token", this.token)
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")

View File

@@ -63,7 +63,7 @@ import * as interaction from 'ol/interaction'; // 交互
import {OL as ol} from "plot-ol/plottingol"; import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON' import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl,GetQueryString,getUrlParam} from "../utils/publicFun";
import dayjs from "dayjs" import dayjs from "dayjs"
export default { export default {
@@ -77,6 +77,7 @@ export default {
pointLayer: {}, pointLayer: {},
canAddPoints: false, canAddPoints: false,
coordinate: [], coordinate: [],
routeOriginList: [],
route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]), route: new LineString([[12496610.1929, 2476571.7426], [12496623.829, 2476586.2505]]),
route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]), route1: new LineString([[113.95113841271974, 22.568523240293505], [113.94452944970705, 22.563351941312792], [113.95188943124391, 22.559317898954394], [113.94467965341188, 22.555326771940233]]),
geometryMove: {}, geometryMove: {},
@@ -85,7 +86,7 @@ export default {
route: new Style({ route: new Style({
stroke: new Stroke({ stroke: new Stroke({
width: 6, width: 6,
color: [237, 212, 0, 0.8], color: "rgb(255, 77, 54)",
}), }),
}), }),
icon: new Style({ icon: new Style({
@@ -95,6 +96,26 @@ export default {
scale: 1, //设置大小 scale: 1, //设置大小
}), }),
}), }),
startPoint: new Style({
text: new Text({
testAlign: 'center',
text: "起点",
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
})
})
}),
endPoint: new Style({
text: new Text({
testAlign: 'center',
text: "终点",
font: 'bold 20px 微软雅黑',
fill: new Fill({
color: '#ffa502',
})
})
}),
featureMove: new Style({ featureMove: new Style({
image: new Circle({ image: new Circle({
radius: 7, radius: 7,
@@ -104,10 +125,17 @@ export default {
width: 2, width: 2,
}), }),
}), }),
text: new Text({
font: '16px Arial',
testAlign: 'left',
offsetX: 90,
offsetY: 1,
})
}), }),
}, },
vectorLayer: {}, vectorLayer: {},
distance: 0, distance: 0,
onceDistance:5,
lastTime: 0, lastTime: 0,
speed: 0.1, speed: 0.1,
page: null, page: null,
@@ -132,15 +160,32 @@ export default {
parentPostMessageData: [], parentPostMessageData: [],
isCanDraw: true, isCanDraw: true,
moveUserId: "", moveUserId: "",
patrolInstanceId: "" patrolInstanceId: "",
moveIndex: 0,
pointMoveTimer:null,
mapZoom:15
}; };
}, },
mounted() { mounted() {
this.page = this.$route.query.page; console.log(location.href)
this.pageType = this.$route.query.type;
this.patrolInstanceId = this.$route.query.patrolInstanceId||'1717873511875563522'; this.page = this.$route.query.page||getUrlParam("page");
this.equipmentId = this.$route.query.equipmentId; this.pageType = this.$route.query.type||getUrlParam("type");
this.moveUserId = this.$route.query.uerId; this.patrolInstanceId = this.$route.query.patrolInstanceId||getUrlParam("patrolInstanceId");
this.equipmentId = this.$route.query.equipmentId||getUrlParam("equipmentId");
this.moveUserId = this.$route.query.uerId||getUrlParam("uerId");
this.token = getUrlParam("token")
if(this.token){
if (this.token.length > 10) {
console.log("获取到token")
localStorage.setItem("hd_token", this.token)
}else {
console.log("未获取到token")
}
}
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")
@@ -289,7 +334,7 @@ export default {
view: new View({ view: new View({
projection: "EPSG:3857", projection: "EPSG:3857",
center: [12497018.585823221, 2476783.2447665134], center: [12497018.585823221, 2476783.2447665134],
zoom: 15, zoom: this.mapZoom,
}), }),
}); });
this.map.on('singleclick', e => { this.map.on('singleclick', e => {
@@ -474,14 +519,48 @@ export default {
this.map.render(); this.map.render();
}, },
startAnimation() { startAnimation() {
this.lastTime = Date.now(); this.pointMoveTimer=setInterval(()=>{
this.vectorLayer.on("postrender", this.moveFeature);
this.featureMove.setGeometry(null); //必须用null不能用{}
},
console.log("Start animation 2s 一次")
console.log("this.routeOriginList.length:",this.routeOriginList.length)
this.moveIndex = this.moveIndex + this.onceDistance
console.log("this.moveIndex:"+this.moveIndex)
if(this.moveIndex>=this.routeOriginList.length){
this.moveIndex=this.routeOriginList.length-1;
}
const currentCoordinate = this.routeOriginList[this.moveIndex]
console.log(currentCoordinate);
this.geometryMove.setCoordinates(currentCoordinate.location);
this.styles.featureMove.getText().setText(currentCoordinate.createTime)
this.featureMove.setStyle(this.styles.featureMove)
// this.featureMove.drawGeometry(this.geometryMove);
this.map.render();
// 如果跳到最后一个点下标就重置为 0
if(this.moveIndex==this.routeOriginList.length-1){
this.moveIndex=0;
}
},2000)
},
stopAnimation() { stopAnimation() {
this.featureMove.setGeometry(this.geometryMove); this.featureMove.setGeometry(this.geometryMove);
this.vectorLayer.un("postrender", this.moveFeature); this.vectorLayer.un("postrender", this.moveFeatureByCoordinate);
}, },
addAlarmPointNextAction() { addAlarmPointNextAction() {
if (this.selectPoint.length == 0) { if (this.selectPoint.length == 0) {
@@ -914,7 +993,6 @@ export default {
service.get(`/sys/equipment/trajectory`, { service.get(`/sys/equipment/trajectory`, {
params: { params: {
uerId: this.moveUserId, uerId: this.moveUserId,
equipmentId: this.equipmentId,
startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'), startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'), endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
pageSize:1000 pageSize:1000
@@ -930,7 +1008,7 @@ export default {
this.map.getView().animate({ this.map.getView().animate({
center:startPoint, center:startPoint,
duration:1000, duration:1000,
zoom:18 zoom:this.mapZoom
}) })
} }
_list.push(record.location.split(",")) _list.push(record.location.split(","))
@@ -1006,7 +1084,7 @@ export default {
this.map.getView().animate({ this.map.getView().animate({
center:startPoint, center:startPoint,
duration:1000, duration:1000,
zoom:18 zoom:this.mapZoom
}) })
this.drawPcPostMessageDataLayer(longitudeLatitude,"planPathLine") this.drawPcPostMessageDataLayer(longitudeLatitude,"planPathLine")
@@ -1020,10 +1098,23 @@ export default {
}, },
getPatrolInstanceRealyPath(startTime,endTime){ getPatrolInstanceRealyPath(startTime,endTime){
if(this.pointMoveTimer!=null){
clearTimeout(this.pointMoveTimer)
this.pointMoveTimer=null;
}
//TODO 如果开始时间和结束时间都相等,则不进行任何查询
if(startTime==endTime){
return false;
}
if(endTime==null){
endTime=dayjs().format('YYYY-MM-DD HH:mm')
}
service.get(`/sys/equipment/trajectory`, { service.get(`/sys/equipment/trajectory`, {
params: { params: {
uerId: this.moveUserId, uerId: this.moveUserId,
equipmentId: this.equipmentId,
startTime:startTime, startTime:startTime,
endTime:endTime, endTime:endTime,
pageSize:1000 pageSize:1000
@@ -1033,24 +1124,84 @@ export default {
this.showendDate=false this.showendDate=false
this.showstartDate=false this.showstartDate=false
const _list=[] const _list=[]
res.data.result.records.map((record,index) => {
let records = res.data.result.records;
records.reverse();
records.map((record,index) => {
if(index==0){ if(index==0){
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857') const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857')
this.map.getView().animate({ this.map.getView().animate({
center:startPoint, center:startPoint,
duration:1000, duration:1000,
zoom:18 zoom:this.mapZoom
}) })
} }
_list.push(record.location.split(",")) let _location = record.location.split(",");
_location = ol.proj.transform(_location, 'EPSG:4326', 'EPSG:3857')
_list.push(_location)
record.location = _location;
}) })
this.drawPcPostMessageDataLayer(_list,"realyPathLine")
this.onceDistance=Math.ceil(records.length/15)
this.routeOriginList = records;
this.route = new LineString(_list)
setTimeout(() => {
this.moveFromStartToEnd()
}, 1000)
// this.drawPcPostMessageDataLayer(_list,"realyPathLine")
this.map.removeInteraction(this.draw) this.map.removeInteraction(this.draw)
this.map.removeInteraction(this.snap) this.map.removeInteraction(this.snap)
} }
}) })
},
moveFromStartToEnd() {
this.geometryMove = new Point(this.route.getFirstCoordinate());
this.featureMove = new Feature({
type: "featureMove",
geometry: this.geometryMove,
});
this.vectorLayer = new VectorLayer({
source: new VectorSource({
features: [
new Feature({
type: "route",
geometry: this.route,
}),
this.featureMove,
new Feature({
type: "startPoint",
geometry: new Point(this.route.getFirstCoordinate()),
}),
new Feature({
type: "endPoint",
geometry: new Point(this.route.getLastCoordinate()),
}),
],
}),
style: (feature) => {
return this.styles[feature.get("type")];
},
});
this.map.addLayer(this.vectorLayer);
this.startAnimation();
} }
}, },

View File

@@ -120,7 +120,6 @@ export default {
geometry: this.geometryMove, geometry: this.geometryMove,
}); });
console.log(this.route)
this.vectorLayer = new VectorLayer({ this.vectorLayer = new VectorLayer({
source: new VectorSource({ source: new VectorSource({
@@ -163,7 +162,7 @@ export default {
}), }),
}); });
// this.map.addLayer(this.vectorLayer); this.map.addLayer(this.vectorLayer);
}, },
/** /**
* 点击地图添加摄像头要素 * 点击地图添加摄像头要素

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,10 @@ const router = new Router({
path: '/hd_show_patrolTmp_history', path: '/hd_show_patrolTmp_history',
name: 'hd_show_patrolTmp_history', name: 'hd_show_patrolTmp_history',
component: () => import('../pages/hd_show_patrolTmp_history.vue') component: () => import('../pages/hd_show_patrolTmp_history.vue')
},{
path: '/map_test',
name: 'map_test',
component: () => import('../pages/map_test.vue')
} }
] ]
}); });

View File

@@ -1,6 +1,8 @@
export function getStatisFileUrl(file){ export function getStatisFileUrl(file) {
return process.env.VUE_APP_STATIC_FILE_Prefix+file var protocol = location.protocol
} const _url = protocol + process.env.VUE_APP_STATIC_FILE_Prefix + file
return _url
}
/** /**
* getUrlKey 截取地址栏参数 * getUrlKey 截取地址栏参数
@@ -9,7 +11,7 @@
*/ */
export function getUrlParam(name) { export function getUrlParam(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
let url = window.location.href.split('#')[0]; let url = window.location.href.split('#')[1];
let search = url.split('?')[1]; let search = url.split('?')[1];
console.log(search); console.log(search);
if (search) { if (search) {
@@ -22,14 +24,26 @@ export function getUrlParam(name) {
} }
export function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
console.log("window.location.search:",window.location.search);
var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
var context = "";
if (r != null)
context = decodeURIComponent(r[2]);
reg = null;
r = null;
return context == null || context == "" || context == "undefined" ? "" : context;
}
export function appInit(ms) { export function appInit(ms) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var i = 0; var i = 1000;
let timer = setInterval(() => { let timer = setInterval(() => {
var hd_token = localStorage.getItem("hd_token") var hd_token = localStorage.getItem("hd_token")
// var im_userId = localStorage.getItem("im_userId") // var im_userId = localStorage.getItem("im_userId")
i = i + 1; if (i < 10) {
if (i > 10) {
reject("error") reject("error")
} }
if (hd_token) { if (hd_token) {

View File

@@ -20,14 +20,16 @@ services:
LANG: en_US.UTF-8 LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8 LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai TZ: Asia/Shanghai
IM_HOST: 172.16.3.19
container_name: im-tcp container_name: im-tcp
volumes: volumes:
- ./:/hd-znzq/config - ./:/hd-znzq/config
- ./:/hd-znzq/system - ./:/hd-znzq/system
ports: network_mode: host
- 29001:29001 # ports:
- 29000:29000 # - 29001:29001
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar /hd-znzq/config/hd_1.yml # - 29000:29000
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-tcp-1.0.0-SNAPSHOT.jar /hd-znzq/config/hd_1.yml
im-message-store: im-message-store:
image: 172.16.2.1:8083/java:8_server-jre_unlimited image: 172.16.2.1:8083/java:8_server-jre_unlimited
restart: always restart: always
@@ -39,8 +41,9 @@ services:
container_name: im-message-store container_name: im-message-store
volumes: volumes:
- ./:/hd-znzq/system - ./:/hd-znzq/system
ports: # ports:
- 8990:8990 # - 8990:8990
network_mode: host
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-message-store-1.0.0-SNAPSHOT.jar command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-message-store-1.0.0-SNAPSHOT.jar
im-service: im-service:
image: 172.16.2.1:8083/java:8_server-jre_unlimited image: 172.16.2.1:8083/java:8_server-jre_unlimited
@@ -50,11 +53,13 @@ services:
LANG: en_US.UTF-8 LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8 LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai TZ: Asia/Shanghai
SRS_HOST: 172.16.3.19
container_name: im-service container_name: im-service
volumes: volumes:
- ./:/hd-znzq/system - ./:/hd-znzq/system
ports: ports:
- 28000:28000 - 28000:28000
# network_mode: host
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar
app-service: app-service:
image: 172.16.2.1:8083/java:8_server-jre_unlimited image: 172.16.2.1:8083/java:8_server-jre_unlimited

View File

@@ -6,7 +6,7 @@ lim:
heartBeatTime: 20000 #心跳超时时间 单位毫秒 heartBeatTime: 20000 #心跳超时时间 单位毫秒
brokerId: 1000 brokerId: 1000
loginModel: 3 loginModel: 3
logicUrl: http://172.16.2.3:28000/v1 logicUrl: http://172.16.3.19:28000/v1
# * 多端同步模式1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备 # * 多端同步模式1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备
# * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备 # * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备
# * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备 # * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备

View File

@@ -1,3 +1,3 @@
spring: spring:
profiles: profiles:
active: dev active: prod

View File

@@ -3,7 +3,10 @@ package com.lld.im.service;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication(scanBasePackages = {"com.lld.im.service", @SpringBootApplication(scanBasePackages = {"com.lld.im.service",
"com.lld.im.common"}) "com.lld.im.common"})
@MapperScan("com.lld.im.service.*.dao.mapper") @MapperScan("com.lld.im.service.*.dao.mapper")

View File

@@ -0,0 +1,20 @@
package com.lld.im.service.taskScheduler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class SRSStreamTask {
@Scheduled(cron="0/5 * * * * ? ")
public void executeTask(){
String ip = System.getenv("SRS_HOST");
log.error("213132");
log.info("========定时任务");
}
}

View File

@@ -1,3 +1,3 @@
spring: spring:
profiles: profiles:
active: dev active: prod

View File

@@ -14,13 +14,13 @@
// #endif // #endif
export default { export default {
onLaunch: function() { onLaunch: function() {
localStorage.setItem("appId",10000)
appInit(500).then((res)=>{ appInit(500).then((res)=>{
console.log("获取到token创建长链接") console.log("获取到token创建长链接")
console.log(this.$socketTask.socketTask) this.$store.dispatch('getAddressList');
setTimeout(()=>{ setTimeout(()=>{
this.$socketTask.connectSocket() this.$socketTask.connectSocket()
},500) },2500)
}).then((error)=>{ }).then((error)=>{
console.log("未获取到IM的token") console.log("未获取到IM的token")
}) })

View File

@@ -1,5 +1,5 @@
export default class config{ export default class config{
static prod="online" static prod="online_not"
static getZnzqApiUrl(){ static getZnzqApiUrl(){
if(process.env.NODE_ENV === 'development' ){ if(process.env.NODE_ENV === 'development' ){
return 'http://work.ii999.live:19002/znzq' return 'http://work.ii999.live:19002/znzq'
@@ -7,7 +7,7 @@ export default class config{
if(this.prod=="online"){ if(this.prod=="online"){
return 'http://work.ii999.live:19002/znzq' return 'http://work.ii999.live:19002/znzq'
}else{ }else{
return 'http://172.16.2.3:19000/znzq' return '/znzq'
} }
} }
} }
@@ -24,12 +24,12 @@ export default class config{
} }
static getVideoRoomUrl(room,userid,isPublish=0,isPlayer=1){ static getVideoRoomUrl(room,userid,isPublish=0,isPlayer=1){
if(process.env.NODE_ENV === 'development' ){ if(process.env.NODE_ENV === 'development' ){
return `http://localhost:8080/hd-glasses-app/#/call_room?isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}` return `http://localhost:8080/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
}else{ }else{
if(this.prod=="online"){ if(this.prod=="online"){
return `https://119.45.242.222/hd-glasses-app/#/call_room?isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}` return `https://119.45.242.222/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
}else{ }else{
return `https://172.16.3.19/hd-glasses-app/#/call_room?isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}` return `https://172.16.3.19/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}`
} }
} }
} }

View File

@@ -3,6 +3,8 @@ import browser from '@/common/browser'
import store from '../store' import store from '../store'
import pinyin from '@/common/pinyin.js'; import pinyin from '@/common/pinyin.js';
import dayjs from "dayjs" import dayjs from "dayjs"
import localForage from 'localforage';
export default { export default {
// 获取字典 // 获取字典
@@ -999,6 +1001,15 @@ export default {
formatMessage(msg){ formatMessage(msg){
msg.pushType="MSG" msg.pushType="MSG"
var msgType="TEXT" var msgType="TEXT"
var data = store.state.addressList
const fromUserData=data.find(item=>item.userId==msg.fromId)
console.log("*****************查找到通讯录中的数据*****************")
console.log("*****************查找到通讯录中的数据*****************")
console.log("*****************查找到通讯录中的数据*****************")
console.log(fromUserData)
const _data=JSON.parse(msg.messageBody) const _data=JSON.parse(msg.messageBody)
// try{ // try{
// console.log("=======================formatMessage") // console.log("=======================formatMessage")
@@ -1022,7 +1033,7 @@ export default {
msg.fromInfo={ msg.fromInfo={
userId:msg.fromId, userId:msg.fromId,
userType:1, userType:1,
nickName:msg.fromId, nickName:fromUserData?fromUserData.realname:msg.fromId,
portrait:"https://shudong2022.oss-cn-hangzhou.aliyuncs.com/common/user/logo.png" portrait:"https://shudong2022.oss-cn-hangzhou.aliyuncs.com/common/user/logo.png"
}; };
msg.groupInfo={}; msg.groupInfo={};

View File

@@ -2,17 +2,22 @@ import config from "@/common/config.js"
let timer = null let timer = null
let retimer = null let retimer = null
import store from '../store' import store from '../store'
import * as sdk from "@/common/imSdk/lim-sdk.js"; import * as sdk from "@/common/imSdk/lim-sdk.js";
import lim from "@/common/imSdk/sdk-bridge.js"; import lim from "@/common/imSdk/sdk-bridge.js";
import publicFc from '@/common/publicFc'; import publicFc from '@/common/publicFc';
import localForage from 'localforage';
export default { export default {
socketTask: null, socketTask: null,
// 连接WebSocket // 连接WebSocket
connectSocket() { connectSocket() {
const ListenerMap = { const ListenerMap = {
onSocketConnectEvent: (option, status, data) => { onSocketConnectEvent: (option, status, data) => {
console.log("已建立连接:" + JSON.stringify(status)); console.log("已建立连接:" + JSON.stringify(status));
@@ -39,7 +44,7 @@ export default {
const _data = publicFc.formatMessage(msg) const _data = publicFc.formatMessage(msg)
uni.$emit('onP2PMessage', _data); uni.$emit('onP2PMessage', _data);
store.dispatch('onP2PMessage', _data) store.dispatch('onP2PMessage', _data)
},500) },2000)
}) })
} }
}, 2000); }, 2000);

View File

@@ -22,27 +22,31 @@ export function appInit(ms) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var i = 0; var i = 0;
let timer = setInterval(() => { let timer = setInterval(() => {
var im_imUserSign = localStorage.getItem("im_imUserSign") var im_imUserSign = uni.getStorageSync("im_imUserSign")
var im_userId = localStorage.getItem("im_userId") var hd_userId = uni.getStorageSync("hd_userid")
if(hd_userId){
uni.setStorageSync("userId",hd_userId)
}else{
console.log("============未获取到hd_userid")
}
var hd_token = localStorage.getItem("hd_token") var hd_token = localStorage.getItem("hd_token")
i = i + 1; i = 100;
if (i > 30) { if (i < 0) {
reject("error") reject("error")
} }
if (im_imUserSign) { if (im_imUserSign) {
localStorage.setItem("imUserSign",im_imUserSign) uni.setStorageSync("imUserSign",im_imUserSign)
localStorage.setItem("appId",10000) uni.setStorageSync("token",hd_token)
localStorage.setItem("token",hd_token)
if(im_userId){ if(uni.getStorageSync("userId")!=null&&uni.getStorageSync("imUserSign")!=null&&uni.getStorageSync("token")!=null){
localStorage.setItem("userId",im_userId)
}
clearInterval(timer) clearInterval(timer)
timer = null timer = null
resolve("ok") resolve("ok")
} }
}
}, ms); }, ms);
}) })
} }

View File

@@ -167,7 +167,8 @@ export default {
break; break;
case 'chooseMedia': case 'chooseMedia':
uni.showActionSheet({ uni.showActionSheet({
itemList: ['图片', '视频'], itemList: ['图片'],
// itemList: ['图片', '视频'],
success: (res) => { success: (res) => {
switch (res.tapIndex){ switch (res.tapIndex){
case 0: case 0:

View File

@@ -1,9 +1,9 @@
import http from '@/common/request'; import http from '@/common/request';
import publicFc from '@/common/publicFc'; import publicFc from '@/common/publicFc';
import customHttp from "@/common/customHttp.js"
import * as sdk from "@/common/imSdk/lim-sdk.js"; import * as sdk from "@/common/imSdk/lim-sdk.js";
import lim from "@/common/imSdk/sdk-bridge.js"; import lim from "@/common/imSdk/sdk-bridge.js";
import localForage from 'localforage';
const _im = lim.lim.im const _im = lim.lim.im
function sortBy(field) { function sortBy(field) {
@@ -37,7 +37,8 @@ const store = new Vuex.Store({
chatDataUserId: '', chatDataUserId: '',
topicReply: {}, topicReply: {},
topicRed: {}, topicRed: {},
friendApply: {} friendApply: {},
addressList:[],
}, },
mutations: { mutations: {
update_UserInfo(state, data) { //个人信息 update_UserInfo(state, data) { //个人信息
@@ -60,6 +61,10 @@ const store = new Vuex.Store({
update_friendApply(state, data) { update_friendApply(state, data) {
state.friendApply = data state.friendApply = data
uni.setStorageSync('friendApply', JSON.stringify(data)); uni.setStorageSync('friendApply', JSON.stringify(data));
},
update_addressList(state,data){
state.addressList=data;
localForage.setItem("addressList",data)
} }
}, },
actions: { actions: {
@@ -347,6 +352,27 @@ const store = new Vuex.Store({
}, },
createChat(context, data) { createChat(context, data) {
},
getAddressList(context){
//获取通讯录,存储通讯录数据到本地
customHttp.customHttp.get('/api/im/app/addressList', {
params: {}, /* 会加在url上 */
header: {}, /* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: {target: "znzq"} , // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
}).then(res => {
console.log("=========获取到数据")
console.log(res)
if(res.statusCode==200){
if(res.data.code==200){
var records=res.data.result.records
context.state.addressList = records
}
}
}).catch(err => {
})
} }
} }
}) })

View File

@@ -157,7 +157,7 @@
params: {}, params: {},
/* 会加在url上 */ /* 会加在url上 */
header: {}, header: {},
/* 会与全局header合并如有同名属性局部覆盖全局 */ /* 会与全局header合并如有同名属性WW部覆盖全局 */
dataType: 'json', dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部) // 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: { custom: {

View File

@@ -23,7 +23,6 @@
<script> <script>
export default { export default {
data() { data() {
return { return {