diff --git a/hd-glasses-app/.env.hd b/hd-glasses-app/.env.hd index f6d81e4..7519225 100644 --- a/hd-glasses-app/.env.hd +++ b/hd-glasses-app/.env.hd @@ -3,5 +3,4 @@ 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 f6d81e4..7519225 100644 --- a/hd-glasses-app/.env.prod +++ b/hd-glasses-app/.env.prod @@ -3,5 +3,4 @@ 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/public/index.html b/hd-glasses-app/public/index.html index ddb6608..6e26464 100644 --- a/hd-glasses-app/public/index.html +++ b/hd-glasses-app/public/index.html @@ -3,7 +3,7 @@ diff --git a/hd-glasses-app/src/pages/hd_map.vue b/hd-glasses-app/src/pages/hd_map.vue index d642ae8..253b336 100644 --- a/hd-glasses-app/src/pages/hd_map.vue +++ b/hd-glasses-app/src/pages/hd_map.vue @@ -18,7 +18,9 @@
{{ alarmDetailsData.title }}
-
报警类型:{{ alarmDetailsData.alarmCategory_dictText }} +
报警类型:{{ + alarmDetailsData.alarmCategory_dictText + }}
报警时间:{{ alarmDetailsData.createTime }}
警情内容:{{ alarmDetailsData.msgContent }}
@@ -125,7 +127,7 @@ export default { planningVectorLayer: {}, parentPostMessageData: [], isCanDraw: true, - from:"" + from: "" }; }, mounted() { @@ -136,7 +138,7 @@ export default { this.from = getUrlParam("from"); this.token = getUrlParam("token") - if (this.token !=null) { + if (this.token != null) { localStorage.setItem("hd_token", this.token) } @@ -162,15 +164,16 @@ export default { this.pcDrawType = "LineString"; window.addEventListener('message', (event) => { this.isCanDraw = false + console.log(event.data) if (this.parentPostMessageData.length == 0) { - try { - console.error(event.data) - }catch (e) { - + if (event.data instanceof Array) { + this.map.removeLayer(this.drawPlanningPathLayer); + this.parentPostMessageData = event.data; + this.drawPcPostMessageDataLayer() + } else { + this.isCanDraw = true; } - this.map.removeLayer(this.drawPlanningPathLayer); - this.parentPostMessageData = event.data; - this.drawPcPostMessageDataLayer() + } }); //处理ok @@ -182,12 +185,12 @@ export default { this.isCanDraw = false if (this.parentPostMessageData.length == 0) { - if(event.data instanceof Array){ + if (event.data instanceof Array) { this.map.removeLayer(this.drawPlanningPathLayer); this.parentPostMessageData = event.data; this.drawPcPostMessageDataLayer() - }else { - this.isCanDraw=true; + } else { + this.isCanDraw = true; } } @@ -292,7 +295,6 @@ export default { } - var style = ''; var format = 'image/png'; var layerName = 'china:yangjianghedian_dt'; @@ -307,7 +309,7 @@ export default { 'SERVICE': 'WMTS', 'FORMAT': format }; - var url = process.env.VUE_APP_MAP_URL + "/gwc/service/wmts?authkey=" + process.env.VUE_APP_MAP_AUTHKEY+"&" + var url = process.env.VUE_APP_MAP_URL + "/gwc/service/wmts?authkey=" + process.env.VUE_APP_MAP_AUTHKEY + "&" for (var param in params) { if (baseParams.indexOf(param.toUpperCase()) < 0) { url = url + param + '=' + params[param] + '&'; @@ -554,9 +556,9 @@ export default { const result = JSON.stringify(center) - if(this.from=="pc"){ + if (this.from == "pc") { window.parent.postMessage(result, "*"); - }else { + } else { location.href = "uniwebview://action?function=addAlarmPoint¶ms1=" + result; } @@ -625,22 +627,39 @@ export default { }) .then(() => { - // on confirm - const featureGeoJson = JSON.parse(new GeoJSON().writeFeature(e.feature)) + if (this.pcDrawType == "Polygon") { + // on confirm + const featureGeoJson = JSON.parse(new GeoJSON().writeFeature(e.feature)) - let pointList = [] + let pointList = [] - featureGeoJson.geometry.coordinates.map(item => { - console.log(item) - item.map(_item => { - const _item1 = ol.proj.transform(_item, 'EPSG:3857', 'EPSG:4326'); - pointList.push(_item1) + featureGeoJson.geometry.coordinates.map(item => { + console.log(item) + item.map(_item => { + const _item1 = ol.proj.transform(_item, 'EPSG:3857', 'EPSG:4326'); + pointList.push(_item1) + }) + + }) + console.log(pointList) + + window.parent.postMessage(JSON.stringify([pointList]), "*"); + + } else if (this.pcDrawType == "LineString") { + // on confirm + const featureGeoJson = JSON.parse(new GeoJSON().writeFeature(e.feature)) + + let pointList = [] + + featureGeoJson.geometry.coordinates.map(item => { + const _item1 = ol.proj.transform(item, 'EPSG:3857', 'EPSG:4326'); + pointList.push(_item1) }) - }) - console.log(pointList) + window.parent.postMessage(JSON.stringify(pointList), "*"); + + } - window.parent.postMessage(JSON.stringify([pointList]), "*"); }) .catch(() => { @@ -742,7 +761,7 @@ export default { data: record, type: 'alarm' }); - const alarmCategory_dictText=record.alarmCategory_dictText||"未知类型" + const alarmCategory_dictText = record.alarmCategory_dictText || "未知类型" //临时智慧所,小红旗 if (record.alarmCategory == "1706273001850601474") { // 设置要素的图标 @@ -756,7 +775,7 @@ export default { }), text: new Text({ testAlign: 'center', - text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'], + text: [_index.toString(), 'bold 16px sans-serif', '\n', '', alarmCategory_dictText, 'italic 16px sans-serif'], font: 'bold 20px 微软雅黑', fill: new Fill({ color: '#ffa502', @@ -777,7 +796,7 @@ export default { }), text: new Text({ testAlign: 'center', - text: [_index.toString(), 'bold 16px sans-serif', '\n','',alarmCategory_dictText, 'italic 16px sans-serif'], + text: [_index.toString(), 'bold 16px sans-serif', '\n', '', alarmCategory_dictText, 'italic 16px sans-serif'], font: 'bold 20px 微软雅黑', fill: new Fill({ color: '#ffa502', @@ -794,7 +813,7 @@ export default { } //设备相关 if (type == 'equipment') { - let alarmNum=record.alarmNum||0; + let alarmNum = record.alarmNum || 0; // 模拟数据 // record.isOnline="true"; // alarmNum=0; @@ -824,7 +843,7 @@ export default { }), text: new Text({ testAlign: 'center', - text: [record.equipmentName, 'bold 16px sans-serif', '\n',''], + text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''], font: 'bold 20px 微软雅黑', fill: new Fill({ color: 'rgb(155, 155, 155)', @@ -837,27 +856,27 @@ export default { 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, - }), - text: new Text({ - testAlign: 'center', - text: [record.equipmentName, 'bold 16px sans-serif', '\n',''], - font: 'bold 20px 微软雅黑', - fill: new Fill({ - color: 'rgb(22, 206, 129)', - }) - }) - }) - ); - } - if(alarmNum>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, + }), + text: new Text({ + testAlign: 'center', + text: [record.equipmentName, 'bold 16px sans-serif', '\n', ''], + font: 'bold 20px 微软雅黑', + fill: new Fill({ + color: 'rgb(22, 206, 129)', + }) + }) + }) + ); + } + if (alarmNum > 0) { feature.setStyle( new Style({ // 设置图片效果 @@ -866,9 +885,9 @@ export default { // anchor: [0.5, 0.5], scale: 0.4, }), - text:new Text({ + text: new Text({ testAlign: 'center', - text: [record.equipmentName, 'bold 16px sans-serif', '\n','',`${alarmNum}条告警未接受`, 'bold 16px sans-serif',], + text: [record.equipmentName, 'bold 16px sans-serif', '\n', '', `${alarmNum}条告警未接受`, 'bold 16px sans-serif',], font: 'bold 16px 微软雅黑', fill: new Fill({ color: 'rgb(54, 159, 255)', diff --git a/hd-glasses-app/src/pages/hd_map_add_point.vue b/hd-glasses-app/src/pages/hd_map_add_point.vue new file mode 100644 index 0000000..94a45f7 --- /dev/null +++ b/hd-glasses-app/src/pages/hd_map_add_point.vue @@ -0,0 +1,1228 @@ + + + + + diff --git a/hd-glasses-app/src/pages/hd_map_patrol_line.vue b/hd-glasses-app/src/pages/hd_map_patrol_line.vue new file mode 100644 index 0000000..1c0f4fe --- /dev/null +++ b/hd-glasses-app/src/pages/hd_map_patrol_line.vue @@ -0,0 +1,769 @@ + + + + + diff --git a/hd-glasses-app/src/pages/hd_show_current_patrol_history.vue b/hd-glasses-app/src/pages/hd_show_current_patrol_history.vue index a8ee084..5a9b16a 100644 --- a/hd-glasses-app/src/pages/hd_show_current_patrol_history.vue +++ b/hd-glasses-app/src/pages/hd_show_current_patrol_history.vue @@ -65,6 +65,10 @@ import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; import {appInit, getStatisFileUrl,GetQueryString,getUrlParam} from "../utils/publicFun"; import dayjs from "dayjs" +import WMTSTileGrid from 'ol/tilegrid/WMTS.js'; +import {get as getProjection} from 'ol/proj.js'; +import {getTopLeft, getWidth} from 'ol/extent.js'; + export default { data() { @@ -172,8 +176,7 @@ export default { patrolInstanceId: "", moveIndex: 0, pointMoveTimer:null, - mapZoom:15, - busId:"" + mapZoom:15 }; }, mounted() { @@ -320,17 +323,60 @@ export default { }); - const wmsLayer_1 = new TileLayer({ - source: new TileWMS({ - // 设置 Geoserver 服务的 URL - url: process.env.VUE_APP_MAP_URL + "/wms", - params: { - LAYERS: "china:yangjianghedian_dt", - TILED: true - } + // 切片方案(0-18级 + const projection = getProjection('EPSG:3857'); + const projectionExtent = projection.getExtent(); + const size = getWidth(projectionExtent) / 256; + const resolutions = new Array(19); + const matrixIds = new Array(19); + for (let z = 0; z < 19; ++z) { + resolutions[z] = size / Math.pow(2, z); + matrixIds[z] = "EPSG:3857:" + z; + } + + + var style = ''; + var format = 'image/png'; + var layerName = 'china:yangjianghedian_dt'; + let baseParams = ['VERSION', 'LAYER', 'STYLE', 'TILEMATRIX', 'TILEMATRIXSET', 'SERVICE', 'FORMAT']; + + let params = { + 'VERSION': '1.0.0', + 'LAYER': layerName, + 'STYLE': style, + 'TILEMATRIX': matrixIds, + 'TILEMATRIXSET': projection, + 'SERVICE': 'WMTS', + 'FORMAT': format + }; + var url = process.env.VUE_APP_MAP_URL + "/gwc/service/wmts?authkey=" + process.env.VUE_APP_MAP_AUTHKEY+"&" + for (var param in params) { + if (baseParams.indexOf(param.toUpperCase()) < 0) { + url = url + param + '=' + params[param] + '&'; + } + } + url = url.slice(0, -1); + + + const wmtsLayer_1 = new TileLayer({ + opacity: 1, //图层透明度 + source: new WMTS({ + url: url, + layer: "china:yangjianghedian_dt", + matrixSet: 'EPSG:3857', + format: 'image/png', // 默认:'image/jpeg' + projection: projection, + tileGrid: new WMTSTileGrid({ + origin: getTopLeft(projectionExtent), + resolutions: resolutions, + matrixIds: matrixIds, + }), + style: '', + wrapX: true }) }); + this.map = new Map({ target: "map", layers: [ @@ -339,13 +385,14 @@ export default { // url: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}", // }), // }), - wmsLayer_1, + wmtsLayer_1, wmsLayer_0, ], view: new View({ - projection: "EPSG:3857", + resolutions: resolutions, + projection: projection, center: [12497018.585823221, 2476783.2447665134], - zoom: this.mapZoom, + zoom: 16, }), }); this.map.on('singleclick', e => { @@ -1019,7 +1066,6 @@ export default { this.map.getView().animate({ center:startPoint, duration:1000, - zoom:this.mapZoom }) } _list.push(record.location.split(",")) 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 bcc4945..9ff2916 100644 --- a/hd-glasses-app/src/pages/hd_show_patrol_history.vue +++ b/hd-glasses-app/src/pages/hd_show_patrol_history.vue @@ -65,6 +65,11 @@ import GeoJSON from 'ol/format/GeoJSON' import service from "@/utils/service"; import {appInit, getStatisFileUrl,GetQueryString,getUrlParam} from "../utils/publicFun"; import dayjs from "dayjs" +import WMTSTileGrid from 'ol/tilegrid/WMTS.js'; +import {get as getProjection} from 'ol/proj.js'; +import {getTopLeft, getWidth} from 'ol/extent.js'; + + export default { data() { @@ -309,17 +314,62 @@ export default { }); - const wmsLayer_1 = new TileLayer({ - source: new TileWMS({ - // 设置 Geoserver 服务的 URL - url: process.env.VUE_APP_MAP_URL + "/wms", - params: { - LAYERS: "china:yangjianghedian_dt", - TILED: true - } + + // 切片方案(0-18级 + const projection = getProjection('EPSG:3857'); + const projectionExtent = projection.getExtent(); + const size = getWidth(projectionExtent) / 256; + const resolutions = new Array(19); + const matrixIds = new Array(19); + for (let z = 0; z < 19; ++z) { + resolutions[z] = size / Math.pow(2, z); + matrixIds[z] = "EPSG:3857:" + z; + } + + + var style = ''; + var format = 'image/png'; + var layerName = 'china:yangjianghedian_dt'; + let baseParams = ['VERSION', 'LAYER', 'STYLE', 'TILEMATRIX', 'TILEMATRIXSET', 'SERVICE', 'FORMAT']; + + let params = { + 'VERSION': '1.0.0', + 'LAYER': layerName, + 'STYLE': style, + 'TILEMATRIX': matrixIds, + 'TILEMATRIXSET': projection, + 'SERVICE': 'WMTS', + 'FORMAT': format + }; + var url = process.env.VUE_APP_MAP_URL + "/gwc/service/wmts?authkey=" + process.env.VUE_APP_MAP_AUTHKEY+"&" + for (var param in params) { + if (baseParams.indexOf(param.toUpperCase()) < 0) { + url = url + param + '=' + params[param] + '&'; + } + } + url = url.slice(0, -1); + + + const wmtsLayer_1 = new TileLayer({ + opacity: 1, //图层透明度 + source: new WMTS({ + url: url, + layer: "china:yangjianghedian_dt", + matrixSet: 'EPSG:3857', + format: 'image/png', // 默认:'image/jpeg' + projection: projection, + tileGrid: new WMTSTileGrid({ + origin: getTopLeft(projectionExtent), + resolutions: resolutions, + matrixIds: matrixIds, + }), + style: '', + wrapX: true }) }); + + this.map = new Map({ target: "map", layers: [ @@ -328,13 +378,14 @@ export default { // url: "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}", // }), // }), - wmsLayer_1, + wmtsLayer_1, wmsLayer_0, ], view: new View({ - projection: "EPSG:3857", + resolutions: resolutions, + projection: projection, center: [12497018.585823221, 2476783.2447665134], - zoom: this.mapZoom, + zoom: 16, }), }); this.map.on('singleclick', e => { diff --git a/hd-glasses-app/src/router/index.js b/hd-glasses-app/src/router/index.js index da7f2f3..8f2ebb2 100644 --- a/hd-glasses-app/src/router/index.js +++ b/hd-glasses-app/src/router/index.js @@ -16,34 +16,46 @@ const router = new Router({ path: '/map', name: 'map', component: () => import('../pages/map.vue') //路由懒加载(按需加载) - },{ + }, { path: '/call_room', name: 'call_room', component: () => import('../pages/call_room.vue') - },{ + }, { path: '/hd_map', name: 'hd_map', component: () => import('../pages/hd_map.vue') - },{ + }, { path: '/hd_map_area', name: 'hd_map_area', component: () => import('../pages/hd_map_area.vue') - },{ + }, { path: '/hd_show_patrol_history', name: 'hd_show_patrol_history', component: () => import('../pages/hd_show_patrol_history.vue') - },{ + }, { path: '/hd_show_equipment_move_history', name: 'hd_show_equipment_move_history', component: () => import('../pages/hd_show_equipment_move_history.vue') - },{ + }, { 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') + }, { + path: '/hd_show_current_patrol_history', + name: 'hd_show_current_patrol_history', + component: () => import('../pages/hd_show_current_patrol_history.vue') + }, { + path: '/hd_map_add_point', + name: 'hd_map_add_point', + component: () => import('../pages/hd_map_add_point.vue') + }, { + path: '/hd_map_patrol_line', + name: 'hd_map_patrol_line', + component: () => import('../pages/hd_map_patrol_line.vue') } ] }); diff --git a/im-uniapp/common/socketTask.js b/im-uniapp/common/socketTask.js index 7e243b2..d67b929 100644 --- a/im-uniapp/common/socketTask.js +++ b/im-uniapp/common/socketTask.js @@ -44,10 +44,10 @@ export default { const _data = publicFc.formatMessage(msg) uni.$emit('onP2PMessage', _data); store.dispatch('onP2PMessage', _data) - },2000) + },500) }) } - }, 2000); + }, 1000); }, onTestMessage: (e) => { diff --git a/im-uniapp/wx/tabbar1/index.vue b/im-uniapp/wx/tabbar1/index.vue index 49aa1a0..4f6ac54 100644 --- a/im-uniapp/wx/tabbar1/index.vue +++ b/im-uniapp/wx/tabbar1/index.vue @@ -62,7 +62,7 @@ console.log(location.href) if (options.imUserSign) { uni.showLoading({ - title: "加载中...", + title: "数据加载中...", mask: true }); /* @@ -84,11 +84,14 @@ if (uni.getStorageSync("initReady") == 1) { console.log("==========进入首页 initReady为1,开始跳转") clearInterval(timer) - uni.hideLoading(); - uni.navigateTo({ - url: '../chatWindow/index?userId=' + options.tuid + '&windowType=' + options - .windowType - }); + setTimeout(() => { + uni.hideLoading(); + uni.navigateTo({ + url: '../chatWindow/index?userId=' + options.tuid + + '&windowType=' + options + .windowType + }); + }, 3000) } }, 500) }