TVWall.vue 26 KB

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