From a90bcdf047a8baf02aeec81221aeeb49db523cde Mon Sep 17 00:00:00 2001 From: 13404089107 <puwei@sinata.cn> Date: 星期五, 30 五月 2025 18:40:13 +0800 Subject: [PATCH] fix --- src/view/home/index.vue | 50 +++++++++++++++++++++++++++++++------------------- 1 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/view/home/index.vue b/src/view/home/index.vue index 98f35dc..1c0440b 100644 --- a/src/view/home/index.vue +++ b/src/view/home/index.vue @@ -207,6 +207,8 @@ import AMapLoader from "@amap/amap-jsapi-loader"; import flvjs from "flv.js"; import moment from 'moment' +import '../../utils/css/swfobject-h5.css' +import '../../utils/css/DPlayer.min.css' import { getCarCount, getCarStatusCount, @@ -252,10 +254,7 @@ carId: "", //监控车辆 urlLink: '',//视频地址 tableData: [], //预警情况统计数据 - - showFlv:false,//是否显示flv视频 - - + showFlv: false,//是否显示flv视频 tokenID: 'shehongchuzu', plugin: true, oWebControl: null, //插件对象 @@ -354,7 +353,10 @@ if (this.opencARiD) { window.hstVideoPlay.historyCloseVideo(this.opencARiD, '1'); } - this.oWebControl.JS_DestroyWnd(); + if (this.oWebControl != null) { + this.oWebControl.JS_DestroyWnd(); + } + this.destroyPlayer(); if (this.markers && this.markers.length > 0) { this.markers.forEach((marker) => { @@ -551,6 +553,15 @@ // 添加信息弹窗关闭事件监听 this.infoWindow.on("close", () => { this.destroyPlayer(); + if (this.oWebControl != null) { + this.oWebControl.JS_DestroyWnd(); + } + }); + this.map.on("click", (e) => { + this.infoWindow.close(); + if (this.oWebControl != null) { + this.oWebControl.JS_DestroyWnd(); + } }); this.getMapCarData(); }) @@ -626,12 +637,13 @@ // 添加点击事件 marker.on("click", async (e) => { - this.showFlv=false + this.showFlv = false + if (this.opencARiD) { + window.hstVideoPlay.historyCloseVideo(this.opencARiD, '1'); + } this.opencARiD = item.id; console.log("点击了车辆", item); - if (this.opencARiD) { - window.hstVideoPlay.historyCloseVideo(this.opencARiD, '1'); - } + // 如果已经有视频在播放,先销毁 if (['17235341', '82296583'].includes(item.companyCode)) { @@ -653,7 +665,7 @@ }, 1000); }) }); - } else if(item.companyCode=='25439966') { + } else if (item.companyCode == '25439966') { this.IsHai = true; getRealVideo({ id: item.id }).then(res => { @@ -680,8 +692,8 @@ } }); }) - }else{ - this.showFlv=true; + } else { + this.showFlv = true; this.getVideoUrl(item.id) } this.infoWindow.open(this.map, e.target.getPosition()); @@ -701,7 +713,7 @@ } }); }), - + ]); this.initVideoPlayer(); @@ -715,7 +727,7 @@ }) ); - + } catch (error) { this.infoWindow.setContent( '<div style="padding: 20px;text-align: center;color: red;">获取车辆信息失败</div>' @@ -853,8 +865,8 @@ listRender(record) { return `<div style="background: #ffffff; padding: 24px 20px;z-index: 999"> - <div style="position: relative; width: 460px; height: 330px"> - <div v-if="${this.showFlv}" style="width: 460px; height: 330px; border-radius: 9px; background: #f5f5f5; display: flex; justify-content: center; align-items: center; flex-direction: column"> + <div style="position: relative; width: 460px; height: 380px"> + <div v-if="${this.showFlv}" style="width: 460px; height: 260px; border-radius: 9px; background: #f5f5f5; display: flex; justify-content: center; align-items: center; flex-direction: column"> <video ref="video" style="width: 460px; height: 330px; border-radius: 9px; display: none" @@ -866,9 +878,9 @@ </video> <el-empty description="暂无视频信息" :image-size="80"></el-empty> </div> - <div v-else style="position: absolute; left: 0; top: 0; width: 100%; height: 100%;"> - <div id="hstplayer" v-if="${!this.IsHai} style="width: 460px; height: 230px;"></div> - <div id="divPlugin" class="divPlugin" style="width: 460px; height: 230px;" ref="divPlugin" v-if="${this.IsHai}"> </div> + <div v-else style="position: absolute; left: 0; top: 0;width: 460px; height: 200px;"> + <div id="hstplayer" v-if="${!this.IsHai} style="width: 460px; height: 200px;"></div> + <div id="divPlugin" class="divPlugin" style="width: 460px; height: 200px;" ref="divPlugin" v-if="${this.IsHai}"> </div> </div> <div style="display: flex;justify-content: space-between;margin-top: 15px;margin-bottom: 12px;"> <div style="font-weight: 500;font-size: 18px;color: rgba(0, 0, 0, 0.85);line-height: 25px;">车牌号:${record.vehicleNumber || "" -- Gitblit v1.7.1