diff --git a/hd-glasses-app/.env.dev b/hd-glasses-app/.env.dev index 2a5e5d6..9d828d2 100644 --- a/hd-glasses-app/.env.dev +++ b/hd-glasses-app/.env.dev @@ -1,9 +1,7 @@ VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver' VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d' VUE_APP_API="http://work.ii999.live:19002/znzq" - -VUE_APP_STATIC_FILE_Prefix='https://119.45.242.222/static_file/' - +VUE_APP_STATIC_FILE_Prefix='//119.45.242.222/static_file' VUE_APP_SRS_URL='webrtc://119.45.242.222/' VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1' diff --git a/hd-glasses-app/.env.hd b/hd-glasses-app/.env.hd new file mode 100644 index 0000000..f6d81e4 --- /dev/null +++ b/hd-glasses-app/.env.hd @@ -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' diff --git a/hd-glasses-app/.env.prod b/hd-glasses-app/.env.prod index a6ed255..f6d81e4 100644 --- a/hd-glasses-app/.env.prod +++ b/hd-glasses-app/.env.prod @@ -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_API="http://172.16.2.3:19000/znzq" -VUE_APP_STATIC_FILE_Prefix='https://172.16.3.19/static_file' +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' diff --git a/hd-glasses-app/package.json b/hd-glasses-app/package.json index e9649f7..7e3e7c3 100644 --- a/hd-glasses-app/package.json +++ b/hd-glasses-app/package.json @@ -5,8 +5,8 @@ "scripts": { "local-server": "vue-cli-service serve --mode local", "serve": "vue-cli-service serve --mode dev", - "prod-serve": "vue-cli-service serve --mode prod", - "build": "vue-cli-service build --mode prod", + "prod-serve": "vue-cli-service serve --mode hd", + "build:hd": "vue-cli-service build --mode hd", "build:online": "vue-cli-service build --mode dev", "lint": "vue-cli-service lint" }, diff --git a/hd-glasses-app/public/srs/srs.sdk.js b/hd-glasses-app/public/srs/srs.sdk.js index 1821ecf..a457ca6 100644 --- a/hd-glasses-app/public/srs/srs.sdk.js +++ b/hd-glasses-app/public/srs/srs.sdk.js @@ -124,8 +124,8 @@ function SrsRtcPublisherAsync() { // @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack stream.getTracks().forEach(function (track) { - console.log("获取到一个流") - console.log(track.kind); + // console.log("获取到一个流") + // console.log(track.kind); self.pc.addTrack(track); // Notify about local track when stream is ok. diff --git a/hd-glasses-app/src/assets/map/hongqi.png b/hd-glasses-app/src/assets/map/hongqi.png new file mode 100644 index 0000000..cf8caf0 Binary files /dev/null and b/hd-glasses-app/src/assets/map/hongqi.png differ diff --git a/hd-glasses-app/src/pages/call_room.vue b/hd-glasses-app/src/pages/call_room.vue index 8b53e25..5300b80 100644 --- a/hd-glasses-app/src/pages/call_room.vue +++ b/hd-glasses-app/src/pages/call_room.vue @@ -6,7 +6,8 @@
@@ -27,11 +28,11 @@ - -
-
+
+
-
+
+
@@ -82,18 +83,24 @@ export default { cameraImg: "", switchCameraImg: "", callDwonImg: "", - showConfirmDialog:0, - inviteName:0, + showConfirmDialog: 0, + inviteName: 0, + showInviteConfirmDialog: 0, }; }, mounted() { + console.log(location.href) + console.log(location.href) + console.log(location.href) + this.isPublish = this.$route.query.isPublish; this.isPlayer = this.$route.query.isPlayer; this.uid = this.$route.query.uid; this.roomId = this.$route.query.room; - this.inviteName = this.$route.query.inviteName||''; + this.inviteName = this.$route.query.inviteName || ''; this.topVideo = this.uid; this.showConfirmDialog = this.$route.query.showConfirmDialog; + this.showInviteConfirmDialog = this.$route.query.showInviteConfirmDialog; this.voiceImg = getStatisFileUrl("/media/voice_open.png") @@ -101,7 +108,12 @@ export default { this.switchCameraImg = getStatisFileUrl("/media/switch.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({ title: '是否接受?', message: `${this.inviteName}邀请你加入视频聊天`, @@ -114,7 +126,20 @@ export default { location.href = "uniwebview://action?function=refuseVideoInvite"; // 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(); } @@ -126,11 +151,18 @@ export default { this.leaveRoom(); }, methods: { - init(){ + init() { + Notify({ + message: '如视频不能播放,请点击视频列表中对应的用户上方的小视频', + duration: 10000, + type: 'primary' + }); + if (this.isPublish == 1) { this.beginPublish() } if (this.isPlayer == 1) { + this.getRoomVideoList(); this.roomTimer = setInterval(() => { this.getRoomVideoList(); }, 2000) @@ -147,33 +179,31 @@ export default { //如果声音是开启状态 if (!this.isCloseVoice) { // 关闭声音 - this.isCloseVoice=true + this.isCloseVoice = true this.voiceImg = getStatisFileUrl("/media/voice_close.png") - }else { + } else { // 打开声音 - this.isCloseVoice=false; + this.isCloseVoice = false; this.constraints.audio = true this.voiceImg = getStatisFileUrl("/media/voice_open.png") } - console.log(this.isCloseVoice) - console.log(this.voiceImg) this.beginPublish() }, closeCamera() { this.constraints.video = false; //如果视频是开启状态 if (!this.isCloseCamera) { - this.constraints.video=false - this.isCloseCamera=true + this.constraints.video = false + this.isCloseCamera = true this.cameraImg = getStatisFileUrl("/media/camera_close.png") - }else { + } else { let deviceId = { exact: "" } deviceId.exact = this.cameraDevices[this.cameraIndex].deviceId this.constraints.video = {} this.constraints.video.deviceId = deviceId - this.isCloseCamera=false + this.isCloseCamera = false this.cameraImg = getStatisFileUrl("/media/camera_open.png") } this.beginPublish() @@ -257,6 +287,7 @@ export default { }, playVideo(publishId = "", url = "") { + let _this = this; let sdk = null; let video = null; // const _key=`${}` @@ -286,6 +317,7 @@ export default { const topVideo = this.$refs.videoStreamtopVideo topVideo.srcObject = sdk.stream; topVideo.onloadedmetadata = function (e) { + topVideo.volume = 0 topVideo.play(); }; } @@ -293,7 +325,9 @@ export default { video.srcObject = sdk.stream; video.onloadedmetadata = function (e) { - video.play(); + if (publishId == _this.uid) + video.volume = 0 + video.play(); }; // $('#rtc_media_player').prop('srcObject', sdk.stream); @@ -393,6 +427,8 @@ export default { videoClickAction(publishId) { this.topVideo = publishId; var video = eval('this.$refs.videoStream' + publishId)[0] + video.play(); + console.log(video.srcObject) this.$refs.videoStreamtopVideo.srcObject = video.srcObject; }, @@ -407,13 +443,15 @@ export default { } }, - videoDownAction(){ + videoDownAction() { location.href = "uniwebview://action?function=restartCamera"; - if(this.showConfirmDialog==1){ - location.href = "uniwebview://action?function=restartCamera"; - }else { - - } + this.publishSdk.close(); + if (this.showConfirmDialog == 1) { + console.log("挂断视频") + location.href = "uniwebview://action?function=refuseVideoInvite"; + } else { + window.history.go(-1); + } } } } @@ -421,8 +459,8 @@ export default { diff --git a/hd-glasses-app/src/pages/hd_map.vue b/hd-glasses-app/src/pages/hd_map.vue index 8a6ed4f..3ebf9f5 100644 --- a/hd-glasses-app/src/pages/hd_map.vue +++ b/hd-glasses-app/src/pages/hd_map.vue @@ -61,6 +61,7 @@ import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; import {appInit, getStatisFileUrl} from "../utils/publicFun"; + export default { data() { return { @@ -125,9 +126,17 @@ export default { }; }, mounted() { + console.log(location.href) + this.page = this.$route.query.page; this.pageType = this.$route.query.type; + this.token = this.$route.query.token || ""; + if (this.token > 10) { + localStorage.setItem("hd_token", this.token) + } + + setInterval(() => { let hd_gps_location = localStorage.getItem("hd_gps_location") if (hd_gps_location) { @@ -342,7 +351,7 @@ export default { type: "featureMove", geometry: geometryMove, }); - this.planningVectorLayer.set('id', 'planningVectorLayer'); + // this.planningVectorLayer.set('id', 'planningVectorLayer'); //先清空 再清除 this.map.removeLayer(this.planningVectorLayer) this.planningVectorLayer = new VectorLayer({ @@ -375,7 +384,7 @@ export default { * 根据经纬度坐标添加摄像头要素 */ addPoints(coordinate) { - + console.log("点击触发addPoints") if (this.selectPoint.length > 0) { this.coordinate = [] this.map.removeLayer(this.pointLayer); @@ -591,9 +600,12 @@ export default { service.get(`/api/alarm/list`, { params: { - sendStatus: 1, + sendStatus: "1", + disposition: "0", pageNo: 1, - pageSize: 50 + pageSize: 50, + column: "createTime", + order: "desc", } }).then((res) => { if (res.status == 200) { @@ -601,11 +613,11 @@ export default { this.alarmAnimation = null this.map.removeLayer(this.alarmLayer) this.alarmLayer = {}; - res.data.result.records.map(record => { + res.data.result.records.map((record, index) => { try { if (record.location != null) { - this.addPointWidthCoordinate(record.location, "alarm", record) + this.addPointWidthCoordinate(record.location, "alarm", record, index + 1) } } catch (e) { console.error(e) @@ -618,14 +630,14 @@ export default { switchFullScreen() { location.href = "uniwebview://action?function=switchBigScreen" }, - addPointWidthCoordinate(coordinate, type, record) { + addPointWidthCoordinate(coordinate, type, record, _index = 0) { coordinate = coordinate.split(",") coordinate = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857'); // console.log("================addPointWidthCoordinate",coordinate) - + // 告警相关 if (type == 'alarm') { if (Object.keys(this.alarmLayer).length == 0) { // 创建图层 @@ -641,61 +653,83 @@ export default { }, 900); } + const feature = new Feature({ geometry: new Point(coordinate), data: record, type: 'alarm' }); - // 设置要素的图标 - feature.setStyle( - new Style({ - // 设置图片效果 - image: new Icon({ - src: getStatisFileUrl("/map/icon_paishuibeng_h.png"), - // anchor: [0.5, 0.5], - scale: 0.4, - }), - }) - ); - // 要素添加到地图图层上 - this.alarmLayer.getSource().addFeature(feature); - - } - if (type == 'equipment') { - if (Object.keys(this.equipmentLayer).length == 0) { - // 创建图层 - this.equipmentLayer = new VectorLayer({ - source: new VectorSource(), - }); - // 图层添加到地图上 - this.map.addLayer(this.equipmentLayer); - } - if (record.isOnline == "true") { - const feature = new Feature({ - geometry: new Point(coordinate), - data: record, - type: 'equipment' - }); + const alarmCategory_dictText=record.alarmCategory_dictText||"未知类型" + //临时智慧所,小红旗 + if (record.alarmCategory == "1706273001850601474") { // 设置要素的图标 feature.setStyle( new Style({ // 设置图片效果 image: new Icon({ - src: getStatisFileUrl("/map/Group_29@2x.png"), - // anchor: [0.5, 0.5], - scale: 0.4, + 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( + new Style({ + // 设置图片效果 + image: new Icon({ + src: getStatisFileUrl("/map/icon_paishuibeng_h.png"), + anchor: [0.5, 0.5], + 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.equipmentLayer.getSource().addFeature(feature); } - if (record.isOnline == "false") { - const feature = new Feature({ - geometry: new Point(coordinate), - data: record, - type: 'equipment' + + // 要素添加到地图图层上 + this.alarmLayer.getSource().addFeature(feature); + console.log("===============结束告警点位添加") + + } + //设备相关 + 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) { + // 创建图层 + this.equipmentLayer = new VectorLayer({ + source: new VectorSource(), }); + this.map.addLayer(this.equipmentLayer); + } + // 设备离线 设置样式 + if (record.isOnline == "false") { // 设置要素的图标 feature.setStyle( new Style({ @@ -707,33 +741,48 @@ export default { }), }) ); - // 要素添加到地图图层上 - this.equipmentLayer.getSource().addFeature(feature); } - if (record.isAlarm == false) { - const feature = new Feature({ - geometry: new Point(coordinate), - data: record, - type: 'equipment' - }); - // 设置要素的图标 - feature.setStyle( - new Style({ - // 设置图片效果 - image: new Icon({ - src: getStatisFileUrl("/map/Group_190514@2x.png"), - // anchor: [0.5, 0.5], - scale: 0.4, - }), - }) - ); - feature.on("click", (event) => { - console.log("告警图标被点击") - console.log(event) - }) - // 要素添加到地图图层上 - this.equipmentLayer.getSource().addFeature(feature); + + + if (record.isOnline == "true") { + // 未接受告警数量为0,全部都接受 绿色 + if(alarmNum==0){ + feature.setStyle( + new Style({ + // 设置图片效果 + image: new Icon({ + src: getStatisFileUrl("/map/Group_190514@2x.png"), + // anchor: [0.5, 0.5], + scale: 0.4, + }), + }) + ); + } + 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); - service.get(`/api/patrol/area/list`, { - - }).then((res) => { + service.get(`/api/patrol/area/list`, {}).then((res) => { if (res.status == 200) { console.log(res.data.result.records) - res.data.result.records.map((record) =>{ + res.data.result.records.map((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) - areaList=areaList[0] + areaList = areaList[0] console.log(areaList) const tempGeometryList = [] @@ -837,7 +884,7 @@ export default { tempGeometryList.push(tempGeometryList[0]) - const _list=[tempGeometryList] + const _list = [tempGeometryList] console.log(_list) @@ -847,7 +894,7 @@ export default { const polygonFeature = new Feature({ geometry: polygonGeometry, - name:title + name: title }) polygonFeature.setStyle(new Style({ @@ -859,10 +906,10 @@ export default { color: 'rgba(255,255,0,0.1)' }), text: new Text({ - testAlign:'center', - text:title, - font:'bold 20px 微软雅黑', - fill:new Fill({ + testAlign: 'center', + text: title, + font: 'bold 20px 微软雅黑', + fill: new Fill({ color: '#ffa502', }) }) @@ -992,7 +1039,7 @@ export default { display: flex; flex-direction: column; justify-content: flex-end; - font-size: 14px; + font-size: 18px !important; padding-top: 50px; .alarmDetailsBox { diff --git a/hd-glasses-app/src/pages/hd_map_area.vue b/hd-glasses-app/src/pages/hd_map_area.vue index c997dfb..fea3e73 100644 --- a/hd-glasses-app/src/pages/hd_map_area.vue +++ b/hd-glasses-app/src/pages/hd_map_area.vue @@ -59,7 +59,7 @@ import * as interaction from 'ol/interaction'; // 交互 import {OL as ol} from "plot-ol/plottingol"; import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; -import {appInit, getStatisFileUrl} from "../utils/publicFun"; +import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun"; export default { data() { @@ -125,8 +125,12 @@ export default { }; }, mounted() { - this.page = this.$route.query.page; - this.pageType = this.$route.query.type; + this.page = this.$route.query.page||getUrlParam("page"); + this.pageType = this.$route.query.type||getUrlParam("type"); + + this.token = this.$route.query.token ||getUrlParam("token"); + localStorage.setItem("hd_token", this.token) + setInterval(() => { let hd_gps_location = localStorage.getItem("hd_gps_location") diff --git a/hd-glasses-app/src/pages/hd_show_equipment_move_history.vue b/hd-glasses-app/src/pages/hd_show_equipment_move_history.vue index d18d031..8674452 100644 --- a/hd-glasses-app/src/pages/hd_show_equipment_move_history.vue +++ b/hd-glasses-app/src/pages/hd_show_equipment_move_history.vue @@ -85,7 +85,9 @@ import * as interaction from 'ol/interaction'; // 交互 import {OL as ol} from "plot-ol/plottingol"; import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; -import {appInit, getStatisFileUrl} from "../utils/publicFun"; +import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun"; + + import dayjs from "dayjs" export default { @@ -99,6 +101,7 @@ export default { pointLayer: {}, canAddPoints: false, coordinate: [], + routeOriginList: [], 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]]), geometryMove: {}, @@ -117,6 +120,26 @@ export default { 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({ image: new Circle({ radius: 7, @@ -126,6 +149,12 @@ export default { width: 2, }), }), + text: new Text({ + font: '16px Arial', + testAlign: 'left', + offsetX: 90, + offsetY: 1, + }) }), }, vectorLayer: {}, @@ -153,14 +182,22 @@ export default { planningVectorLayer: {}, parentPostMessageData: [], isCanDraw: true, - moveUserId: "" + moveUserId: "", + moveIndex: 0, + pointMoveTimer:null, }; }, mounted() { - this.page = this.$route.query.page; - this.pageType = this.$route.query.type; - this.equipmentId = this.$route.query.equipmentId; - this.moveUserId = this.$route.query.uerId; + console.log(location.href) + this.page = this.$route.query.page||getUrlParam("page"); + this.pageType = this.$route.query.type||getUrlParam("type"); + 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(() => { 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 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]}` @@ -380,7 +416,8 @@ export default { type: "featureMove", geometry: geometryMove, }); - this.planningVectorLayer.set('id', 'planningVectorLayer'); + + // this.planningVectorLayer.set('id', 'planningVectorLayer'); //先清空 再清除 this.map.removeLayer(this.planningVectorLayer) this.planningVectorLayer = new VectorLayer({ @@ -488,19 +525,71 @@ export default { ); 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(); + }, + 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() { - this.lastTime = Date.now(); - this.vectorLayer.on("postrender", this.moveFeature); - this.featureMove.setGeometry(null); //必须用null,不能用{} + this.pointMoveTimer=setInterval(()=>{ + this.moveIndex = this.moveIndex + 30 + + 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() { this.featureMove.setGeometry(this.geometryMove); - this.vectorLayer.un("postrender", this.moveFeature); + this.vectorLayer.un("postrender", this.moveFeatureByCoordinate); }, addAlarmPointNextAction() { if (this.selectPoint.length == 0) { @@ -809,7 +898,7 @@ export default { const tempGeometryList = [] 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) @@ -910,56 +999,106 @@ export default { this.drawPlanningPathLayer.getSource().addFeature(polygonFeature) }, showMoveHistory() { - // 矢量地图源 - let vectorSource = new VectorSource(); - // 矢量地图 - 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')) + if(this.pointMoveTimer!=null){ + clearTimeout(this.pointMoveTimer) + this.pointMoveTimer=null; + } service.get(`/sys/equipment/trajectory`, { params: { uerId: this.moveUserId, equipmentId: this.equipmentId, - startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'), - endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'), - pageSize:1000 + startTime: dayjs(this.startDate).format('YYYY-MM-DD HH:mm'), + endTime: dayjs(this.endDate).format('YYYY-MM-DD HH:mm'), + pageSize: 2000, + // column: "createTime", + // order: "asc" } }).then((res) => { if (res.status == 200) { - this.showendDate=false - this.showstartDate=false - const _list=[] - res.data.result.records.map((record,index) => { - if(index==0){ - const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857') - this.map.getView().animate({ - center:startPoint, - duration:1000, - zoom:18 - }) + + this.showendDate = false + this.showstartDate = false + const _list = [] + + 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({ + center: startPoint, + duration: 1000, + 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.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) { console.log(dayjs(value)) @@ -967,15 +1106,15 @@ export default { console.log(this.startDate) if (dayjs(value).isBefore(dayjs(this.startDate))) { console.log("结束时间早于开始时间") - Notify({ type: 'warning', message: '结束时间不可早于开始时间' }); + Notify({type: 'warning', message: '结束时间不可早于开始时间'}); } else { console.log("开始时间早于结束时间") this.endDate = dayjs(value).toDate() console.log("打印结束时间") console.log(this.endDate) - setTimeout(()=>{ + setTimeout(() => { this.showMoveHistory() - },1000) + }, 1000) } }, @@ -985,12 +1124,12 @@ export default { console.log(this.endDate) if (dayjs(value).isBefore(dayjs(this.endDate))) { this.startDate = dayjs(value).toDate() - setTimeout(()=>{ + setTimeout(() => { this.showMoveHistory() - },1000) + }, 1000) console.log("开始时间早于结束时间") } else { - Notify({ type: 'warning', message: '开始时间不可晚于结束时间' }); + Notify({type: 'warning', message: '开始时间不可晚于结束时间'}); console.log("结束时间早于开始时间") } } diff --git a/hd-glasses-app/src/pages/hd_show_patrolTmp_history.vue b/hd-glasses-app/src/pages/hd_show_patrolTmp_history.vue index 3eb31dc..f07cf4c 100644 --- a/hd-glasses-app/src/pages/hd_show_patrolTmp_history.vue +++ b/hd-glasses-app/src/pages/hd_show_patrolTmp_history.vue @@ -78,9 +78,8 @@ import * as interaction from 'ol/interaction'; // 交互 import {OL as ol} from "plot-ol/plottingol"; import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; -import {appInit, getStatisFileUrl} from "../utils/publicFun"; +import {appInit, getStatisFileUrl,getUrlParam} from "../utils/publicFun"; import dayjs from "dayjs" - export default { data() { return { @@ -151,11 +150,17 @@ export default { }; }, mounted() { - this.page = this.$route.query.page; - this.pageType = this.$route.query.type; - this.equipmentId = this.$route.query.equipmentId; - this.moveUserId = this.$route.query.uerId; - this.workOrderNo = this.$route.query.workOrderNo||''; + console.log(location.href) + + this.page = this.$route.query.page||getUrlParam("page"); + this.pageType = this.$route.query.type||getUrlParam("type"); + 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(() => { let hd_gps_location = localStorage.getItem("hd_gps_location") diff --git a/hd-glasses-app/src/pages/hd_show_patrol_history.vue b/hd-glasses-app/src/pages/hd_show_patrol_history.vue index 49683bc..b6d6b02 100644 --- a/hd-glasses-app/src/pages/hd_show_patrol_history.vue +++ b/hd-glasses-app/src/pages/hd_show_patrol_history.vue @@ -63,7 +63,7 @@ import * as interaction from 'ol/interaction'; // 交互 import {OL as ol} from "plot-ol/plottingol"; import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; -import {appInit, getStatisFileUrl} from "../utils/publicFun"; +import {appInit, getStatisFileUrl,GetQueryString,getUrlParam} from "../utils/publicFun"; import dayjs from "dayjs" export default { @@ -77,6 +77,7 @@ export default { pointLayer: {}, canAddPoints: false, coordinate: [], + routeOriginList: [], 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]]), geometryMove: {}, @@ -85,7 +86,7 @@ export default { route: new Style({ stroke: new Stroke({ width: 6, - color: [237, 212, 0, 0.8], + color: "rgb(255, 77, 54)", }), }), icon: new Style({ @@ -95,6 +96,26 @@ export default { 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({ image: new Circle({ radius: 7, @@ -104,10 +125,17 @@ export default { width: 2, }), }), + text: new Text({ + font: '16px Arial', + testAlign: 'left', + offsetX: 90, + offsetY: 1, + }) }), }, vectorLayer: {}, distance: 0, + onceDistance:5, lastTime: 0, speed: 0.1, page: null, @@ -132,15 +160,32 @@ export default { parentPostMessageData: [], isCanDraw: true, moveUserId: "", - patrolInstanceId: "" + patrolInstanceId: "", + moveIndex: 0, + pointMoveTimer:null, + mapZoom:15 }; }, mounted() { - this.page = this.$route.query.page; - this.pageType = this.$route.query.type; - this.patrolInstanceId = this.$route.query.patrolInstanceId||'1717873511875563522'; - this.equipmentId = this.$route.query.equipmentId; - this.moveUserId = this.$route.query.uerId; + console.log(location.href) + + this.page = this.$route.query.page||getUrlParam("page"); + this.pageType = this.$route.query.type||getUrlParam("type"); + 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(() => { let hd_gps_location = localStorage.getItem("hd_gps_location") @@ -289,7 +334,7 @@ export default { view: new View({ projection: "EPSG:3857", center: [12497018.585823221, 2476783.2447665134], - zoom: 15, + zoom: this.mapZoom, }), }); this.map.on('singleclick', e => { @@ -474,14 +519,48 @@ export default { this.map.render(); }, startAnimation() { - this.lastTime = Date.now(); - this.vectorLayer.on("postrender", this.moveFeature); - this.featureMove.setGeometry(null); //必须用null,不能用{} - }, + this.pointMoveTimer=setInterval(()=>{ + 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() { this.featureMove.setGeometry(this.geometryMove); - this.vectorLayer.un("postrender", this.moveFeature); + this.vectorLayer.un("postrender", this.moveFeatureByCoordinate); }, addAlarmPointNextAction() { if (this.selectPoint.length == 0) { @@ -914,7 +993,6 @@ export default { service.get(`/sys/equipment/trajectory`, { params: { uerId: this.moveUserId, - equipmentId: this.equipmentId, startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'), endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'), pageSize:1000 @@ -930,7 +1008,7 @@ export default { this.map.getView().animate({ center:startPoint, duration:1000, - zoom:18 + zoom:this.mapZoom }) } _list.push(record.location.split(",")) @@ -1006,7 +1084,7 @@ export default { this.map.getView().animate({ center:startPoint, duration:1000, - zoom:18 + zoom:this.mapZoom }) this.drawPcPostMessageDataLayer(longitudeLatitude,"planPathLine") @@ -1020,10 +1098,23 @@ export default { }, 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`, { params: { uerId: this.moveUserId, - equipmentId: this.equipmentId, startTime:startTime, endTime:endTime, pageSize:1000 @@ -1033,24 +1124,84 @@ export default { this.showendDate=false this.showstartDate=false const _list=[] - res.data.result.records.map((record,index) => { + + 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({ center:startPoint, 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.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(); + } }, diff --git a/hd-glasses-app/src/pages/map.vue b/hd-glasses-app/src/pages/map.vue index cc3f090..96cd262 100644 --- a/hd-glasses-app/src/pages/map.vue +++ b/hd-glasses-app/src/pages/map.vue @@ -120,7 +120,6 @@ export default { geometry: this.geometryMove, }); - console.log(this.route) this.vectorLayer = new VectorLayer({ source: new VectorSource({ @@ -163,7 +162,7 @@ export default { }), }); - // this.map.addLayer(this.vectorLayer); + this.map.addLayer(this.vectorLayer); }, /** * 点击地图添加摄像头要素 diff --git a/hd-glasses-app/src/pages/map_test.vue b/hd-glasses-app/src/pages/map_test.vue new file mode 100644 index 0000000..1e1f35b --- /dev/null +++ b/hd-glasses-app/src/pages/map_test.vue @@ -0,0 +1,1407 @@ + + + + + diff --git a/hd-glasses-app/src/router/index.js b/hd-glasses-app/src/router/index.js index ea4cb12..da7f2f3 100644 --- a/hd-glasses-app/src/router/index.js +++ b/hd-glasses-app/src/router/index.js @@ -40,6 +40,10 @@ const router = new Router({ path: '/hd_show_patrolTmp_history', name: 'hd_show_patrolTmp_history', component: () => import('../pages/hd_show_patrolTmp_history.vue') + },{ + path: '/map_test', + name: 'map_test', + component: () => import('../pages/map_test.vue') } ] }); diff --git a/hd-glasses-app/src/utils/publicFun.js b/hd-glasses-app/src/utils/publicFun.js index 2397e3c..8d180e9 100644 --- a/hd-glasses-app/src/utils/publicFun.js +++ b/hd-glasses-app/src/utils/publicFun.js @@ -1,6 +1,8 @@ - export function getStatisFileUrl(file){ - return process.env.VUE_APP_STATIC_FILE_Prefix+file - } +export function getStatisFileUrl(file) { + var protocol = location.protocol + const _url = protocol + process.env.VUE_APP_STATIC_FILE_Prefix + file + return _url +} /** * getUrlKey 截取地址栏参数 @@ -9,7 +11,7 @@ */ export function getUrlParam(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]; console.log(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) { return new Promise((resolve, reject) => { - var i = 0; + var i = 1000; let timer = setInterval(() => { var hd_token = localStorage.getItem("hd_token") // var im_userId = localStorage.getItem("im_userId") - i = i + 1; - if (i > 10) { + if (i < 10) { reject("error") } if (hd_token) { diff --git a/hs-im-server/build/docker-compose.yml b/hs-im-server/build/docker-compose.yml index 82e7745..bb16ac3 100644 --- a/hs-im-server/build/docker-compose.yml +++ b/hs-im-server/build/docker-compose.yml @@ -20,14 +20,16 @@ services: LANG: en_US.UTF-8 LC_ALL: en_US.UTF-8 TZ: Asia/Shanghai + IM_HOST: 172.16.3.19 container_name: im-tcp volumes: - ./:/hd-znzq/config - ./:/hd-znzq/system - ports: - - 29001:29001 - - 29000:29000 - command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar /hd-znzq/config/hd_1.yml + network_mode: host +# ports: +# - 29001:29001 +# - 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: image: 172.16.2.1:8083/java:8_server-jre_unlimited restart: always @@ -39,8 +41,9 @@ services: container_name: im-message-store volumes: - ./:/hd-znzq/system - ports: - - 8990:8990 +# ports: +# - 8990:8990 + network_mode: host command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-message-store-1.0.0-SNAPSHOT.jar im-service: image: 172.16.2.1:8083/java:8_server-jre_unlimited @@ -50,11 +53,13 @@ services: LANG: en_US.UTF-8 LC_ALL: en_US.UTF-8 TZ: Asia/Shanghai + SRS_HOST: 172.16.3.19 container_name: im-service volumes: - ./:/hd-znzq/system ports: - 28000:28000 +# network_mode: host command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar app-service: image: 172.16.2.1:8083/java:8_server-jre_unlimited diff --git a/hs-im-server/build/hd_1.yml b/hs-im-server/build/hd_1.yml index 265ff84..54c34e0 100644 --- a/hs-im-server/build/hd_1.yml +++ b/hs-im-server/build/hd_1.yml @@ -6,7 +6,7 @@ lim: heartBeatTime: 20000 #心跳超时时间 单位毫秒 brokerId: 1000 loginModel: 3 - logicUrl: http://172.16.2.3:28000/v1 + logicUrl: http://172.16.3.19:28000/v1 # * 多端同步模式:1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备 # * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备 # * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备 diff --git a/hs-im-server/build/im-message-store-1.0.0-SNAPSHOT.jar b/hs-im-server/build/im-message-store-1.0.0-SNAPSHOT.jar index fb0adc0..50b1f45 100644 Binary files a/hs-im-server/build/im-message-store-1.0.0-SNAPSHOT.jar and b/hs-im-server/build/im-message-store-1.0.0-SNAPSHOT.jar differ diff --git a/hs-im-server/build/im-service-1.0.0-SNAPSHOT.jar b/hs-im-server/build/im-service-1.0.0-SNAPSHOT.jar index f3d08bf..27fdab7 100644 Binary files a/hs-im-server/build/im-service-1.0.0-SNAPSHOT.jar and b/hs-im-server/build/im-service-1.0.0-SNAPSHOT.jar differ diff --git a/hs-im-server/build/im-tcp-1.0.0-SNAPSHOT.jar b/hs-im-server/build/im-tcp-1.0.0-SNAPSHOT.jar index d7312fc..1fe3a26 100644 Binary files a/hs-im-server/build/im-tcp-1.0.0-SNAPSHOT.jar and b/hs-im-server/build/im-tcp-1.0.0-SNAPSHOT.jar differ diff --git a/hs-im-server/im-message-store/src/main/resources/application.yml b/hs-im-server/im-message-store/src/main/resources/application.yml index 3d7808a..9f96606 100644 --- a/hs-im-server/im-message-store/src/main/resources/application.yml +++ b/hs-im-server/im-message-store/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev + active: prod diff --git a/hs-im-server/im-service/src/main/java/com/lld/im/service/Application.java b/hs-im-server/im-service/src/main/java/com/lld/im/service/Application.java index 21066c9..b6f120d 100644 --- a/hs-im-server/im-service/src/main/java/com/lld/im/service/Application.java +++ b/hs-im-server/im-service/src/main/java/com/lld/im/service/Application.java @@ -3,7 +3,10 @@ package com.lld.im.service; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@EnableScheduling @SpringBootApplication(scanBasePackages = {"com.lld.im.service", "com.lld.im.common"}) @MapperScan("com.lld.im.service.*.dao.mapper") diff --git a/hs-im-server/im-service/src/main/java/com/lld/im/service/taskScheduler/SRSStreamTask.java b/hs-im-server/im-service/src/main/java/com/lld/im/service/taskScheduler/SRSStreamTask.java new file mode 100644 index 0000000..d48d324 --- /dev/null +++ b/hs-im-server/im-service/src/main/java/com/lld/im/service/taskScheduler/SRSStreamTask.java @@ -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("========定时任务"); + } +} diff --git a/hs-im-server/im-service/src/main/resources/application.yml b/hs-im-server/im-service/src/main/resources/application.yml index 3d7808a..9f96606 100644 --- a/hs-im-server/im-service/src/main/resources/application.yml +++ b/hs-im-server/im-service/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev + active: prod diff --git a/im-uniapp/App.vue b/im-uniapp/App.vue index fcccd06..3fa5df6 100644 --- a/im-uniapp/App.vue +++ b/im-uniapp/App.vue @@ -14,13 +14,13 @@ // #endif export default { onLaunch: function() { - + localStorage.setItem("appId",10000) appInit(500).then((res)=>{ console.log("获取到token,创建长链接") - console.log(this.$socketTask.socketTask) + this.$store.dispatch('getAddressList'); setTimeout(()=>{ - this.$socketTask.connectSocket() - },500) + this.$socketTask.connectSocket() + },2500) }).then((error)=>{ console.log("未获取到IM的token") }) diff --git a/im-uniapp/common/config.js b/im-uniapp/common/config.js index 2b24737..097202b 100644 --- a/im-uniapp/common/config.js +++ b/im-uniapp/common/config.js @@ -1,5 +1,5 @@ export default class config{ - static prod="online" + static prod="online_not" static getZnzqApiUrl(){ if(process.env.NODE_ENV === 'development' ){ return 'http://work.ii999.live:19002/znzq' @@ -7,7 +7,7 @@ export default class config{ if(this.prod=="online"){ return 'http://work.ii999.live:19002/znzq' }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){ 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{ 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{ - 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}` } } } diff --git a/im-uniapp/common/publicFc.js b/im-uniapp/common/publicFc.js index e82c323..42042cb 100644 --- a/im-uniapp/common/publicFc.js +++ b/im-uniapp/common/publicFc.js @@ -3,6 +3,8 @@ import browser from '@/common/browser' import store from '../store' import pinyin from '@/common/pinyin.js'; import dayjs from "dayjs" +import localForage from 'localforage'; + export default { // 获取字典 @@ -992,13 +994,22 @@ export default { } titleObj.buttons[index].text = text; currentWebview.setStyle({ - titleNView: titleObj + titleNView: titleObj }); // #endif }, formatMessage(msg){ msg.pushType="MSG" 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) // try{ // console.log("=======================formatMessage") @@ -1022,7 +1033,7 @@ export default { msg.fromInfo={ userId:msg.fromId, userType:1, - nickName:msg.fromId, + nickName:fromUserData?fromUserData.realname:msg.fromId, portrait:"https://shudong2022.oss-cn-hangzhou.aliyuncs.com/common/user/logo.png" }; msg.groupInfo={}; diff --git a/im-uniapp/common/socketTask.js b/im-uniapp/common/socketTask.js index 83f6c5a..635ab64 100644 --- a/im-uniapp/common/socketTask.js +++ b/im-uniapp/common/socketTask.js @@ -2,17 +2,22 @@ import config from "@/common/config.js" let timer = null let retimer = null import store from '../store' - import * as sdk from "@/common/imSdk/lim-sdk.js"; import lim from "@/common/imSdk/sdk-bridge.js"; import publicFc from '@/common/publicFc'; +import localForage from 'localforage'; + export default { socketTask: null, // 连接WebSocket connectSocket() { - + + + + + const ListenerMap = { onSocketConnectEvent: (option, status, data) => { console.log("已建立连接:" + JSON.stringify(status)); @@ -39,7 +44,7 @@ export default { const _data = publicFc.formatMessage(msg) uni.$emit('onP2PMessage', _data); store.dispatch('onP2PMessage', _data) - },500) + },2000) }) } }, 2000); diff --git a/im-uniapp/common/utils.js b/im-uniapp/common/utils.js index d3ff3a8..b28f111 100644 --- a/im-uniapp/common/utils.js +++ b/im-uniapp/common/utils.js @@ -22,26 +22,30 @@ export function appInit(ms) { return new Promise((resolve, reject) => { var i = 0; let timer = setInterval(() => { - var im_imUserSign = localStorage.getItem("im_imUserSign") - var im_userId = localStorage.getItem("im_userId") + var im_imUserSign = uni.getStorageSync("im_imUserSign") + 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") - i = i + 1; - if (i > 30) { + i = 100; + if (i < 0) { reject("error") } if (im_imUserSign) { - localStorage.setItem("imUserSign",im_imUserSign) - localStorage.setItem("appId",10000) - localStorage.setItem("token",hd_token) + uni.setStorageSync("imUserSign",im_imUserSign) + uni.setStorageSync("token",hd_token) - if(im_userId){ - localStorage.setItem("userId",im_userId) + if(uni.getStorageSync("userId")!=null&&uni.getStorageSync("imUserSign")!=null&&uni.getStorageSync("token")!=null){ + clearInterval(timer) + timer = null + resolve("ok") } - clearInterval(timer) - timer = null - resolve("ok") + } }, ms); }) diff --git a/im-uniapp/components/zmm-upload-image/zmm-upload-image.vue b/im-uniapp/components/zmm-upload-image/zmm-upload-image.vue index 683fc36..4cc2875 100644 --- a/im-uniapp/components/zmm-upload-image/zmm-upload-image.vue +++ b/im-uniapp/components/zmm-upload-image/zmm-upload-image.vue @@ -167,7 +167,8 @@ export default { break; case 'chooseMedia': uni.showActionSheet({ - itemList: ['图片', '视频'], + itemList: ['图片'], + // itemList: ['图片', '视频'], success: (res) => { switch (res.tapIndex){ case 0: diff --git a/im-uniapp/store/index.js b/im-uniapp/store/index.js index 1940870..5a241ff 100644 --- a/im-uniapp/store/index.js +++ b/im-uniapp/store/index.js @@ -1,9 +1,9 @@ import http from '@/common/request'; import publicFc from '@/common/publicFc'; - +import customHttp from "@/common/customHttp.js" import * as sdk from "@/common/imSdk/lim-sdk.js"; import lim from "@/common/imSdk/sdk-bridge.js"; - +import localForage from 'localforage'; const _im = lim.lim.im function sortBy(field) { @@ -37,7 +37,8 @@ const store = new Vuex.Store({ chatDataUserId: '', topicReply: {}, topicRed: {}, - friendApply: {} + friendApply: {}, + addressList:[], }, mutations: { update_UserInfo(state, data) { //个人信息 @@ -60,6 +61,10 @@ const store = new Vuex.Store({ update_friendApply(state, data) { state.friendApply = data uni.setStorageSync('friendApply', JSON.stringify(data)); + }, + update_addressList(state,data){ + state.addressList=data; + localForage.setItem("addressList",data) } }, actions: { @@ -347,6 +352,27 @@ const store = new Vuex.Store({ }, 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 => { + + }) } } }) diff --git a/im-uniapp/wx/login/index.vue b/im-uniapp/wx/login/index.vue index 22f624e..b3f1a16 100644 --- a/im-uniapp/wx/login/index.vue +++ b/im-uniapp/wx/login/index.vue @@ -157,7 +157,7 @@ params: {}, /* 会加在url上 */ header: {}, - /* 会与全局header合并,如有同名属性,局部覆盖全局 */ + /* 会与全局header合并,如有同名属性,局WW部覆盖全局 */ dataType: 'json', // 注:如果局部custom与全局custom有同名属性,则后面的属性会覆盖前面的属性,相当于Object.assign(全局,局部) custom: { diff --git a/im-uniapp/wx/tabbar1/index.vue b/im-uniapp/wx/tabbar1/index.vue index 0ae9608..949df40 100644 --- a/im-uniapp/wx/tabbar1/index.vue +++ b/im-uniapp/wx/tabbar1/index.vue @@ -23,7 +23,6 @@