From a6fb1cdb74ca11c9dba798e64bf3d61bbfbdf05b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 11 九月 2023 16:17:29 +0800 Subject: [PATCH] 修复Web页面播放国标录像无声音的问题 --- web_src/src/components/map.vue | 93 +++++++++++++++++++++++----------------------- 1 files changed, 47 insertions(+), 46 deletions(-) diff --git a/web_src/src/components/map.vue b/web_src/src/components/map.vue old mode 100644 new mode 100755 index e9e8628..248426c --- a/web_src/src/components/map.vue +++ b/web_src/src/components/map.vue @@ -16,19 +16,20 @@ <el-descriptions class="margin-top" :title="channel.name" :column="1" :colon="true" size="mini" :labelStyle="labelStyle" > <el-descriptions-item label="缂栧彿" >{{channel.channelId}}</el-descriptions-item> <el-descriptions-item label="鍨嬪彿">{{channel.model}}</el-descriptions-item> - <el-descriptions-item label="缁忕含搴�" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item> + <el-descriptions-item label="缁忓害" >{{channel[longitudeStr]}}</el-descriptions-item> + <el-descriptions-item label="绾害" >{{channel[latitudeStr]}}</el-descriptions-item> <el-descriptions-item label="鐢熶骇鍘傚晢">{{channel.manufacture}}</el-descriptions-item> <el-descriptions-item label="琛屾斂鍖哄煙" >{{channel.civilCode}}</el-descriptions-item> <el-descriptions-item label="璁惧褰掑睘" >{{channel.owner}}</el-descriptions-item> <el-descriptions-item label="瀹夎鍦板潃" >{{channel.address == null?'鏈煡': channel.address}}</el-descriptions-item> - <el-descriptions-item label="浜戝彴绫诲瀷" >{{channel.ptztypeText}}</el-descriptions-item> - <el-descriptions-item label="鐘舵��"> - <el-tag size="small" v-if="channel.status === 1">鍦ㄧ嚎</el-tag> - <el-tag size="small" type="info" v-if="channel.status === 0">绂荤嚎</el-tag> + <el-descriptions-item label="浜戝彴绫诲瀷" >{{channel.PTZTypeText}}</el-descriptions-item> + <el-descriptions-item label="閫氶亾鐘舵��"> + <el-tag size="small" v-if="channel.status === true">鍦ㄧ嚎</el-tag> + <el-tag size="small" type="info" v-if="channel.status === false">绂荤嚎</el-tag> </el-descriptions-item> </el-descriptions> <div style="padding-top: 10px"> - <el-button type="primary" size="small" title="鎾斁" icon="el-icon-video-play" @click="play(channel)"></el-button> + <el-button v-bind:disabled="device == null || device.online === 0" type="primary" size="small" title="鎾斁" icon="el-icon-video-play" @click="play(channel)"></el-button> <el-button type="primary" size="small" title="缂栬緫浣嶇疆" icon="el-icon-edit" @click="edit(channel)"></el-button> <el-button type="primary" size="small" title="杞ㄨ抗鏌ヨ" icon="el-icon-map-location" @click="getTrace(channel)"></el-button> </div> @@ -64,11 +65,14 @@ layer: null, lineLayer: null, channel: null, + device: null, infoBoxId: null, labelStyle: { width: "56px" }, isLoging: false, + longitudeStr: "longitude", + latitudeStr: "latitude", }; }, created() { @@ -78,17 +82,27 @@ setTimeout(()=>{ // 寤惰繜浠ョ瓑寰呭湴鍥惧姞杞藉畬鎴� TODO 鍚庣画淇敼涓洪�氳繃鏄疄闄呰繖锛涚姸鎬佸姞鍥炶皟瀹屾垚 this.deviceService.getAllChannel(false, false, this.$route.query.deviceId, this.channelsHandler) }, 1000) - + } + if (window.mapParam.coordinateSystem == "GCJ-02") { + this.longitudeStr = "longitudeGcj02"; + this.latitudeStr = "latitudeGcj02"; + }else if (window.mapParam.coordinateSystem == "WGS84") { + this.longitudeStr = "longitudeWgs84"; + this.latitudeStr = "latitudeWgs84"; + }else { + this.longitudeStr = "longitude"; + this.latitudeStr = "latitude"; } }, destroyed() { }, methods: { - clickEvent: function (data) { - if (data.channelId && data.subCount == 0) { + clickEvent: function (device, data, isCatalog) { + this.device = device; + if (data.channelId && !isCatalog) { // 鐐瑰嚮閫氶亾 - if (data.longitude * data.latitude === 0) { + if (data[this.longitudeStr] * data[this.latitudeStr] === 0) { this.$message.error('鏈幏鍙栧埌浣嶇疆淇℃伅'); } else { if (this.layer != null) { @@ -96,26 +110,29 @@ } this.closeInfoBox() this.layer = this.$refs.map.addLayer([{ - position: [data.longitude, data.latitude], + position: [data[this.longitudeStr], data[this.latitudeStr]], image: { src: this.getImageByChannel(data), anchor: [0.5, 1] }, data: data }], this.featureClickEvent) - this.$refs.map.panTo([data.longitude, data.latitude], mapParam.maxZoom) + this.$refs.map.panTo([data[this.longitudeStr], data[this.latitudeStr]], mapParam.maxZoom) } } }, - contextmenuEventHandler: function (event, data) { - if (data.channelId && data.subCount == 0) { + contextmenuEventHandler: function (device, event, data, isCatalog) { + console.log(device) + console.log(device.online) + this.device = device; + if (data.channelId && !isCatalog) { // 鐐瑰嚮閫氶亾 this.$contextmenu({ items: [ { label: "鎾斁", icon: "el-icon-video-play", - disabled: false, + disabled: device.online === 0, onClick: () => { this.play(data); } @@ -169,6 +186,14 @@ this.deviceService.getAllSubChannel(false, data.deviceId, data.channelId, this.channelsHandler) } } + }, + { + label: "鏌ヨ杞ㄨ抗", + icon: "el-icon-map-location", + disabled: false, + onClick: () => { + this.getTrace(data) + } } ], event, // 榧犳爣浜嬩欢淇℃伅 @@ -183,22 +208,11 @@ this.clean() this.closeInfoBox() let params = []; - let longitudeStr; - let latitudeStr; - if (window.mapParam.coordinateSystem == "GCJ-02") { - longitudeStr = "longitudeGcj02"; - latitudeStr = "latitudeGcj02"; - }else if (window.mapParam.coordinateSystem == "WGS84") { - longitudeStr = "longitudeWgs84"; - latitudeStr = "latitudeWgs84"; - }else { - longitudeStr = "longitude"; - latitudeStr = "latitude"; - } + for (let i = 0; i < channels.length; i++) { - let longitude = channels[i][longitudeStr]; - let latitude = channels[i][latitudeStr]; + let longitude = channels[i][this.longitudeStr]; + let latitude = channels[i][this.latitudeStr]; if (longitude * latitude === 0) { continue; } @@ -217,7 +231,7 @@ this.layer = this.$refs.map.addLayer(params, this.featureClickEvent) console.log(4) if (params.length === 1) { - this.$refs.map.panTo([channels[0][longitudeStr], channels[0][latitudeStr]], mapParam.maxZoom) + this.$refs.map.panTo([channels[0][this.longitudeStr], channels[0][this.latitudeStr]], mapParam.maxZoom) } else if (params.length > 1) { this.$refs.map.fit(this.layer) } else { @@ -266,19 +280,7 @@ this.channel = channels[0] } this.$nextTick(() => { - let longitudeStr; - let latitudeStr; - if (window.mapParam.coordinateSystem == "GCJ-02") { - longitudeStr = "longitudeGcj02"; - latitudeStr = "latitudeGcj02"; - }else if (window.mapParam.coordinateSystem == "WGS84") { - longitudeStr = "longitudeWgs84"; - latitudeStr = "latitudeWgs84"; - }else { - longitudeStr = "longitude"; - latitudeStr = "latitude"; - } - let position = [this.channel[longitudeStr], this.channel[latitudeStr]]; + let position = [this.channel[this.longitudeStr], this.channel[this.latitudeStr]]; this.infoBoxId = this.$refs.map.openInfoBox(position, this.$refs.infobox, [0, -50]) }) }, @@ -300,7 +302,6 @@ }).then(function (res) { that.isLoging = false; if (res.data.code === 0) { - that.$refs.devicePlayer.openDialog("media", deviceId, channelId, { streamInfo: res.data.data, hasAudio: channel.hasAudio @@ -326,8 +327,8 @@ } else { let positions = []; for (let i = 0; i < channelPositions.length; i++) { - if (channelPositions[i].cnLng * channelPositions[i].cnLat > 0) { - positions.push([channelPositions[i].cnLng, channelPositions[i].cnLat]) + if (channelPositions[i][this.longitudeStr] * channelPositions[i][this.latitudeStr] > 0) { + positions.push([channelPositions[i][this.longitudeStr], channelPositions[i][this.latitudeStr]]) } } -- Gitblit v1.8.0