当前位置:   article > 正文

九宫格视频监控Vue前端界面布局_vue九宫格视频监控

vue九宫格视频监控

最近做项目要用到是监控界面,需要九宫格的,之前html的时候做过类似的,现在用vue来做,感觉也不是太难,就做出来,具体效果如下:

具体代码:

  1. <template>
  2. <a-row type='flex'>
  3. <a-col :span='5'>
  4. <a-collapse v-model='activeKey'>
  5. <a-collapse-panel key='1' header='画面分割'>
  6. <a-row type='flex' justify='space-between'>
  7. <a-col @click='splitVideo(1,1)' :span='4' class='splitClass' style='background-color: #ff7e23;'>1</a-col>
  8. <a-col @click='splitVideo(2,2)' :span='4' class='splitClass' style='background-color: #00d8cb;'>4</a-col>
  9. <a-col @click='splitVideo(2,3)' :span='4' class='splitClass' style='background-color: #681bb7;'>6</a-col>
  10. <a-col @click='splitVideo(2,4)' :span='4' class='splitClass' style='background-color: #02c140;'>8</a-col>
  11. <a-col @click='splitVideo(3,3)' :span='4' class='splitClass' style='background-color: #ff2d12;'>9</a-col>
  12. <a-col @click='splitVideo(3,4)' :span='4' class='splitClass' style='background-color: #57c4ff;'>12</a-col>
  13. </a-row>
  14. </a-collapse-panel>
  15. <a-collapse-panel key='2' header='云台控制'>
  16. <div class='contentBody'>
  17. <div style='height: 170px;'>
  18. <div
  19. style='width:166px;height:165px; float: left; margin-top: 10px;padding-left:5px;'>
  20. <div title='右上' class='direction' onmousedown="contr('ptz-rotate','92')"
  21. onmouseup="contr('ptz-rotate','24')">
  22. <img src='../../../assets/images/video/ys.png'></div>
  23. <div title='上' class='direction' >
  24. <img src='../../../assets/images/video/s.png'></div>
  25. <div title='左上' class='direction'>
  26. <img src='../../../assets/images/video/zs.png'></div>
  27. <div title='右' class='direction' >
  28. <img src='../../../assets/images/video/y.png'></div>
  29. <div title='居中' class='direction' onmousedown='' onmouseup=''>
  30. <img src='../../../assets/images/video/zj.png'></div>
  31. <div title='左' class='direction' >
  32. <img src='../../../assets/images/video/z.png'></div>
  33. <div title='右下' class='direction' >
  34. <img src='../../../assets/images/video/yx.png'></div>
  35. <div title='下' class='direction' >
  36. <img src='../../../assets/images/video/x.png'></div>
  37. <div title='左下' class='direction' >
  38. <img src='../../../assets/images/video/zx.png'></div>
  39. </div>
  40. <div
  41. style='width:130px;height:165px; float: left; margin-top: 10px;padding-left:15px;'>
  42. <div class='zoom'>
  43. <img class='zoomOut' title='放大'
  44. src='../../../assets/images/video/zoomOut.png'>
  45. <span style='width: 39px;text-align: center;'>变倍</span>
  46. <img class='zoomOut' title='缩小'
  47. src='../../../assets/images/video/zoomIn.png'>
  48. </div>
  49. <div class='zoom'>
  50. <img class='zoomOut' title='放大'
  51. src='../../../assets/images/video/jujiaoOut.png'>
  52. <span style='width: 39px;text-align: center;'>聚焦</span>
  53. <img class='zoomOut' title='缩小'
  54. src='../../../assets/images/video/jujiaoIn.png'>
  55. </div>
  56. <div class='zoom'>
  57. <img class='zoomOut' title='放大'
  58. src='../../../assets/images/video/guangquanOut.png'>
  59. <span style='width: 39px;text-align: center;'>光圈</span>
  60. <img class='zoomOut' title='缩小'
  61. src='../../../assets/images/video/guangquanIn.png'>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </a-collapse-panel>
  67. <a-collapse-panel key='3' header='速度'>
  68. <a-slider v-model='speed' :min='1' :max='10' />
  69. </a-collapse-panel>
  70. <a-collapse-panel key='4' header='相机列表'>
  71. <a-directory-tree multiple default-expand-all @select='onSelect' @expand='onExpand'>
  72. <a-tree-node key='0-0' title='parent 0'>
  73. <a-tree-node key='0-0-0' title='leaf 0-0' is-leaf />
  74. <a-tree-node key='0-0-1' title='leaf 0-1' is-leaf />
  75. </a-tree-node>
  76. <a-tree-node key='0-1' title='parent 1'>
  77. <a-tree-node key='0-1-0' title='leaf 1-0' is-leaf />
  78. <a-tree-node key='0-1-1' title='leaf 1-1' is-leaf />
  79. </a-tree-node>
  80. </a-directory-tree>
  81. </a-collapse-panel>
  82. </a-collapse>
  83. </a-col>
  84. <a-col :span='19' >
  85. <a-row style='width: 100%;' v-for="(item,rowIndex) in rows" type='flex' :key="rowIndex">
  86. <a-col v-for='(item,colIndex) in cols' :span="item" :key="''+rowIndex+colIndex" @click="setCurrent(rowIndex,colIndex)" >
  87. <a-card size="small" :style="(rowIndex==currentIndex[0]&&colIndex==currentIndex[1])?'background-color: #5ea6f1':''" title='视频监控'>
  88. <a slot='extra' s href='#'>截图</a>
  89. <a style='margin-left: 10px;' slot='extra' s href='#'>关闭</a>
  90. <video></video>
  91. </a-card>
  92. </a-col>
  93. </a-row>
  94. </a-col>
  95. </a-row>
  96. </template>
  97. <script>
  98. export default {
  99. name: 'VideoMonitor',
  100. data() {
  101. return {
  102. activeKey: ['1', '2', '3', '4'],
  103. speed: 5,
  104. rows:[1],
  105. cols:[24],
  106. currentIndex:[0,0],
  107. }
  108. },
  109. methods: {
  110. splitVideo(row,col) {
  111. this.rows=[];
  112. this.cols=[];
  113. for(let i=0;i<row;i++){
  114. this.rows.push(1);
  115. }
  116. for(let i=0;i<col;i++){
  117. this.cols.push(24/col);
  118. }
  119. },
  120. setCurrent(row,col){
  121. this.currentIndex=[row,col];
  122. },
  123. contr(code,value){
  124. }
  125. }
  126. }
  127. </script>
  128. <style>
  129. .ant-card-small > .ant-card-body{
  130. padding: 0px;
  131. background-color: white;
  132. }
  133. .splitClass {
  134. cursor: pointer;
  135. color: white;
  136. width: 30px;
  137. height: 30px;
  138. text-align: center;
  139. line-height: 30px;
  140. }
  141. .sec li {
  142. width: 80px;
  143. line-height: 35px;
  144. font-size: 12px;
  145. color: #FFFFFF;
  146. }
  147. .sec li.cur {
  148. background-color: #3374BD;
  149. color: #FFFFFF;
  150. }
  151. .rightContent {
  152. display: none;
  153. border-left: 1px solid #BDC6CF;
  154. border-right: 1px solid #BDC6CF;
  155. margin-left: -1px;
  156. width: 316px;
  157. height: 265px;
  158. background-color: #ffffff;
  159. }
  160. .contentBody {
  161. width: 320px;
  162. /*height: 225px;*/
  163. }
  164. .direction {
  165. margin-right: 1px;
  166. margin-bottom: 1px;
  167. float: right;
  168. width: 50px;
  169. height: 50px;
  170. border-radius: 4px;
  171. background-color: RGB(69, 98, 125);
  172. cursor: pointer;
  173. }
  174. .direction img {
  175. width: 25px;
  176. margin-left: 12px;
  177. margin-top: 12px;
  178. }
  179. .zoom {
  180. margin-top: 14px;
  181. margin-bottom: 25px;
  182. }
  183. .zoom img {
  184. width: 26px;
  185. cursor: pointer;
  186. }
  187. .zoom span {
  188. display: inline-block;
  189. margin-left: 5px;
  190. margin-right: 5px;
  191. color: #444;
  192. }
  193. /* 设置滚动条的样式 */
  194. ::-webkit-scrollbar {
  195. width: 6px;
  196. }
  197. /* 滚动槽 */
  198. ::-webkit-scrollbar-track {
  199. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.3);
  200. border-radius: 10px;
  201. }
  202. /* 滚动条滑块 */
  203. ::-webkit-scrollbar-thumb {
  204. border-radius: 10px;
  205. background: rgba(0, 0, 0, 0.1);
  206. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);
  207. }
  208. ::-webkit-scrollbar-thumb:window-inactive {
  209. background: rgba(255, 0, 0, 0.4);
  210. }
  211. .box-shadow-1 {
  212. -webkit-box-shadow: 0px 3px 3px #3E91FF;
  213. -moz-box-shadow: 0px 3px 3px #3E91FF;
  214. box-shadow: 0px 3px 3px #042F52;
  215. }
  216. div#rMenu {
  217. position: absolute;
  218. visibility: hidden;
  219. top: 0;
  220. background-color: #cad4e6;
  221. text-align: left;
  222. padding: 2px;
  223. }
  224. div#rMenu ul li {
  225. margin: 1px 0;
  226. padding: 0 5px;
  227. cursor: pointer;
  228. list-style: none outside none;
  229. background-color: #F1F6FE;
  230. line-height: 24px;
  231. color: #98A9C0;
  232. font-size: 12px;
  233. }
  234. div#rMenu ul li span {
  235. margin-left: 5px;
  236. }
  237. .nstSlider .leftGrip {
  238. background-color: #A9D0F1;
  239. }
  240. #video_split ul {
  241. width: 100%;
  242. float: left;
  243. height: 43px;
  244. margin-left: 10px;
  245. }
  246. #video_split ul li {
  247. width: 28px;
  248. padding: 6px 10px 6px 10px;
  249. float: left;
  250. text-align: center;
  251. }
  252. #video_split ul li img {
  253. width: 28px;
  254. height: 28px;
  255. cursor: pointer;
  256. }
  257. .messager-close, .messager-close:visited {
  258. margin: 0 0 0 0 !important;
  259. }
  260. .video {
  261. height: 300px;
  262. }
  263. .panel {
  264. float: left;
  265. }
  266. video {
  267. object-fit: fill;
  268. width: 100%;
  269. height: 100%;
  270. background-color: black;
  271. }
  272. video::-webkit-media-controls-enclosure {
  273. display: none !important;
  274. }
  275. video::-webkit-media-controls {
  276. display: none !important;
  277. }
  278. .selected {
  279. background-color: deepskyblue;
  280. }
  281. div#rMenu {
  282. position: absolute;
  283. visibility: hidden;
  284. top: 0;
  285. text-align: left;
  286. padding: 4px;
  287. }
  288. div#rMenu a {
  289. padding: 3px 15px 3px 15px;
  290. background-color: #cad4e6;
  291. vertical-align: middle;
  292. }
  293. </style>

具体页面还需要优化,整体的结构布局已经出来,希望对你有帮助!

如果其他问题或者合作,可以发邮件探讨:mxgsa@qq.com   

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/106717
推荐阅读
相关标签
  

闽ICP备14008679号