TVWall.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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 { rotation } from '@/api/monitor'
  36. import DHWs from '@/dahua/lib/DHWs'
  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. tvListJson[0].treeLabels.forEach((item,index)=>
  318. {
  319. if (index!=0)
  320. {
  321. const param =Object.assign({})
  322. param.channelId=item.labelCode
  323. array.push(param)
  324. array1.push(item.labelCode)
  325. }
  326. })
  327. this.create1(longitude,latitude,tvListJson,array,array1)
  328. // var obj=JSON.parse(tvListJson)
  329. } else {
  330. this.alertLoginFailed()
  331. }
  332. })
  333. } else { // 连接客户端失败
  334. this.alertReinstall()
  335. }
  336. })
  337. })
  338. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  339. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  340. // tvCameraList().then(response => {
  341. // this.cameraList=response.data
  342. // })
  343. // that.initPlugin()
  344. // setTimeout(function() {
  345. // that.playhk();
  346. // }, 5000)
  347. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  348. this.TVWallVisible = true
  349. },
  350. create1(longitude,latitude,tvListJson,array,array1) { // 调用创建控件接口
  351. let _this = this
  352. const params = [
  353. {
  354. 'ctrlType': 'realMonitorUI',
  355. 'ctrlCode': 'ctrl1',
  356. 'ctrlProperty': {
  357. 'displayMode': 1,
  358. 'splitNum': 1,
  359. 'channelList': [
  360. {
  361. 'channelId': ''
  362. }
  363. ]
  364. },
  365. 'visible': true,
  366. 'domId': 'dom1'
  367. }
  368. ]
  369. this.setPos()
  370. this.customizeTree(tvListJson);
  371. _this.ws.createCtrl(params);
  372. _this.playRealMonitorVideo(array)
  373. setTimeout(() => {
  374. _this.rotation(longitude,latitude,array1)
  375. }, 5000)
  376. },
  377. playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
  378. const config = this.ws.config
  379. const { loginIp, userCode } = config
  380. this.ws.postMessage('playRealMonitorVideo', {
  381. loginIp,
  382. userCode,
  383. params: {
  384. ctrlCode: "ctrl1",
  385. array: array
  386. }
  387. })
  388. },
  389. rotation(lng,lat,list){
  390. rotation(lng,lat,list).then(res => {
  391. })
  392. },
  393. showTVWall(tvListJson, bfArray) {
  394. if(tvListJson){
  395. this.preview(tvListJson, bfArray);
  396. this.TVWallVisible = true;
  397. return;
  398. }
  399. // let that=this;
  400. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  401. this.ws.addEventListener('connectStateChange', data => {
  402. if (data) {
  403. console.log('连接成功')
  404. } else {
  405. console.log('连接失败,下载客户端')
  406. this.alertReinstall()
  407. }
  408. })
  409. this.preview()
  410. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  411. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  412. // tvCameraList().then(response => {
  413. // this.cameraList=response.data
  414. // })
  415. // that.initPlugin()
  416. // setTimeout(function() {
  417. // that.playhk();
  418. // }, 5000)
  419. // /** ----------------------------------海康摄像头预览结束------------------------------------- */
  420. this.TVWallVisible = true
  421. },
  422. /** ----------------------------------大华摄像头预览开始------------------------------------- */
  423. alertLogin: function() {
  424. this.$modal.msg('登录中....')
  425. },
  426. alertLoginSuccess: function() {
  427. this.$modal.msgSuccess('登录成功!')
  428. },
  429. alertLoginFailed: function() {
  430. this.$modal.msgError('登陆失败!')
  431. },
  432. alertReinstall: function() {
  433. this.$modal.msgWarning('请重新安装客户端')
  434. },
  435. /** 预览按钮操作 */
  436. preview(tvListJson, bfArray) {
  437. getTVWallList().then(newres => {
  438. getDahuaVideoServer().then(newResponse => {
  439. this.ws.detectConnectQt().then(res => {
  440. if (res) { // 连接客户端成功
  441. this.alertLogin()
  442. this.ws.login({
  443. loginIp: newResponse.loginIp,
  444. loginPort: newResponse.loginPort,
  445. userName: newResponse.userName,
  446. userPwd: newResponse.userPwd,
  447. // loginIp: '192.168.100.100',
  448. // loginPort: 8314,
  449. // userName: 'system',
  450. // userPwd: 'Admin@123',
  451. token: '',
  452. https: 1
  453. })
  454. this.ws.on('loginState', (res) => {
  455. this.isLogin = res
  456. console.log('---res-----', res)
  457. if (res) {
  458. this.alertLoginSuccess()
  459. this.activePanel = 'key2'
  460. this.create(tvListJson?tvListJson:newres.data, bfArray);
  461. } else {
  462. this.alertLoginFailed()
  463. }
  464. })
  465. } else { // 连接客户端失败
  466. this.alertReinstall()
  467. }
  468. })
  469. })
  470. })
  471. },
  472. create(tvListJson, bfArray) { // 调用创建控件接口
  473. let _this = this
  474. const params = [
  475. {
  476. 'ctrlType': 'realMonitorUI',
  477. 'ctrlCode': 'ctrl1',
  478. 'ctrlProperty': {
  479. 'displayMode': 1,
  480. 'splitNum': 1,
  481. 'channelList': [
  482. {
  483. 'channelId': ''
  484. }
  485. ]
  486. },
  487. 'visible': true,
  488. 'domId': 'dom1'
  489. }
  490. ]
  491. this.setPos()
  492. this.customizeTree(tvListJson);
  493. let length = tvListJson[0].treeLabels.length > 4 ? 5 : tvListJson[0].treeLabels.length;
  494. const bfArray = [];
  495. for (let i = 1; i < length; i++) {
  496. bfArray.push({"channelId": tvListJson[0].treeLabels[i].labelCode})
  497. }
  498. _this.ws.createCtrl(params);
  499. _this.playRealMonitorVideo(bfArray)
  500. },
  501. playRealMonitorVideo(array) { // 自定义设备树自动播放指定通道编码视频
  502. const config = this.ws.config
  503. const { loginIp, userCode } = config
  504. this.ws.postMessage('playRealMonitorVideo', {
  505. loginIp,
  506. userCode,
  507. params: {
  508. ctrlCode: "ctrl1",
  509. array: array
  510. }
  511. })
  512. },
  513. setPos() {
  514. let target = document.getElementById(this.domId)
  515. console.log(target, 'target')
  516. target.style.right = `${this.crtPosX}px`
  517. target.style.top = `${this.crtPosY}px`
  518. target.style.width = `${this.crtWidth}px`
  519. target.style.height = `${this.crtHeight}px`
  520. if (document.createEvent) {
  521. var event = document.createEvent('HTMLEvents')
  522. event.initEvent('resize', true, true)
  523. window.dispatchEvent(event)
  524. } else if (document.createEventObject) {
  525. window.fireEvent('onresize')
  526. }
  527. },
  528. destroy() { // 调用销毁控件接口
  529. if (!this.isLogin) {
  530. this.$modal.msgWarning('正在登陆客户端,请稍等......')
  531. return false
  532. }
  533. const ctrls = this.ws.ctrls.map(i => {
  534. if (i.ctrlCode === this.ctrl) {
  535. return i.ctrlCode
  536. }
  537. })
  538. this.ws.destroyCtrl(ctrls)
  539. },
  540. customizeTree(tvListJson) { // 调用控件接口树
  541. const config = this.ws.config
  542. const { loginIp, userCode } = config
  543. this.ws.postMessage('customizeTree', {
  544. loginIp,
  545. userCode,
  546. params: {
  547. array: tvListJson
  548. }
  549. })
  550. },
  551. /** ----------------------------------大华摄像头预览结束------------------------------------- */
  552. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  553. // 创建播放实例
  554. initPlugin() {
  555. let that=this
  556. that.oWebControl = new WebControl({
  557. szPluginContainer: 'playWnd', // 指定容器id
  558. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  559. iServicePortEnd: 15909,
  560. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  561. cbConnectSuccess: function() { // 创建WebControl实例成功
  562. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  563. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  564. }).then(function() { // 启动插件服务成功
  565. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  566. cbIntegrationCallBack: cbIntegrationCallBack
  567. })
  568. that.oWebControl.JS_CreateWnd('playWnd', 850, 615).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  569. that.init() // 创建播放实例成功后初始化
  570. })
  571. }, function() { // 启动插件服务失败
  572. })
  573. },
  574. cbConnectError: function() { // 创建WebControl实例失败
  575. that.oWebControl = null
  576. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  577. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  578. initCount++
  579. if (initCount < 3) {
  580. setTimeout(function() {
  581. that.initPlugin()
  582. }, 3000)
  583. } else {
  584. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  585. }
  586. },
  587. cbConnectClose: function(bNormalClose) {
  588. // 异常断开:bNormalClose = false
  589. // JS_Disconnect正常断开:bNormalClose = true
  590. console.log('cbConnectClose')
  591. that.oWebControl = null
  592. }
  593. })
  594. },
  595. //初始化
  596. init() {
  597. let that=this
  598. this.getPubKey(function() {
  599. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  600. var appkey = '24699060' //综合安防管理平台提供的appkey,必填
  601. var secret = that.setEncrypt('tt1pMbsrlwGZUWucdAPw') //综合安防管理平台提供的secret,必填
  602. var ip = '36.49.108.22' //综合安防管理平台IP地址,必填
  603. var playMode = 0 //初始播放模式:0-预览,1-回放
  604. var port = 1443 //综合安防管理平台端口,若启用HTTPS协议,默认443
  605. var snapDir = 'D:\\SnapDir' //抓图存储路径
  606. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  607. var layout = '3x3' //playMode指定模式的布局
  608. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  609. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  610. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  611. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  612. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  613. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  614. that.oWebControl.JS_RequestInterface({
  615. funcName: 'init',
  616. argument: JSON.stringify({
  617. appkey: appkey, //API网关提供的appkey
  618. secret: secret, //API网关提供的secret
  619. ip: ip, //API网关IP地址
  620. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  621. port: port, //端口
  622. snapDir: snapDir, //抓图存储路径
  623. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  624. layout: layout, //布局
  625. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  626. encryptedFields: encryptedFields, //加密字段
  627. showToolbar: showToolbar, //是否显示工具栏
  628. showSmart: showSmart, //是否显示智能信息
  629. buttonIDs: buttonIDs //自定义工具条按钮
  630. })
  631. }).then(function(oData) {
  632. that.oWebControl.JS_Resize(850, 615) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  633. })
  634. })
  635. },
  636. //获取公钥
  637. getPubKey(callback) {
  638. let that=this
  639. that.oWebControl.JS_RequestInterface({
  640. funcName: 'getRSAPubKey',
  641. argument: JSON.stringify({
  642. keyLength: 1024
  643. })
  644. }).then(function(oData) {
  645. console.log(oData)
  646. if (oData.responseMsg.data) {
  647. that.pubKey = oData.responseMsg.data
  648. callback()
  649. }125
  650. })
  651. },
  652. //RSA加密
  653. setEncrypt(value) {
  654. var encrypt = new JSEncrypt()
  655. encrypt.setPublicKey(this.pubKey)
  656. return encrypt.encrypt(value)
  657. },
  658. //播放海康摄像头
  659. playhk(channelCode){
  660. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  661. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  662. var transMode = 1 //传输协议:0-UDP,1-TCP
  663. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  664. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  665. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  666. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  667. this.oWebControl.JS_RequestInterface({
  668. funcName: 'startPreview',
  669. argument: JSON.stringify({
  670. cameraIndexCode: cameraIndexCode, //监控点编号
  671. streamMode: streamMode, //主子码流标识
  672. transMode: transMode, //传输协议
  673. gpuMode: gpuMode, //是否开启GPU硬解
  674. wndId: wndId //可指定播放窗口
  675. })
  676. })
  677. }
  678. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  679. }
  680. }
  681. // 推送消息
  682. function cbIntegrationCallBack(oData) {
  683. console.log(JSON.stringify(oData.responseMsg))
  684. }
  685. </script>
  686. <style rel="stylesheet/scss" lang="scss" scoped>
  687. @import '@/assets/styles/base.scss';
  688. .event-info-con {
  689. width: 100%;
  690. display: flex;
  691. .e-left {
  692. width: 32%;
  693. }
  694. .e-center {
  695. width: 30%;
  696. margin-left: 1%;
  697. .img-company {
  698. width: 100%;
  699. height: 18.3vh;
  700. img {
  701. }
  702. }
  703. }
  704. .e-right {
  705. margin-left: 1%;
  706. width: 45%;
  707. }
  708. .e-location-left {
  709. width: 28%;
  710. margin-top: 1rem;
  711. }
  712. .e-location-right {
  713. width: 71%;
  714. margin-top: 1.3rem;
  715. margin-left: 1rem;
  716. }
  717. }
  718. .el-dialog:not(.is-fullscreen) {
  719. margin-top: 5.5vh !important;
  720. }
  721. .bottom-menu-normal {
  722. max-width: 90%;
  723. padding: 0 3rem;
  724. position: absolute;
  725. left: 50%;
  726. transform: translateX(-50%);
  727. bottom: 0;
  728. z-index: 100000;
  729. border-radius: 5px;
  730. display: flex;
  731. justify-content: center;
  732. align-items: center;
  733. background: url(../assets/images/integrated/btm-menu.png) center no-repeat;
  734. background-size: cover;
  735. overflow: hidden;
  736. .btm-m-con {
  737. position: relative;
  738. color: $inBlue;
  739. font-size: .5rem;
  740. padding: 1rem 1.5rem;
  741. display: flex;
  742. align-items: center;
  743. justify-content: center;
  744. -webkit-transform: translateY(0);
  745. transform: translateY(0);
  746. transition: all 0.2s ease-in-out;
  747. cursor: pointer;
  748. white-space: nowrap;
  749. i {
  750. font-size: 1rem;
  751. color: $inBlue;
  752. text-shadow: 0 0 10px rgba($color: $inBlue, $alpha: .6);
  753. margin-right: 0.2rem;
  754. }
  755. }
  756. .btm-m-con:hover {
  757. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  758. filter: brightness(2.3);
  759. -webkit-transform: translateX(0.2rem);
  760. transform: translateX(0.2rem);
  761. transition: all 0.2s ease-in-out;
  762. i {
  763. color: $inBlueHover;
  764. text-shadow: 0 0 20px rgba($color: $inBlueHover, $alpha: 1.0);
  765. }
  766. }
  767. .m-l-none {
  768. .el-input__inner {
  769. margin-left: 0 !important;
  770. }
  771. }
  772. }
  773. /*海康*/
  774. html, body {
  775. padding: 0;
  776. margin: 0;
  777. }
  778. .playWnd {
  779. margin: -13px 0 0 255px;
  780. width: 850px; /*播放容器的宽和高设定*/
  781. height: 615px;
  782. border: 1px solid red;
  783. }
  784. .operate {
  785. margin-top: 24px;
  786. }
  787. .operate::after {
  788. content: '';
  789. display: block;
  790. clear: both;
  791. }
  792. .module {
  793. float: left;
  794. width: 340px;
  795. /*min-height: 320px;*/
  796. margin-left: 16px;
  797. padding: 16px 8px;
  798. box-sizing: border-box;
  799. border: 1px solid #e5e5e5;
  800. }
  801. .module .item {
  802. margin-bottom: 4px;
  803. }
  804. .module input[type="text"] {
  805. box-sizing: border-box;
  806. display: inline-block;
  807. vertical-align: middle;
  808. margin-left: 0;
  809. width: 150px;
  810. min-height: 20px;
  811. }
  812. .module .btn {
  813. min-width: 80px;
  814. min-height: 24px;
  815. margin-top: 100px;
  816. margin-left: 80px;
  817. }
  818. </style>