TVWall.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  1. <template>
  2. <div>
  3. <el-dialog title="电视墙" :visible.sync="TVWallVisible" v-if="TVWallVisible" customClass="TVWallCustomWidth"
  4. @close="cancelEventLocationShow()">
  5. <!--<div class="forthis" style="width: 22%; position: absolute;left: 0;z-index: 9999999999999;">-->
  6. <!--&lt;!&ndash; <div class="this-title">-->
  7. <!--<span>林场</span>-->
  8. <!--<span>45</span>-->
  9. <!--</div> &ndash;&gt;-->
  10. <!--<div class="i-list-con" style="height: 46vh; overflow-y: scroll;">-->
  11. <!--<span v-for="(item,index) in cameraList" :key="index">-->
  12. <!--<div class="d-l-con" @click="playhk(item.channelCode)">-->
  13. <!--<div class="d-l-l-text">-->
  14. <!--<i class="i-small"></i>-->
  15. <!--<h4>{{ item.cameraName }}</h4>-->
  16. <!--</div>-->
  17. <!--</div>-->
  18. <!--</span>-->
  19. <!--</div>-->
  20. <!--</div>-->
  21. <!--<div style="width:70%;height:400px;position:absolute;">-->
  22. <!--&lt;!&ndash;视频窗口展示-&#45;&#45;大华&ndash;&gt;-->
  23. <!--<div id="dom1" class="dom1"></div>-->
  24. <!--&lt;!&ndash;视频窗口展示-&#45;&#45;海康&ndash;&gt;-->
  25. <!--<div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>-->
  26. <!--</div>-->
  27. <div id="dom1" class="dom1"></div>
  28. </el-dialog>
  29. </div>
  30. </template>
  31. <script>
  32. /** ----------------------------------摄像头预览开始------------------------------------- */
  33. import { getDahuaVideoServer, getTVWallList } from '@/api/dahua/dahua'
  34. import { tvCameraList } from '@/api/haikang/haikang'
  35. import DHWs from '@/dahua/lib/DHWs'
  36. import { rotation } from '@/api/monitor'
  37. /** ----------------------------------摄像头预览结束------------------------------------- */
  38. export default {
  39. array:[],
  40. dicts: ['event_source'],
  41. components: {},
  42. data() {
  43. return {
  44. tvListJson: [
  45. {
  46. 'switchTab': '1',
  47. 'treeLabels': [
  48. {
  49. 'labelCode': '123456',
  50. 'labelName': '视频场景',
  51. 'parentLabelCode': null
  52. },
  53. {
  54. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa',
  55. 'labelName': '标签2',
  56. 'parentLabelCode': 123456
  57. },
  58. {
  59. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd',
  60. 'labelName': '标签1',
  61. 'parentLabelCode': 123456
  62. }
  63. ],
  64. 'labelChannels': [{
  65. 'channelDates': [{
  66. 'channelCode': '6044981090191552',
  67. 'channelName': '复兴大桥中段-交通事故',
  68. 'channelSn': null,
  69. 'cameraType': 0,
  70. 'online': 1
  71. },
  72. {
  73. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  74. 'channelName': '北京7青羊东二路77号2通道1',
  75. 'channelSn': null,
  76. 'cameraType': 1,
  77. 'online': 1
  78. }
  79. ],
  80. 'labelCode': 'd941adbbd3e64dac92cc448dec5293cd'
  81. },
  82. {
  83. 'channelDates': [{
  84. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  85. 'channelName': '北京7青羊东二路77号2通道2',
  86. 'channelSn': null,
  87. 'cameraType': 2,
  88. 'online': 0
  89. }],
  90. 'labelCode': '5a81d1bd499b4940a21fc63ca51f4dfa'
  91. }
  92. ]
  93. },
  94. {
  95. 'switchTab': '2',
  96. 'labelChannels': [{
  97. 'channelDates': [{
  98. 'channelCode': 'ZgVzqsjwA1DTF561VGHK5E',
  99. 'channelName': '北京7青羊东二路77号2通道1',
  100. 'channelSn': null,
  101. 'cameraType': 1,
  102. 'online': 1
  103. },
  104. {
  105. 'channelCode': 'ZgVzqsjwA1DTF561VGHKK7',
  106. 'channelName': '北京7青羊东二路77号2通道2',
  107. 'channelSn': null,
  108. 'cameraType': 2,
  109. 'online': 0
  110. }
  111. ]
  112. }]
  113. }
  114. ],
  115. TVWallVisible: false,
  116. activeName: 'tv',
  117. channelId: ['ZgVzqsjwA1DTF561VHG69F'],
  118. /** ----------------------------------摄像头预览开始------------------------------------- */
  119. showModal: true,
  120. activePanel: 'key1',
  121. isLogin: false,
  122. loginType: '1',
  123. token: '',
  124. ctrlType: 'playerWin',
  125. https: 1,
  126. httpsList: [
  127. {
  128. value: 0,
  129. label: 0
  130. },
  131. {
  132. value: 1,
  133. label: 1
  134. }
  135. ],
  136. ctrlTypeList: [{
  137. value: 'playerWin',
  138. label: '播放控件'
  139. }, {
  140. value: 'realMonitorUI',
  141. label: '带设备树实时预览控件'
  142. }, {
  143. value: 'playbackUI',
  144. label: '带设备树视频回放控件'
  145. }, {
  146. value: 'TVWallUI',
  147. label: '视频上墙'
  148. }],
  149. ctrlList: [
  150. {
  151. value: 'ctrl1',
  152. label: '控件1'
  153. },
  154. {
  155. value: 'ctrl2',
  156. label: '控件2'
  157. },
  158. {
  159. value: 'ctrl3',
  160. label: '控件3'
  161. }
  162. ],
  163. splitList: [
  164. {
  165. value: 1,
  166. label: '1 * 1'
  167. },
  168. {
  169. value: 4,
  170. label: '2 * 2'
  171. },
  172. {
  173. value: 9,
  174. label: '3 * 3'
  175. }
  176. ],
  177. displayModeList: [
  178. {
  179. value: 1,
  180. label: '播放器预览模式'
  181. },
  182. {
  183. value: 2,
  184. label: '播放器回放模式'
  185. }
  186. ],
  187. mixedVideoDisplayModeList: [
  188. {
  189. value: 1,
  190. label: '播放实时视频'
  191. },
  192. {
  193. value: 2,
  194. label: '播放回放视频'
  195. }
  196. ],
  197. ctrl: 'ctrl1',
  198. splitNum: 1,
  199. displayMode: 1,
  200. displayTimeRange: [],
  201. modalDisplayTimeRange: [],
  202. mixedVideoTime: null,
  203. recordPath: 'C:\\DSS LightWeight\\DSS LightWeight Client\\Record\\',
  204. downloadName: '',
  205. downTimeRange: [],
  206. downloadFormat: 0,
  207. downloadFormatList: [{
  208. value: 0,
  209. label: 'dav'
  210. },
  211. {
  212. value: 1,
  213. label: 'avi'
  214. }, {
  215. value: 2,
  216. label: 'mp4'
  217. }],
  218. downloadSource: 3,
  219. downloadSourceList: [
  220. {
  221. value: 3,
  222. label: '中心录像'
  223. }, {
  224. value: 2,
  225. label: '设备录像'
  226. }],
  227. showDownloadStreamType: false,
  228. downloadStreamType: 1,
  229. downloadStreamTypeList: [{
  230. value: 1,
  231. label: '主码流'
  232. },
  233. {
  234. value: 2,
  235. label: '辅码流'
  236. },
  237. {
  238. value: 3,
  239. label: '三码流'
  240. }],
  241. downloadIsShow: true,
  242. downloadIsShowList: [{
  243. value: true,
  244. label: '是'
  245. },
  246. {
  247. value: false,
  248. label: '否'
  249. }],
  250. crtPosX: 0,
  251. crtPosY: 0,
  252. crtWidth: 1150,
  253. crtHeight: 700,
  254. domId: 'dom1',
  255. mixedVideoDisplayMode: 2,
  256. isShowTipe: true,
  257. /** ----------------------------------摄像头预览结束------------------------------------- */
  258. cameraList:[],
  259. initCount: 0,
  260. pubKey: '',
  261. oWebControl: null
  262. }
  263. },
  264. created() {
  265. const DHWsInstance = DHWs.getInstance()
  266. this.ws = DHWsInstance
  267. },
  268. methods: {
  269. cancelEventLocationShow() {
  270. // this.activeName = 'tv'
  271. this.TVWallVisible = false
  272. this.destroy()
  273. if (this.oWebControl != null) {
  274. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  275. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  276. },
  277. function() { // 断开与插件服务连接失败
  278. })
  279. }
  280. },
  281. playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
  282. const config = this.ws.config
  283. const { loginIp, userCode } = config
  284. this.ws.postMessage('playRealMonitorVideo', {
  285. loginIp,
  286. userCode,
  287. params: {
  288. ctrlCode: "ctrl1",
  289. array: array
  290. }
  291. })
  292. },
  293. //火点联动电视墙调用
  294. showTVWall1(longitude,latitude,tvListJson) {
  295. // let that=this;
  296. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  297. this.ws.addEventListener('connectStateChange', data => {
  298. if (data) {
  299. console.log('连接成功')
  300. } else {
  301. console.log('连接失败,下载客户端')
  302. this.alertReinstall()
  303. this.isShowTipe && this.$modal.confirm({
  304. title: '下载客户端',
  305. content: '检测到您未安装部分插件,将影响部分功能使用,请下载后使用?',
  306. onOk: () => {
  307. //这里写下载方法
  308. this.isShowTipe = false
  309. },
  310. onCancel: () => {
  311. this.isShowTipe = false
  312. }
  313. });
  314. }
  315. })
  316. getDahuaVideoServer().then(newResponse => {
  317. this.ws.detectConnectQt().then(res => {
  318. if (res) { // 连接客户端成功
  319. this.alertLogin()
  320. this.ws.login({
  321. loginIp: newResponse.loginIp,
  322. loginPort: newResponse.loginPort,
  323. userName: newResponse.userName,
  324. userPwd: newResponse.userPwd,
  325. // loginIp: '192.168.100.100',
  326. // loginPort: 8314,
  327. // userName: 'system',
  328. // userPwd: 'Admin@123',
  329. token: '',
  330. https: 1
  331. })
  332. this.ws.on('loginState', (res) => {
  333. this.isLogin = res
  334. console.log('---res-----', res)
  335. if (res) {
  336. this.alertLoginSuccess()
  337. this.activePanel = 'key2'
  338. console.log(tvListJson)
  339. const array=[]
  340. const array1=[]
  341. tvListJson[0].treeLabels.forEach((item,index)=>
  342. {
  343. if (index!=0)
  344. {
  345. const param =Object.assign({})
  346. param.channelId=item.labelCode
  347. array.push(param)
  348. array1.push(item.labelCode)
  349. }
  350. })
  351. this.create1(longitude,latitude,tvListJson,array,array1)
  352. // var obj=JSON.parse(tvListJson)
  353. } else {
  354. this.alertLoginFailed()
  355. }
  356. })
  357. } else { // 连接客户端失败
  358. this.alertReinstall()
  359. }
  360. })
  361. })
  362. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  363. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  364. // tvCameraList().then(response => {
  365. // this.cameraList=response.data
  366. // })
  367. // that.initPlugin()
  368. // setTimeout(function() {
  369. // that.playhk();
  370. // }, 5000)
  371. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  372. this.TVWallVisible = true
  373. },
  374. rotation(lng,lat,list){
  375. rotation(lng,lat,list).then(res => {
  376. console.log(res)
  377. })
  378. },
  379. create1(longitude,latitude,tvListJson,array,array1) { // 调用创建控件接口
  380. let _this = this
  381. const params = [
  382. {
  383. 'ctrlType': 'realMonitorUI',
  384. 'ctrlCode': 'ctrl1',
  385. 'ctrlProperty': {
  386. 'displayMode': 1,
  387. 'splitNum': 1,
  388. 'channelList': [
  389. {
  390. 'channelId': ''
  391. }
  392. ]
  393. },
  394. 'visible': true,
  395. 'domId': 'dom1'
  396. }
  397. ]
  398. this.setPos()
  399. this.customizeTree(tvListJson);
  400. _this.ws.createCtrl(params);
  401. _this.playRealMonitorVideo(array)
  402. setTimeout(() => {
  403. _this.rotation(longitude,latitude,array1)
  404. }, 5000)
  405. },
  406. showTVWall() {
  407. // let that=this;
  408. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  409. this.ws.addEventListener('connectStateChange', data => {
  410. if (data) {
  411. console.log('连接成功')
  412. } else {
  413. console.log('连接失败,下载客户端')
  414. this.alertReinstall()
  415. this.isShowTipe && this.$modal.confirm({
  416. title: '下载客户端',
  417. content: '检测到您未安装部分插件,将影响部分功能使用,请下载后使用?',
  418. onOk: () => {
  419. //这里写下载方法
  420. this.isShowTipe = false
  421. },
  422. onCancel: () => {
  423. this.isShowTipe = false
  424. }
  425. });
  426. }
  427. })
  428. this.preview()
  429. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  430. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  431. // tvCameraList().then(response => {
  432. // this.cameraList=response.data
  433. // })
  434. // that.initPlugin()
  435. // setTimeout(function() {
  436. // that.playhk();
  437. // }, 5000)
  438. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  439. this.TVWallVisible = true
  440. },
  441. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  442. alertLogin: function() {
  443. this.$modal.msg('登录中....')
  444. },
  445. alertLoginSuccess: function() {
  446. this.$modal.msgSuccess('登录成功!')
  447. },
  448. alertLoginFailed: function() {
  449. this.$modal.msgError('登陆失败!')
  450. },
  451. alertReinstall: function() {
  452. this.$modal.msgWarning('请重新安装客户端')
  453. },
  454. /** 预览按钮操作 */
  455. preview() {
  456. getTVWallList().then(newres => {
  457. getDahuaVideoServer().then(newResponse => {
  458. this.ws.detectConnectQt().then(res => {
  459. if (res) { // 连接客户端成功
  460. this.alertLogin()
  461. this.ws.login({
  462. loginIp: newResponse.loginIp,
  463. loginPort: newResponse.loginPort,
  464. userName: newResponse.userName,
  465. userPwd: newResponse.userPwd,
  466. // loginIp: '192.168.100.100',
  467. // loginPort: 8314,
  468. // userName: 'system',
  469. // userPwd: 'Admin@123',
  470. token: '',
  471. https: 1
  472. })
  473. this.ws.on('loginState', (res) => {
  474. this.isLogin = res
  475. console.log('---res-----', res)
  476. if (res) {
  477. this.alertLoginSuccess()
  478. this.activePanel = 'key2'
  479. this.create(newres.data)
  480. } else {
  481. this.alertLoginFailed()
  482. }
  483. })
  484. } else { // 连接客户端失败
  485. this.alertReinstall()
  486. }
  487. })
  488. })
  489. })
  490. },
  491. create(tvListJson) { // 调用创建控件接口
  492. let _this = this
  493. const params = [
  494. {
  495. 'ctrlType': 'realMonitorUI',
  496. 'ctrlCode': 'ctrl1',
  497. 'ctrlProperty': {
  498. 'displayMode': 1,
  499. 'splitNum': 1,
  500. 'channelList': [
  501. {
  502. 'channelId': ''
  503. }
  504. ]
  505. },
  506. 'visible': true,
  507. 'domId': 'dom1'
  508. }
  509. ]
  510. this.setPos()
  511. this.customizeTree(tvListJson);
  512. setTimeout(function () {
  513. _this.ws.createCtrl(params);
  514. }, 3000);
  515. },
  516. setPos() {
  517. let target = document.getElementById(this.domId)
  518. console.log(target, 'target')
  519. target.style.right = `${this.crtPosX}px`
  520. target.style.top = `${this.crtPosY}px`
  521. target.style.width = `${this.crtWidth}px`
  522. target.style.height = `${this.crtHeight}px`
  523. if (document.createEvent) {
  524. var event = document.createEvent('HTMLEvents')
  525. event.initEvent('resize', true, true)
  526. window.dispatchEvent(event)
  527. } else if (document.createEventObject) {
  528. window.fireEvent('onresize')
  529. }
  530. },
  531. destroy() { // 调用销毁控件接口
  532. if (!this.isLogin) {
  533. this.$modal.msgWarning('正在登陆客户端,请稍等......')
  534. return false
  535. }
  536. const ctrls = this.ws.ctrls.map(i => {
  537. if (i.ctrlCode === this.ctrl) {
  538. return i.ctrlCode
  539. }
  540. })
  541. this.ws.destroyCtrl(ctrls)
  542. },
  543. customizeTree(tvListJson) { // 调用控件接口树
  544. const config = this.ws.config
  545. const { loginIp, userCode } = config
  546. this.ws.postMessage('customizeTree', {
  547. loginIp,
  548. userCode,
  549. params: {
  550. array: tvListJson
  551. }
  552. })
  553. },
  554. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  555. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  556. // 创建播放实例
  557. initPlugin() {
  558. let that=this
  559. that.oWebControl = new WebControl({
  560. szPluginContainer: 'playWnd', // 指定容器id
  561. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  562. iServicePortEnd: 15909,
  563. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  564. cbConnectSuccess: function() { // 创建WebControl实例成功
  565. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  566. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  567. }).then(function() { // 启动插件服务成功
  568. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  569. cbIntegrationCallBack: cbIntegrationCallBack
  570. })
  571. that.oWebControl.JS_CreateWnd('playWnd', 850, 615).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  572. that.init() // 创建播放实例成功后初始化
  573. })
  574. }, function() { // 启动插件服务失败
  575. })
  576. },
  577. cbConnectError: function() { // 创建WebControl实例失败
  578. that.oWebControl = null
  579. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  580. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  581. initCount++
  582. if (initCount < 3) {
  583. setTimeout(function() {
  584. that.initPlugin()
  585. }, 3000)
  586. } else {
  587. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  588. }
  589. },
  590. cbConnectClose: function(bNormalClose) {
  591. // 异常断开:bNormalClose = false
  592. // JS_Disconnect正常断开:bNormalClose = true
  593. console.log('cbConnectClose')
  594. that.oWebControl = null
  595. }
  596. })
  597. },
  598. //初始化
  599. init() {
  600. let that=this
  601. this.getPubKey(function() {
  602. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  603. var appkey = '24699060' //综合安防管理平台提供的appkey,必填
  604. var secret = that.setEncrypt('tt1pMbsrlwGZUWucdAPw') //综合安防管理平台提供的secret,必填
  605. var ip = '36.49.108.22' //综合安防管理平台IP地址,必填
  606. var playMode = 0 //初始播放模式:0-预览,1-回放
  607. var port = 1443 //综合安防管理平台端口,若启用HTTPS协议,默认443
  608. var snapDir = 'D:\\SnapDir' //抓图存储路径
  609. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  610. var layout = '3x3' //playMode指定模式的布局
  611. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  612. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  613. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  614. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  615. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  616. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  617. that.oWebControl.JS_RequestInterface({
  618. funcName: 'init',
  619. argument: JSON.stringify({
  620. appkey: appkey, //API网关提供的appkey
  621. secret: secret, //API网关提供的secret
  622. ip: ip, //API网关IP地址
  623. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  624. port: port, //端口
  625. snapDir: snapDir, //抓图存储路径
  626. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  627. layout: layout, //布局
  628. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  629. encryptedFields: encryptedFields, //加密字段
  630. showToolbar: showToolbar, //是否显示工具栏
  631. showSmart: showSmart, //是否显示智能信息
  632. buttonIDs: buttonIDs //自定义工具条按钮
  633. })
  634. }).then(function(oData) {
  635. that.oWebControl.JS_Resize(850, 615) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  636. })
  637. })
  638. },
  639. //获取公钥
  640. getPubKey(callback) {
  641. let that=this
  642. that.oWebControl.JS_RequestInterface({
  643. funcName: 'getRSAPubKey',
  644. argument: JSON.stringify({
  645. keyLength: 1024
  646. })
  647. }).then(function(oData) {
  648. console.log(oData)
  649. if (oData.responseMsg.data) {
  650. that.pubKey = oData.responseMsg.data
  651. callback()
  652. }125
  653. })
  654. },
  655. //RSA加密
  656. setEncrypt(value) {
  657. var encrypt = new JSEncrypt()
  658. encrypt.setPublicKey(this.pubKey)
  659. return encrypt.encrypt(value)
  660. },
  661. //播放海康摄像头
  662. playhk(channelCode){
  663. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  664. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  665. var transMode = 1 //传输协议:0-UDP,1-TCP
  666. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  667. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  668. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  669. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  670. this.oWebControl.JS_RequestInterface({
  671. funcName: 'startPreview',
  672. argument: JSON.stringify({
  673. cameraIndexCode: cameraIndexCode, //监控点编号
  674. streamMode: streamMode, //主子码流标识
  675. transMode: transMode, //传输协议
  676. gpuMode: gpuMode, //是否开启GPU硬解
  677. wndId: wndId //可指定播放窗口
  678. })
  679. })
  680. }
  681. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  682. }
  683. }
  684. // 推送消息
  685. function cbIntegrationCallBack(oData) {
  686. console.log(JSON.stringify(oData.responseMsg))
  687. }
  688. </script>
  689. <style rel="stylesheet/scss" lang="scss" scoped>
  690. @import '@/assets/styles/base.scss';
  691. .event-info-con {
  692. width: 100%;
  693. display: flex;
  694. .e-left {
  695. width: 32%;
  696. }
  697. .e-center {
  698. width: 30%;
  699. margin-left: 1%;
  700. .img-company {
  701. width: 100%;
  702. height: 18.3vh;
  703. img {
  704. }
  705. }
  706. }
  707. .e-right {
  708. margin-left: 1%;
  709. width: 45%;
  710. }
  711. .e-location-left {
  712. width: 28%;
  713. margin-top: 1rem;
  714. }
  715. .e-location-right {
  716. width: 71%;
  717. margin-top: 1.3rem;
  718. margin-left: 1rem;
  719. }
  720. }
  721. .el-dialog:not(.is-fullscreen) {
  722. margin-top: 5.5vh !important;
  723. }
  724. .bottom-menu-normal {
  725. max-width: 90%;
  726. padding: 0 3rem;
  727. position: absolute;
  728. left: 50%;
  729. transform: translateX(-50%);
  730. bottom: 0;
  731. z-index: 100000;
  732. border-radius: 5px;
  733. display: flex;
  734. justify-content: center;
  735. align-items: center;
  736. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  737. background-size: cover;
  738. overflow: hidden;
  739. .btm-m-con {
  740. position: relative;
  741. color: $inBlue;
  742. font-size: .5rem;
  743. padding: 1rem 1.5rem;
  744. display: flex;
  745. align-items: center;
  746. justify-content: center;
  747. -webkit-transform: translateY(0);
  748. transform: translateY(0);
  749. transition: all 0.2s ease-in-out;
  750. cursor: pointer;
  751. white-space: nowrap;
  752. i {
  753. font-size: 1rem;
  754. color: $inBlue;
  755. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  756. margin-right: 0.2rem;
  757. }
  758. }
  759. .btm-m-con:hover {
  760. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  761. filter: brightness(2.3);
  762. -webkit-transform: translateX(0.2rem);
  763. transform: translateX(0.2rem);
  764. transition: all 0.2s ease-in-out;
  765. i {
  766. color: $inBlueHover;
  767. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  768. }
  769. }
  770. .m-l-none {
  771. .el-input__inner {
  772. margin-left: 0 !important;
  773. }
  774. }
  775. }
  776. /*海康*/
  777. html, body {
  778. padding: 0;
  779. margin: 0;
  780. }
  781. .playWnd {
  782. margin: -13px 0 0 255px;
  783. width: 850px; /*播放容器的宽和高设定*/
  784. height: 615px;
  785. border: 1px solid red;
  786. }
  787. .operate {
  788. margin-top: 24px;
  789. }
  790. .operate::after {
  791. content: '';
  792. display: block;
  793. clear: both;
  794. }
  795. .module {
  796. float: left;
  797. width: 340px;
  798. /*min-height: 320px;*/
  799. margin-left: 16px;
  800. padding: 16px 8px;
  801. box-sizing: border-box;
  802. border: 1px solid #e5e5e5;
  803. }
  804. .module .item {
  805. margin-bottom: 4px;
  806. }
  807. .module input[type="text"] {
  808. box-sizing: border-box;
  809. display: inline-block;
  810. vertical-align: middle;
  811. margin-left: 0;
  812. width: 150px;
  813. min-height: 20px;
  814. }
  815. .module .btn {
  816. min-width: 80px;
  817. min-height: 24px;
  818. margin-top: 100px;
  819. margin-left: 80px;
  820. }
  821. </style>