emergencyEvacuationBigOne.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  1. <!--应急疏散大屏(针对矿大增加了楼栋与楼层的选择)-->
  2. <template>
  3. <div class="emergencyEvacuationBig scrollbar-box">
  4. <div class="top-max-title-box">
  5. <p>{{title}}<span>{{address}}</span></p>
  6. <!--<p class="inquire-button-one" @click="clickClosure">{{evacuationType?'执行疏散':'结束疏散'}}</p>-->
  7. <p></p>
  8. <p></p>
  9. <p class="reset-button-one" v-if="buttonType" @click="goAllBig"><i class="el-icon-full-screen" style="margin-right:10px;"></i>全屏</p>
  10. <p class="reset-button-one" v-if="!buttonType" @click="clickBack"><i class="el-icon-full-screen" style="margin-right:10px;"></i>退出全屏</p>
  11. <p class="reset-button-one" style="margin-left:20px;" v-if="buttonType" @click="backButton">返回</p>
  12. </div>
  13. <div class="video-max-box">
  14. <div class="video-for-box" v-for="(item,index) in videoList" :key="index">
  15. <div class="video-for-title-box">
  16. <div class="video-for-title">{{item.name}}</div>
  17. <div class="video-for-button" @click="videoFullScreen(index)">
  18. <img src="@/assets/newImages/icon_monitor_enlarge.png">
  19. </div>
  20. </div>
  21. <video class="video-box" :id="item.divId" ref="videoRef" autoplay controls muted width="610px" height="429px"></video>
  22. </div>
  23. </div>
  24. <pagination
  25. layout="total, prev, pager, next, jumper"
  26. style="margin:0 40px 50px;"
  27. v-show="videoMaxNum>0"
  28. :page-sizes="[4]"
  29. :total="videoMaxNum"
  30. :page.sync="videoPage"
  31. :limit.sync="videoPageSize"
  32. @pagination="videoPageNumButton"
  33. />
  34. <div class="map-max-box">
  35. <div class="map-left-box">
  36. <!--<div class="max-title-box">-->
  37. <!--<p>{{address}}</p>-->
  38. <!--<p>疏散路径:</p>-->
  39. <!--<el-select v-model="value" placeholder="请选择" @change="lineEvacuate">-->
  40. <!--<el-option-->
  41. <!--v-for="item in routeList"-->
  42. <!--:key="item.id"-->
  43. <!--:label="item.name"-->
  44. <!--:value="item.id">-->
  45. <!--</el-option>-->
  46. <!--</el-select>-->
  47. <!--</div>-->
  48. <div class="map-big-box">
  49. <div class="map-min-box" :class="buttonId == '5'?'map-min-box-1':(buttonId == '6'?'map-min-box-2':(buttonId == '7'?'map-min-box-3':''))">
  50. <div class="map-min-for-box" :class="item.subjectId == subId?'map-min-for-box-color':''"
  51. v-for="(item,index) in fjList" :key="index">
  52. {{item.room}}
  53. </div>
  54. <!--<img class="map-min-img" src="@/assets/ZDimages/icon_sjt.gif" v-show="lightList[0].type">-->
  55. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif" v-show="lightList[0].type">
  56. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif" v-show="lightList[1].type">
  57. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif" v-show="lightList[2].type">
  58. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif" v-show="lightList[3].type">
  59. <img class="map-min-img" src="@/assets/ZDimages/icon_zjt.gif" v-show="lightList[4].type">
  60. <img class="map-min-img" src="@/assets/ZDimages/icon_yjt.gif" v-show="lightList[5].type">
  61. </div>
  62. </div>
  63. </div>
  64. <div class="map-right-box">
  65. <div class="bottom-max-box">
  66. <div class="select-button-box">
  67. <p class="select-button-title">疏散路径:</p>
  68. <div class="select-button-min-box">
  69. <el-select v-model="value" placeholder="请选择" @change="lineEvacuate" style="flex:1;">
  70. <el-option
  71. v-for="item in routeList"
  72. :key="item.id"
  73. :label="item.name"
  74. :value="item.id">
  75. </el-option>
  76. </el-select>
  77. <p class="inquire-button-one" @click="clickClosure">{{evacuationType?'执行疏散':'结束疏散'}}</p>
  78. </div>
  79. </div>
  80. <div class="select-button-box">
  81. <p class="select-button-title">疏散喇叭:</p>
  82. <div class="top-for-max-box">
  83. <div class="top-for-min-box" @click="trumpetClick(item)"
  84. :class="item.type?'for-color-a':'for-color-b'"
  85. v-for="(item,index) in trumpetList" :key="index">
  86. {{item.name}}
  87. <img v-if="item.type" src="@/assets/ZDimages/icon_30.png">
  88. </div>
  89. </div>
  90. </div>
  91. <div class="scrollbar-list scrollbar-box">
  92. <div class="for-scrollbar-box" v-for="(item,index) in informationList" :key="index">
  93. <p>{{item.date}}</p>
  94. <p>{{item.text}}</p>
  95. </div>
  96. <p v-if="!informationList[0]" style="line-height:40px;text-align: center;color:#999;font-size:14px;">暂无喇叭数据</p>
  97. </div>
  98. <div class="bottom-input-text-box">
  99. <el-input
  100. type="textarea"
  101. :rows="4"
  102. resize='none'
  103. maxLength="100"
  104. placeholder="请输入播报内容"
  105. v-model="textarea">
  106. </el-input>
  107. </div>
  108. <p class="bottom-button-p" @click="textParseUrlIps">发送</p>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. <script>
  115. import { lablayout, lineEvacuateTow } from "@/api/laboratory/emergencyEvacuation";
  116. import { getListStatus } from '@/api/bigData/index.js'
  117. import flvjs from 'flv.js'
  118. import { evacuate, closure, lineEvacuate,getRedis,getDeviceList,textParseUrlIps,getCameraByFloor,startUrl } from '@/api/executeThePlan.js'
  119. import mqtt from 'mqtt'
  120. import { subjectInfo } from "@/api/laboratory/subject";
  121. export default {
  122. name: 'emergencyEvacuationBig',
  123. props:{
  124. routerType:{},
  125. },
  126. data() {
  127. return {
  128. mtopic:"lab/exit/line",
  129. client:{},
  130. buttonType:false,
  131. subId:"",
  132. type:"",
  133. value:"0",
  134. title:"",
  135. address:"",
  136. //疏散方向数据
  137. routeList:[
  138. {
  139. id:"1",
  140. name:"向左疏散",
  141. },
  142. {
  143. id:"2",
  144. name:"向右疏散",
  145. },
  146. {
  147. id:"0",
  148. name:"两侧疏散",
  149. },
  150. ],
  151. //监控列表
  152. videoNewList:[],
  153. videoList:[],
  154. //房间列表
  155. fjList:[],
  156. //灯列表
  157. lightList:[
  158. {
  159. id:"5",
  160. type:false,
  161. },
  162. {
  163. id:"2",
  164. type:false,
  165. },
  166. {
  167. id:"3",
  168. type:false,
  169. },
  170. {
  171. id:"4",
  172. type:false,
  173. },
  174. {
  175. id:"1",
  176. type:false,
  177. },
  178. {
  179. id:"6",
  180. type:false,
  181. },
  182. ],
  183. //喇叭列表
  184. trumpetList:[],
  185. //消息列表
  186. informationList:[],
  187. textarea:"",
  188. evacuationType:false,
  189. //视频数据
  190. videoMaxNum:0,
  191. videoPage:1,
  192. videoPageSize:4,
  193. videoPageList:[],
  194. buildingId:null,
  195. buttonId:null
  196. }
  197. },
  198. created(){
  199. this.getRedis();
  200. //判断入口是否全屏路由地址
  201. if(this.routerType){
  202. //应急疏散页面进入
  203. this.buttonType = true;
  204. }else {
  205. //预案报警进入
  206. this.buttonType = false;
  207. }
  208. },
  209. mounted(){
  210. this.subscriptionMQTT();
  211. },
  212. methods:{
  213. //获取实验室的疏散数据
  214. lineEvacuateTow(id,type){
  215. lineEvacuateTow(id,type).then(response => {
  216. this.initialization(response.data);
  217. });
  218. },
  219. getCameraByFloor(){
  220. getCameraByFloor({floorId:this.buttonId}).then(response => {
  221. let videoList = response.data;
  222. subjectInfo(this.subId,0).then(res => {
  223. if (res.data.labHardwareVOList){
  224. for(let i=0;i<res.data.labHardwareVOList.length;i++){
  225. if(res.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  226. videoList.unshift(res.data.labHardwareVOList[i].hardwareNUM);
  227. }
  228. }
  229. }
  230. videoList = [...new Set(videoList)]
  231. if (videoList[0]){
  232. this.startUrl(videoList);
  233. }
  234. })
  235. });
  236. },
  237. //文字转语音播放
  238. textParseUrlIps(){
  239. let self = this;
  240. let num = 0;
  241. let newList = [];
  242. for(let i=0;i<self.trumpetList.length;i++){
  243. if(self.trumpetList[i].type){
  244. let obj = {
  245. sn:self.trumpetList[i].deviceSn,
  246. port:self.trumpetList[i].port,
  247. deviceIp:self.trumpetList[i].deviceIp,
  248. type:"",
  249. name:"",
  250. speed:"",
  251. params:{
  252. tid:"",
  253. vol:self.trumpetList[i].deviceVol,
  254. urls:[]
  255. }
  256. };
  257. newList.push(obj);
  258. num++
  259. }
  260. }
  261. if(num == 0){
  262. this.msgError("请选择要播放的喇叭")
  263. return
  264. }
  265. if(!this.textarea){
  266. this.msgError("请输入要播放的内容")
  267. return
  268. }
  269. textParseUrlIps(newList,this.textarea).then(response => {
  270. console.log('response',response);
  271. this.textarea = "";
  272. let newObj = {
  273. date:response.data.date,
  274. text:response.data.text,
  275. };
  276. this.informationList.push(newObj);
  277. this.msgSuccess("操作成功")
  278. });
  279. },
  280. //喇叭选中
  281. trumpetClick(item){
  282. item.type = !item.type;
  283. if(item.type==true){
  284. this.trumpetList.forEach(function(item2) {
  285. if(item2.deviceSn==item.deviceSn){
  286. item2.type=true
  287. }else{
  288. item2.type=false
  289. }
  290. })
  291. }
  292. },
  293. //获取喇叭列表
  294. getDeviceList(){
  295. let obj ={
  296. subId:this.subId,
  297. floorId:this.buttonId,
  298. page:1,
  299. pageSize:100,
  300. };
  301. getDeviceList(obj).then(response => {
  302. for(let i=0;i<response.data.length;i++){
  303. response.data[i].type = false;
  304. }
  305. this.$set(this,'trumpetList',response.data)
  306. });
  307. },
  308. //MQTT订阅
  309. subscriptionMQTT(){
  310. let self = this;
  311. this.client = mqtt.connect(localStorage.getItem('mqttUrl'), {
  312. username: localStorage.getItem('mqttUser'),
  313. password: localStorage.getItem('mqttPassword')
  314. });
  315. this.client.on("connect", e =>{
  316. // console.log("连接成功");
  317. this.client.subscribe(this.mtopic, (err) => {
  318. if (!err) {
  319. // console.log("订阅成功:" + this.mtopic);
  320. }
  321. });
  322. });
  323. this.client.on("message", (topic, message) => {
  324. if (message){
  325. let data = JSON.parse(message)
  326. if(topic == this.mtopic){
  327. // console.log("应急疏散数据变更",data);
  328. //应急疏散数据变更
  329. if(data.data.EXIT_LINE_MESSAGE){
  330. this.evacuate();
  331. self.evacuationType = false;
  332. }else{
  333. if(self.evacuationType){
  334. self.msgSuccess("应急疏散已结束");
  335. }
  336. self.evacuationType = true;
  337. // self.$router.push({
  338. // path: "/emergencyManagement/evacuation/performEvacuation"
  339. // })
  340. // this.$parent.backPage();
  341. }
  342. }
  343. }
  344. });
  345. },
  346. //获取当前疏散状态
  347. getRedis(){
  348. let self = this;
  349. getRedis().then( data => {
  350. if(data.data){
  351. this.subId = data.data.subId;
  352. this.title = data.data.subName;
  353. this.buildingId = data.data.buildId;
  354. this.buttonId = data.data.floorId;
  355. this.address = data.data.deptName+'-'+data.data.buildName+'-'+data.data.floorName;
  356. this.evacuationType = false;
  357. this.evacuate();
  358. this.getDeviceList();
  359. }else{
  360. if(localStorage.getItem('evacuationSubId')){
  361. // console.log("1=================>")
  362. this.subId = localStorage.getItem('evacuationSubId');
  363. this.title = localStorage.getItem('evacuationTitel');
  364. this.buttonId = localStorage.getItem('evacuationButtonId');
  365. this.buildingId = localStorage.getItem('evacuationBuildingId');
  366. this.address = localStorage.getItem('evacuationAddress');
  367. localStorage.removeItem('evacuationSubId')
  368. localStorage.removeItem('evacuationTitel')
  369. localStorage.removeItem('evacuationButtonId')
  370. localStorage.removeItem('evacuationBuildingId')
  371. localStorage.removeItem('evacuationAddress')
  372. }else{
  373. this.subId = this.$route.query.subId;
  374. this.title = this.$route.query.text;
  375. this.buttonId = this.$route.query.buttonId;
  376. this.buildingId = this.$route.query.buildingId;
  377. this.address = this.$route.query.address;
  378. }
  379. this.evacuationType = true;
  380. this.lineEvacuateTow(this.subId,0);
  381. this.getDeviceList();
  382. }
  383. this.lablayout();
  384. });
  385. },
  386. //获取实验室数据
  387. lablayout(){
  388. let self = this;
  389. let id = this.buildingId;
  390. lablayout(id).then(response => {
  391. // console.log("response.dataresponse.dataresponse.dataresponse.data",response.data)
  392. for(let i=0;i<response.data.length;i++){
  393. if(response.data[i].id == this.buttonId){
  394. self.fjList = response.data[i].list;
  395. }
  396. }
  397. });
  398. },
  399. //执行预案
  400. evacuate(){
  401. let self = this;
  402. evacuate(this.subId).then( data => {
  403. if(data.code == 200){
  404. if(data.data){
  405. this.initialization(data.data);
  406. }
  407. }
  408. });
  409. },
  410. //结束预案
  411. clickClosure(){
  412. let self = this;
  413. if (this.evacuationType){
  414. this.$confirm('是否确认执行疏散?', "警告", {
  415. confirmButtonText: "确定",
  416. cancelButtonText: "取消",
  417. type: "warning"
  418. }).then(function() {
  419. self.lineEvacuate(0);
  420. }).then(() => {
  421. }).catch(() => {});
  422. } else {
  423. this.$confirm('是否确认结束疏散?', "警告", {
  424. confirmButtonText: "确定",
  425. cancelButtonText: "取消",
  426. type: "warning"
  427. }).then(function() {
  428. self.closure();
  429. }).then(() => {
  430. }).catch(() => {});
  431. }
  432. },
  433. closure(){
  434. let self = this;
  435. closure(this.subId).then( data => {
  436. if(data.code == 200){
  437. this.evacuationType = true;
  438. self.msgSuccess("操作成功")
  439. // self.$router.push({
  440. // path: "/emergencyManagement/evacuation/performEvacuation"
  441. // })
  442. // this.$parent.backPage();
  443. console.log("结束",data)
  444. }
  445. });
  446. },
  447. //切换线路
  448. lineEvacuate(e){
  449. let self = this;
  450. lineEvacuate(this.subId,e).then( data => {
  451. if(data.code == 200){
  452. self.msgSuccess("操作成功")
  453. if(data.data){
  454. this.initialization(data.data);
  455. this.evacuationType = false;
  456. }
  457. }
  458. });
  459. },
  460. //灯初始化
  461. initialization(list){
  462. let self = this;
  463. let newList = [
  464. {
  465. id:"5",
  466. type:false,
  467. },
  468. {
  469. id:"2",
  470. type:false,
  471. },
  472. {
  473. id:"3",
  474. type:false,
  475. },
  476. {
  477. id:"4",
  478. type:false,
  479. },
  480. {
  481. id:"1",
  482. type:false,
  483. },
  484. {
  485. id:"6",
  486. type:false,
  487. },
  488. ];
  489. for(let i=0;i<list.length;i++){
  490. for(let o=0;o<newList.length;o++){
  491. if(list[i].lightId == newList[o].id){
  492. newList[o].type = true;
  493. }
  494. }
  495. }
  496. this.lightList = newList;
  497. this.getCameraByFloor();
  498. },
  499. goAllBig(){
  500. this.$router.push({
  501. path: "/emergencyEvacuationBig",
  502. query: {
  503. subId: this.subId,
  504. text:this.title,
  505. buttonId : this.buttonId,
  506. buildingId : this.buildingId,
  507. type:"2",
  508. }
  509. })
  510. },
  511. //返回方法
  512. clickBack(){
  513. let self = this;
  514. self.$router.push({
  515. path: "/emergencyManagement/evacuation/performEvacuation",
  516. query: {
  517. subId: self.subId,
  518. text:self.title,
  519. buttonId : self.buttonId,
  520. buildingId : self.buildingId,
  521. }
  522. })
  523. },
  524. //返回按钮
  525. backButton(){
  526. let self = this;
  527. for(let i=0;i<self.videoNewList.length;i++){
  528. self.videoNewList[i].flvPlayer.pause();
  529. self.videoNewList[i].flvPlayer.unload();
  530. self.videoNewList[i].flvPlayer.detachMediaElement();
  531. self.videoNewList[i].flvPlayer.destroy();
  532. self.videoNewList[i].flvPlayer = null
  533. }
  534. this.$set(this,'videoNewList',[]);
  535. this.$parent.goPage(1);
  536. },
  537. //视屏全屏方法
  538. videoFullScreen(index){
  539. this.$refs.videoRef[index].webkitRequestFullScreen();
  540. },
  541. //获取摄像头地址
  542. async startUrl(rows){
  543. let self = this;
  544. let list = "";
  545. for(let i=0;i<rows.length;i++){
  546. list = list + rows[i]+","
  547. }
  548. let obj = {
  549. page:"1",
  550. count:"100",
  551. deviceIds:list,
  552. };
  553. let urlText = window.location.href;
  554. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  555. const { data } = await startUrl(obj);
  556. if(data){
  557. self.videoPageList = [];
  558. for(let i=0;i<data.length;i++){
  559. let obj = {
  560. divId:'divId'+i,
  561. hasAudio:false,
  562. height:false,
  563. videoError:"",
  564. videoUrl:data[i].result.body.data.ws_flv,
  565. }
  566. self.videoPageList.push(obj)
  567. }
  568. this.videoMaxNum = this.videoPageList.length
  569. this.videoPageNumButton({page:1,limit:4});
  570. }
  571. } else {
  572. const { data } = await startUrl(obj);
  573. if(data){
  574. self.videoPageList = [];
  575. for(let i=0;i<data.length;i++){
  576. let text = localStorage.getItem('cameraUrl');
  577. let url = data[i].result.body.data.ws_flv;
  578. url = url.split("rtp/");
  579. let newUrl = text+'rtp/'+url[1];
  580. let obj = {
  581. divId:'divId'+i,
  582. hasAudio:false,
  583. height:false,
  584. videoError:"",
  585. videoUrl:newUrl,
  586. }
  587. self.videoPageList.push(obj)
  588. }
  589. this.videoMaxNum = this.videoPageList.length
  590. this.videoPageNumButton({page:1,limit:4});
  591. }
  592. }
  593. },
  594. //视频翻页处理
  595. videoPageNumButton(val){
  596. this.loading = true;
  597. let self = this;
  598. //清除已有播放流
  599. if(self.videoNewList[0]){
  600. for(let i=0;i<self.videoNewList.length;i++){
  601. self.videoNewList[i].flvPlayer.pause();
  602. self.videoNewList[i].flvPlayer.unload();
  603. self.videoNewList[i].flvPlayer.detachMediaElement();
  604. self.videoNewList[i].flvPlayer.destroy();
  605. self.videoNewList[i].flvPlayer = null;
  606. }
  607. self.videoNewList = [];
  608. }
  609. //计算新数据
  610. let num = 0;
  611. let numMax = val.page * val.limit;
  612. if(val.page!=0){
  613. num = ( val.page - 1 ) * val.limit
  614. }
  615. if(numMax>self.videoPageList.length){
  616. numMax = self.videoPageList.length;
  617. }
  618. let list = [];
  619. for(let i=num;i<numMax;i++){
  620. list.push(self.videoPageList[i]);
  621. }
  622. this.$set(this,'videoList',list);
  623. setTimeout(function(){
  624. self.videoPlay();
  625. },500);
  626. },
  627. videoPlay(){
  628. let self = this;
  629. this.loading = false;
  630. for(let i=0;i<self.videoList.length;i++){
  631. let obj = {
  632. player :{},
  633. flvPlayer:{}
  634. };
  635. obj.player = document.getElementById(self.videoList[i].divId);
  636. obj.flvPlayer = flvjs.createPlayer(
  637. {
  638. // isLive: true, //=> 是否为直播流
  639. // hasAudio: false, //=> 是否开启声音
  640. type: 'flv', //媒体类型 flv 或 mp4
  641. url: self.videoList[i].videoUrl //视频流地址
  642. },
  643. {
  644. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  645. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  646. isLive: true,//是否是直播
  647. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  648. autoCleanupSourceBuffer: true,//进行自动清理
  649. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  650. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  651. }
  652. );
  653. self.videoNewList.push(obj);
  654. // }
  655. console.log("i",i)
  656. }
  657. for(let i=0;i<self.videoNewList.length;i++){
  658. self.videoNewList[i].flvPlayer.attachMediaElement(self.videoNewList[i].player);
  659. self.videoNewList[i].flvPlayer.load(); //加载
  660. self.videoNewList[i].flvPlayer.play(); //加载
  661. }
  662. },
  663. videoFunction(){
  664. let self = this;
  665. // self.videoList = [];
  666. for(let i=0;i<self.checkedSubject.videoData.length;i++){
  667. let obj = {
  668. player :{},
  669. flvPlayer:{}
  670. };
  671. obj.player = document.getElementById(self.checkedSubject.videoData[i].divId);
  672. // if (flvjs.isSupported()) {
  673. obj.flvPlayer = flvjs.createPlayer(
  674. {
  675. // isLive: true, //=> 是否为直播流
  676. // hasAudio: false, //=> 是否开启声音
  677. type: self.checkedSubject.videoData[i].videoType, //媒体类型 flv 或 mp4
  678. url: self.checkedSubject.videoData[i].url //视频流地址
  679. },
  680. {
  681. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  682. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  683. isLive: true,//是否是直播
  684. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  685. autoCleanupSourceBuffer: true,//进行自动清理
  686. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  687. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  688. }
  689. );
  690. self.videoList.push(obj);
  691. // }
  692. console.log("i",i)
  693. }
  694. for(let i=0;i<self.videoList.length;i++){
  695. self.videoList[i].flvPlayer.attachMediaElement(self.videoList[i].player);
  696. self.videoList[i].flvPlayer.load(); //加载
  697. self.videoList[i].flvPlayer.play(); //加载
  698. }
  699. },
  700. //取消订阅关闭MQTT连接
  701. offMQTT(){
  702. this.client.unsubscribe(this.mtopic, error => {
  703. if (error) {
  704. console.log('Unsubscribe error', error)
  705. }
  706. })
  707. this.client.end();
  708. this.client = {};
  709. },
  710. },
  711. beforeDestroy() {
  712. //清除定时器
  713. let self = this;
  714. self.offMQTT();
  715. console.log("beforeDestroy");
  716. },
  717. }
  718. </script>
  719. <style scoped lang="scss">
  720. .emergencyEvacuationBig{
  721. height:100%;
  722. width:100%;
  723. display: flex !important;
  724. flex-direction: column;
  725. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  726. overflow-y:scroll;
  727. p{
  728. margin:0;
  729. }
  730. .top-max-title-box{
  731. display: flex;
  732. padding:0 30px;
  733. p{
  734. margin:27px 0;
  735. }
  736. p:nth-child(1){
  737. font-size:18px;
  738. font-weight:700;
  739. color:#0045AF;
  740. line-height:40px;
  741. span{
  742. color:#999;
  743. font-size:14px;
  744. margin-left:20px;
  745. }
  746. }
  747. p:nth-child(2){
  748. margin-left:70px;
  749. width:120px;
  750. }
  751. p:nth-child(3){
  752. flex:1;
  753. }
  754. p:nth-child(4){
  755. width:120px;
  756. }
  757. }
  758. .video-max-box{
  759. .video-for-box{
  760. display: inline-block;
  761. width:348px;
  762. /*height:260px;*/
  763. height:196px;
  764. position: relative;
  765. margin:0 0 30px 30px;
  766. .video-for-title-box{
  767. position: absolute;
  768. top:0;
  769. left:0;
  770. width:348px;
  771. height:40px;
  772. background: rgba(0,0,0,0.2);
  773. display: flex;
  774. z-index:10;
  775. .video-for-title{
  776. flex:1;
  777. color:#fff;
  778. font-size:14px;
  779. line-height:40px;
  780. display: block;
  781. overflow:hidden;
  782. text-overflow:ellipsis;
  783. white-space:nowrap;
  784. padding:0 17px;
  785. }
  786. .video-for-button{
  787. width:40px;
  788. height:40px;
  789. cursor: pointer;
  790. img{
  791. height:20px;
  792. width:20px;
  793. margin:10px;
  794. }
  795. }
  796. }
  797. .video-box{
  798. /*height:260px;*/
  799. height:196px;
  800. width:348px;
  801. }
  802. }
  803. }
  804. .pagination-container{
  805. margin:0;
  806. }
  807. .map-max-box{
  808. flex:1;
  809. margin-left:18px;
  810. display: flex;
  811. .map-left-box{
  812. width:1143px;
  813. .max-title-box{
  814. display: flex;
  815. margin:0 0 25px;
  816. p:nth-child(1){
  817. line-height:40px;
  818. font-size:18px;
  819. font-weight:700;
  820. color:#094CB2;
  821. }
  822. p:nth-child(2){
  823. flex:1;
  824. line-height:40px;
  825. text-align: right;
  826. font-size:16px;
  827. }
  828. }
  829. .map-big-box{
  830. width:1143px;
  831. height:610px;
  832. border:1px solid #E0E0E0;
  833. margin-bottom:20px;
  834. overflow: hidden;
  835. .map-min-box{
  836. /*height:505px;*/
  837. /*width:1133px;*/
  838. /*margin:50px auto;*/
  839. /*background: url("../assets/ZDimages/icon_bj_syspmtcy_jinan.png");*/
  840. /*position: relative;*/
  841. .map-min-for-box{
  842. overflow: hidden;
  843. display: inline-block;
  844. line-height:150px;
  845. text-align: center;
  846. }
  847. .map-min-for-box-color{
  848. background: rgba(0,189,255,0.3);
  849. }
  850. .map-min-img{
  851. position: absolute;
  852. width:40px;
  853. height:28px;
  854. }
  855. }
  856. }
  857. }
  858. .map-right-box{
  859. flex:1;
  860. display: flex;
  861. flex-direction: column;
  862. height:610px;
  863. overflow: hidden;
  864. margin:0 10px 20px;
  865. .top-for-max-box{
  866. margin-left:15px;
  867. .top-for-min-box{
  868. width:110px;
  869. height:40px;
  870. line-height:40px;
  871. font-size:14px;
  872. padding:0 10px;
  873. display: inline-block;
  874. margin:0 13px 18px 0;
  875. border-radius:4px;
  876. cursor: pointer;
  877. position: relative;
  878. overflow: hidden;
  879. img{
  880. width:25px;
  881. height:25px;
  882. position: absolute;
  883. right:0;
  884. bottom:0;
  885. }
  886. }
  887. .for-color-a{
  888. border:1px solid #0183FA;
  889. color:#0183FA;
  890. }
  891. .for-color-b{
  892. border:1px solid #CCCCCC;
  893. color:#CCCCCC;
  894. }
  895. }
  896. .bottom-max-box{
  897. flex:1;
  898. display: flex;
  899. flex-direction: column;
  900. border:1px solid #E0E0E0;
  901. overflow: hidden;
  902. .select-button-box{
  903. font-weight:500;
  904. .select-button-title{
  905. font-size:14px;
  906. margin-left:15px;
  907. line-height:40px;
  908. color:#333;
  909. }
  910. .select-button-min-box{
  911. display: flex;
  912. margin-left:15px;
  913. .inquire-button-one{
  914. margin:0 20px;
  915. width:100px;
  916. font-size:14px;
  917. line-height:40px;
  918. height:40px;
  919. }
  920. }
  921. }
  922. .scrollbar-list{
  923. flex:1;
  924. .for-scrollbar-box{
  925. font-size:14px;
  926. margin:0 15px;
  927. p:nth-child(1){
  928. line-height:40px;
  929. text-align: center;
  930. color:#999;
  931. font-weight:500;
  932. }
  933. p:nth-child(2){
  934. color:#666;
  935. line-height:18px;
  936. font-weight:500;
  937. }
  938. }
  939. }
  940. .bottom-input-text-box{
  941. height:96px;
  942. margin:20px 20px 0;
  943. }
  944. .bottom-button-p{
  945. background:#0183FA;
  946. color:#fff;
  947. font-size:16px;
  948. text-align: center;
  949. line-height:40px;
  950. border-radius:10px;
  951. margin:20px 40px;
  952. cursor: pointer;
  953. }
  954. }
  955. }
  956. }
  957. }
  958. </style>