forestDanger.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <!--可视化公共模板 林业-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <supermap ref="supermap" style="width: 100%;height: 100vh;" class="indexSupermapClass" :mapDiv="'forestMap'"
  9. :dynamicPlotting="false"
  10. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"
  11. @showDangerDialog="showDangerDialog"/>
  12. <!-- 右侧 -->
  13. <div class="rightbar rightbar-index" ref="right">
  14. <div class="right-item1">
  15. </div>
  16. <div class="right-item2">
  17. <!-- 日历 -->
  18. <div class="forthis">
  19. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  20. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  21. <div class="i-list-con small-bottom-margin h-30">
  22. <dateChoose @selectDay="selectDay"></dateChoose>
  23. </div>
  24. </dv-border-box-13>
  25. </div>
  26. <!-- 隐患列表 -->
  27. <div class="forthis">
  28. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  29. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  30. <div class="this-title">
  31. <span>隐患列表</span>
  32. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  33. </div>
  34. <div class="i-list-con small-bottom-margin h-44">
  35. <div class="event-list-search">
  36. <el-input
  37. placeholder="请输入搜索企业"
  38. prefix-icon="el-icon-search"
  39. v-model="eventSearch" @change="searchEvent(eventSearch)">
  40. </el-input>
  41. </div>
  42. <div class="d-l-con padding-box nowrap" v-for="(item,index) in dangerList"
  43. @click="dropLocation(item.latitude,item.longitude)" data-html2canvas-ignore>
  44. <div class="bgt-img">
  45. <!-- <img v-if="item.picturePath!=null&&item.picturePath!='' && item.pictureType=='image'"-->
  46. <!-- :src="item.picturePath"-->
  47. <!-- style="width: 93px;height: 64px" loading="lazy"/>-->
  48. <img src="../assets/images/integrated/event-img-sub.png" style="width: 93px;height: 64px"/>
  49. </div>
  50. <div class="bgt-info">
  51. <div v-if="item.dangerStatus=='trouble_status_2'" class="event-state-qs">
  52. <i class="el-icon-caret-left"></i>
  53. <div class="event-list-state-qs">
  54. {{item.dangerStatusLabel}}
  55. </div>
  56. </div>
  57. <div v-if="item.dangerStatus=='trouble_status_3'" class="event-state-bj">
  58. <i class="el-icon-caret-left"></i>
  59. <div class="event-list-state-bj">
  60. {{item.dangerStatusLabel}}
  61. </div>
  62. </div>
  63. <div class="bgt-info-name">{{ item.enterpriseName }} {{ item.dangerTitle }}</div>
  64. <div class="bgt-info-place">
  65. <ul>
  66. <li>{{ item.createTime }}</li>
  67. </ul>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </dv-border-box-13>
  73. </div>
  74. </div>
  75. </div>
  76. <vBottomMenu ref="bottomMenu" @stopAudio="stopAudio" ></vBottomMenu>
  77. </div>
  78. <audio id="resource" ref="up" :src="audioSrc" controls style="display: none;"></audio>
  79. <dangerdetailsdialog ref="dangerdetailsdialog" :calendarDay="calendarDay"
  80. :bigEventTypeId="bigEventTypeId" :smallEventTypeId="smallEventTypeId"
  81. @getAllDanger="getAllDanger"></dangerdetailsdialog>
  82. <firespread ref="firespread" :calendarDay="calendarDay" @getAllDanger="getAllDanger" @showDangerDialog="showDangerDialog"></firespread>
  83. <eventLocation ref="eventLocation"></eventLocation>
  84. <TVWall ref="TVWall"></TVWall>
  85. </div>
  86. </template>
  87. <script>
  88. import dateChoose from '@/views/dateForestDanger.vue'//日历
  89. /** ----------------------------------weosocket开始------------------------------------- */
  90. import Cookies from 'js-cookie'
  91. /** ----------------------------------weosocket结束------------------------------------- */
  92. import {
  93. getAllDanger
  94. } from '@/api/forest'
  95. // import {
  96. // getEventByEventType
  97. // } from '@/api/village'
  98. import supermap from '@/components/supermap' //超图
  99. import supermapNotProcessed from '@/components/supermap' //超图
  100. import supermapProcessed from '@/components/supermap' //超图
  101. import vheader from '@/components/v-header.vue' //一体化共用头部
  102. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  103. import eventLocation from '@/components/eventLocation.vue' //隐患定位弹窗
  104. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  105. import dangerdetailsdialog from '@/views/dangerdetailsdialog.vue' //隐患详情弹窗
  106. import firespread from '@/views/firespread.vue' //隐患详情弹窗
  107. /** ----------------------------------摄像头预览开始------------------------------------- */
  108. import {
  109. getDahuaVideoServer
  110. } from '@/api/dahua/dahua'
  111. import DHWs from '@/dahua/lib/DHWs'
  112. /** ----------------------------------摄像头预览结束------------------------------------- */
  113. let echarts = require('echarts')
  114. export default {
  115. components: {
  116. supermap,
  117. supermapNotProcessed,
  118. supermapProcessed,
  119. vheader,
  120. vBottomMenu,
  121. eventLocation,
  122. TVWall,
  123. dateChoose,
  124. dangerdetailsdialog,
  125. firespread
  126. },
  127. created() {
  128. /** ----------------------------------摄像头预览开始------------------------------------- */
  129. const DHWsInstance = DHWs.getInstance()
  130. this.ws = DHWsInstance
  131. /** ----------------------------------摄像头预览结束------------------------------------- */
  132. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  133. window.showDialog = this.showDialog
  134. window.choseLayerSwitching = this.choseLayerSwitching
  135. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  136. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  137. },
  138. mounted() {
  139. // this.getEventByEventType(this.getCurrentDataStr())
  140. this.getAllDanger(this.getCurrentDataStr(),false)
  141. /** ----------------------------------weosocket开始------------------------------------- */
  142. // this.initWebSocket()
  143. /** ----------------------------------weosocket结束------------------------------------- */
  144. this.selectTaskList()//获取任务
  145. // setInterval(() => {
  146. // if(this.calendarDay == this.getCurrentDataStr()){
  147. // this.getAllDanger(this.getCurrentDataStr(),0,0,true);
  148. // this.getEventByEventType(this.getCurrentDataStr(),true);
  149. // }
  150. // }, 10000)
  151. },
  152. data() {
  153. return {
  154. //警报MP3文件
  155. audioSrc:require('@/assets/jingbao.mp3'),
  156. calendarDay: this.getCurrentDataStr(),
  157. //左侧部门隐患数量
  158. villageTypeXlList: [],
  159. //右侧隐患列表
  160. dangerList: [],
  161. dangerListnew: [],
  162. dangerListAll: [],
  163. eventSearch: '',//隐患列表搜索
  164. listCurrentIndex1: '',
  165. bigEventTypeId: '',
  166. smallEventTypeId: '',
  167. /** ----------------------------------weosocket开始------------------------------------- */
  168. weosocket: false,
  169. websock: '',
  170. setIntervalWesocketPush: null,
  171. /** ----------------------------------weosocket结束------------------------------------- */
  172. /** ----------------------------------摄像头预览开始------------------------------------- */
  173. activePanel: 'key1',
  174. isLogin: false,
  175. cameraParams: [],
  176. ws: null,
  177. /** ----------------------------------摄像头预览结束------------------------------------- */
  178. markersList: [], //点位列表
  179. cameraList: [] //摄像头列表
  180. }
  181. },
  182. /** ----------------------------------weosocket开始------------------------------------- */
  183. destroyed() { //离开页面关闭Socket连接
  184. if (this.websock) {
  185. clearInterval(this.setIntervalWesocketPush)
  186. this.websock.close()
  187. this.websock = null
  188. }
  189. },
  190. /** ----------------------------------weosocket结束------------------------------------- */
  191. methods: {
  192. searchEvent(eventSearch) {
  193. let that = this
  194. //隐患列表搜索
  195. this.dangerListnew = []
  196. if (eventSearch != null && eventSearch != '') {
  197. for (var i = 0; i < this.dangerListAll.length; i++) {
  198. if (this.dangerListAll[i].enterpriseName.indexOf(eventSearch) > -1) {
  199. this.dangerListnew.push(this.dangerListAll[i])
  200. }
  201. }
  202. this.dangerList = this.dangerListnew
  203. } else {
  204. this.dangerList = this.dangerListAll
  205. }
  206. if (this.dangerList != null && this.dangerList.length > 0) {
  207. for (let i = 0; i < this.dangerList.length; i++) {
  208. let markersMap = {
  209. lng: 124.59,
  210. lat: 43.02,
  211. icon: 'marker',
  212. bindPopupHtml: '',
  213. click: '',
  214. parameter: '',
  215. keepBindPopup: false,
  216. isAggregation: false
  217. }
  218. markersMap.click = 'showDangerDialog'
  219. markersMap.parameter = this.dangerList[i].id
  220. markersMap.isAggregation = true
  221. if (this.dangerList[i].dangerStatus == 'trouble_status_2') {
  222. markersMap.icon = 'sj-icon-map-qianshou'
  223. } else if (this.dangerList[i].dangerStatus == 'trouble_status_3') {
  224. markersMap.icon = 'sj-icon-map-banjie'
  225. }
  226. markersMap.lng = this.dangerList[i].longitude
  227. markersMap.lat = this.dangerList[i].latitude
  228. markersMap.bindPopupHtml = '<div class="map-tip">' +
  229. '<span>' +
  230. ' <div class="d-l-con">' +
  231. ' <div class="d-l-l-text">' +
  232. ' <h4>经纬度:' + this.dangerList[i].longitude + ',' + this.dangerList[i].latitude + '</h4>' +
  233. ' </div>' +
  234. ' </div>' +
  235. ' </span>' +
  236. '<span>' +
  237. ' <div class="d-l-con">' +
  238. ' <div class="d-l-l-text">' +
  239. ' <h4>隐患名称:' + this.dangerList[i].eventName + '</h4>' +
  240. ' </div>' +
  241. ' </div>' +
  242. ' </span>' +
  243. '<span>' +
  244. ' <div class="d-l-con">' +
  245. ' <div class="d-l-l-text">' +
  246. ' <h4>隐患时间:' + this.dangerList[i].createTime + '</h4>' +
  247. ' </div>' +
  248. ' </div>' +
  249. ' </span>'
  250. if (this.dangerList[i].picturePath != null && this.dangerList[i].picturePath != '' && this.dangerList[i].pictureType=='image') {
  251. markersMap.bindPopupHtml += '<span>' +
  252. ' <div class="d-l-con">' +
  253. ' <div class="d-l-l-text">' +
  254. '<img src="' + this.dangerList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  255. ' </div>' +
  256. ' </div>' +
  257. ' </span>'
  258. }
  259. markersMap.bindPopupHtml += '</div>'
  260. that.markersList.push(markersMap)
  261. }
  262. setTimeout(() => {
  263. that.$refs.supermap.clearM(false)
  264. that.$refs.supermap.clearM(true)
  265. that.$refs.supermap.setMarkers(that.markersList)
  266. }, 2000)
  267. } else {
  268. setTimeout(() => {
  269. that.$refs.supermap.clearM(false)
  270. that.$refs.supermap.clearM(true)
  271. }, 2000)
  272. }
  273. },
  274. dropLocation(lat, lng) {
  275. this.$refs.supermap.dropLocation(lat, lng)
  276. },
  277. showDangerDialog(dangerId) {
  278. //隐患信息弹出
  279. this.$refs.dangerdetailsdialog.showDangerDialog(dangerId)
  280. },
  281. getFirespread(eventCode){
  282. this.$refs.firespread.showDangerDialog(eventCode);
  283. },
  284. getCurrentDataStr() {
  285. let date = new Date()
  286. let y = date.getFullYear()
  287. let m = date.getMonth() + 1
  288. m = m < 10 ? '0' + m : m
  289. let d = date.getDate()
  290. d = d < 10 ? '0' + d : d
  291. return y + '-' + m + '-' + d
  292. },
  293. selectDay(day) {//日历点击
  294. // this.getEventByEventType(day)
  295. this.getAllDanger(day,false)
  296. this.calendarDay = day
  297. },
  298. selectTaskList() {
  299. this.$refs.bottomMenu.selectTaskList()
  300. },
  301. // getEventByEventType(day,loading) {
  302. // let that = this
  303. // //左侧获取隐患部门数量
  304. // getEventByEventType({ day: day },loading).then(res => {
  305. // this.villageTypeXlList = res.data
  306. // })
  307. // },
  308. getAllDanger(day,loading) {
  309. let that = this
  310. this.dangerList = []
  311. this.dangerListAll = []
  312. //右侧获取隐患列表
  313. getAllDanger({
  314. createDate: day
  315. },loading).then(res => {
  316. this.dangerList = res.data
  317. this.dangerListAll = res.data
  318. that.markersList = []
  319. if (this.dangerList != null && this.dangerList.length > 0) {
  320. if(this.dangerList[0].eventStatusValue == 'forest_event_status_1'){
  321. that.$refs.bottomMenu.updateAlert();
  322. that.$refs.up.play();
  323. }
  324. for (let i = 0; i < this.dangerList.length; i++) {
  325. let markersMap = {
  326. lng: 124.59,
  327. lat: 43.02,
  328. icon: 'marker',
  329. bindPopupHtml: '',
  330. click: '',
  331. parameter: '',
  332. keepBindPopup: false,
  333. isAggregation: false
  334. }
  335. markersMap.isAggregation = true
  336. markersMap.click = 'showDangerDialog'
  337. markersMap.parameter = this.dangerList[i].id
  338. if (this.dangerList[i].dangerStatus == 'trouble_status_2') {
  339. markersMap.icon = 'sj-icon-map-qianshou'
  340. } else if (this.dangerList[i].dangerStatus == 'trouble_status_3') {
  341. markersMap.icon = 'sj-icon-map-banjie'
  342. }
  343. markersMap.lng = this.dangerList[i].longitude
  344. markersMap.lat = this.dangerList[i].latitude
  345. markersMap.bindPopupHtml = '<div class="map-tip">' +
  346. '<span>' +
  347. ' <div class="d-l-con">' +
  348. ' <div class="d-l-l-text">' +
  349. ' <h4>经纬度:' + this.dangerList[i].longitude + ',' + this.dangerList[i].latitude + '</h4>' +
  350. ' </div>' +
  351. ' </div>' +
  352. ' </span>' +
  353. '<span>' +
  354. ' <div class="d-l-con">' +
  355. ' <div class="d-l-l-text">' +
  356. ' <h4>隐患名称:' + this.dangerList[i].dangerTitle + '</h4>' +
  357. ' </div>' +
  358. ' </div>' +
  359. ' </span>' +
  360. '<span>' +
  361. ' <div class="d-l-con">' +
  362. ' <div class="d-l-l-text">' +
  363. ' <h4>隐患时间:' + this.dangerList[i].createTime + '</h4>' +
  364. ' </div>' +
  365. ' </div>' +
  366. ' </span>'+
  367. '<span>' +
  368. ' <div class="d-l-con">' +
  369. ' <div class="d-l-l-text">' +
  370. ' <h4>隐患状态:' + this.dangerList[i].dangerStatusLabel + '</h4>' +
  371. ' </div>' +
  372. ' </div>' +
  373. ' </span>'+
  374. '<span>' +
  375. ' <div class="d-l-con">' +
  376. ' <div class="d-l-l-text">' +
  377. ' <h4>隐患企业:' + this.dangerList[i].enterpriseName + '</h4>' +
  378. ' </div>' +
  379. ' </div>' +
  380. ' </span>'
  381. if (this.dangerList[i].picturePath != null && this.dangerList[i].picturePath != '' && this.dangerList[i].pictureType=='image') {
  382. markersMap.bindPopupHtml += '<span>' +
  383. ' <div class="d-l-con">' +
  384. ' <div class="d-l-l-text">' +
  385. '<img src="' + this.dangerList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  386. ' </div>' +
  387. ' </div>' +
  388. ' </span>'
  389. }
  390. markersMap.bindPopupHtml += '</div>'
  391. that.markersList.push(markersMap)
  392. }
  393. setTimeout(() => {
  394. that.$refs.supermap.clearM(false)
  395. that.$refs.supermap.clearM(true)
  396. that.$refs.supermap.setMarkers(that.markersList)
  397. }, 2000)
  398. } else {
  399. setTimeout(() => {
  400. that.$refs.supermap.clearM(false)
  401. that.$refs.supermap.clearM(true)
  402. }, 2000)
  403. }
  404. })
  405. },
  406. stopAudio(){
  407. this.$refs.up.pause();//停止播放音乐
  408. this.$refs.up.currentTime = 0;
  409. },
  410. /** ----------------------------------weosocket开始------------------------------------- */
  411. initWebSocket() { //初始化weosocket
  412. const wsuri = 'wss://www.hmzzxc.com:10012/websocket/forest-' + Cookies.get('username')
  413. this.websock = new WebSocket(wsuri)
  414. console.log('建立websocket连接')
  415. this.websock.onopen = this.websocketonopen
  416. this.websock.onmessage = this.websocketonmessage
  417. this.websock.onerror = this.websocketonerror
  418. this.websock.onclose = this.websocketclose
  419. this.websock.onclose = this.websocketclose
  420. },
  421. websocketonopen() { //连接建立之后执行send方法发送数据
  422. console.log('websocket连接成功')
  423. this.weosocket = true
  424. this.sendPing()
  425. },
  426. websocketonerror() { //连接建立失败重连
  427. this.initWebSocket()
  428. },
  429. websocketonmessage(e) { //数据接收
  430. console.log('接收数据', e.data)
  431. },
  432. websocketsend(Data) { //数据发送
  433. this.websock.send(Data)
  434. },
  435. websocketclose(e) { //关闭
  436. console.log('断开连接', e)
  437. // clearInterval(this.setIntervalWesocketPush)
  438. this.weosocket = false
  439. },
  440. /**发送心跳
  441. * @param {number} time 心跳间隔毫秒 默认5000
  442. * @param {string} ping 心跳名称 默认字符串ping
  443. */
  444. sendPing(time = 5000, ping = {
  445. 'fromId': 'forest',
  446. 'fromUserId': Cookies.get('username'),
  447. 'toUserId': Cookies.get('username')
  448. }) {
  449. clearInterval(this.setIntervalWesocketPush)
  450. this.websock.send(JSON.stringify(ping))
  451. this.setIntervalWesocketPush = setInterval(() => {
  452. if (this.weosocket) {
  453. this.websock.send(JSON.stringify(ping))
  454. } else {
  455. this.initWebSocket()
  456. }
  457. }, time)
  458. },
  459. /** ----------------------------------weosocket结束------------------------------------- */
  460. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  461. showDialog(click) {
  462. if (click == 'eventLocation') {
  463. this.$refs.eventLocation.showEventLocation()
  464. this.$refs.supermap.isEditableLayers = false
  465. this.$refs.bottomMenu.showChild = false
  466. this.$refs.bottomMenu.showBanChild = false
  467. this.$refs.bottomMenu.showChangChild = false
  468. } else if (click == 'editableLayers') {
  469. this.$refs.bottomMenu.showChild = false
  470. this.$refs.bottomMenu.showBanChild = false
  471. this.$refs.bottomMenu.showChangChild = false
  472. if (!this.$refs.supermap.isEditableLayers) {
  473. this.$refs.supermap.isEditableLayers = true
  474. } else {
  475. this.$refs.supermap.isEditableLayers = false
  476. }
  477. } else if (click == 'layerSwitching') {
  478. this.$refs.supermap.isEditableLayers = false
  479. this.$refs.bottomMenu.showBanChild = false
  480. this.$refs.bottomMenu.showChangChild = false
  481. if (!this.$refs.bottomMenu.showChild) {
  482. this.$refs.bottomMenu.showChild = true
  483. } else {
  484. this.$refs.bottomMenu.showChild = false
  485. }
  486. } else if (click == 'TVWall') {
  487. this.$refs.TVWall.showTVWall()
  488. this.$refs.supermap.isEditableLayers = false
  489. this.$refs.bottomMenu.showChild = false
  490. this.$refs.bottomMenu.showBanChild = false
  491. this.$refs.bottomMenu.showChangChild = false
  492. } else if (click == 'forestban') {
  493. this.$refs.supermap.isEditableLayers = false
  494. this.$refs.bottomMenu.showChild = false
  495. this.$refs.bottomMenu.showChangChild = false
  496. if (!this.$refs.bottomMenu.showBanChild) {
  497. this.$refs.bottomMenu.showBanChild = true
  498. } else {
  499. this.$refs.bottomMenu.showBanChild = false
  500. }
  501. } else if (click == 'forestchang') {
  502. this.$refs.supermap.isEditableLayers = false
  503. this.$refs.bottomMenu.showBanChild = false
  504. this.$refs.bottomMenu.showChild = false
  505. if (!this.$refs.bottomMenu.showChangChild) {
  506. this.$refs.bottomMenu.showChangChild = true
  507. } else {
  508. this.$refs.bottomMenu.showChangChild = false
  509. }
  510. }
  511. },
  512. //选择图层
  513. choseLayerSwitching(url, isClear) {
  514. this.$refs.supermap.layerSwitching(url, isClear)
  515. },
  516. //选择图层(传递数组)
  517. choseLayerSwitchingList(urlList) {
  518. this.$refs.supermap.layerSwitchingList(urlList)
  519. },
  520. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  521. /** ----------------------------------隐患弹窗开始------------------------------------- */
  522. /** ----------------------------------隐患弹窗结束------------------------------------- */
  523. /** ----------------------------------摄像头预览开始------------------------------------- */
  524. alertLogin: function() {
  525. this.$modal.msg('登录中....')
  526. },
  527. alertLoginSuccess: function() {
  528. this.$modal.msgSuccess('登录成功!')
  529. },
  530. alertLoginFailed: function() {
  531. this.$modal.msgError('登陆失败!')
  532. },
  533. alertReinstall: function() {
  534. this.$modal.msgWarning('请重新安装客户端')
  535. },
  536. /** 预览按钮操作 */
  537. preview(channelCode) {
  538. getDahuaVideoServer().then(newResponse => {
  539. this.ws.detectConnectQt().then(res => {
  540. if (res) { // 连接客户端成功
  541. this.alertLogin()
  542. this.ws.login({
  543. loginIp: newResponse.loginIp,
  544. loginPort: newResponse.loginPort,
  545. userName: newResponse.userName,
  546. userPwd: newResponse.userPwd,
  547. token: '',
  548. https: 1
  549. })
  550. this.ws.on('loginState', (res) => {
  551. this.isLogin = res
  552. if (res) {
  553. this.alertLoginSuccess()
  554. this.activePanel = 'key2'
  555. this.realTimeVideoDialog(channelCode)
  556. } else {
  557. this.alertLoginFailed()
  558. }
  559. })
  560. } else { // 连接客户端失败
  561. this.alertReinstall()
  562. }
  563. })
  564. })
  565. },
  566. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  567. if (!this.isLogin) {
  568. this.$Message.info('正在登陆客户端,请稍等......')
  569. return false
  570. }
  571. this.ws.openVideo(cameraParams)
  572. }
  573. /** ----------------------------------摄像头预览结束------------------------------------- */
  574. }
  575. }
  576. </script>
  577. <style rel="stylesheet/scss" lang="scss" scoped>
  578. @import '@/assets/styles/base.scss';
  579. </style>