videoComponent.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="videoComponent">
  3. <div class="top-num-max-box">
  4. <div class="for-address-box" v-for="(item,index) in addressList" :key="index">
  5. <p class="el-icon-d-arrow-right icon-p" v-if="index != 0"></p>
  6. <p class="name-p">{{item}}</p>
  7. </div>
  8. <!--<img class="num-img" src="@/assets/ZDimages/icon_bg_rs@1x.png">-->
  9. <!--<p class="name-p">实时人数</p>-->
  10. <!--<div class="for-p" v-for="(item,index) in floorUserNum" :key="item.value">-->
  11. <!--<p>{{item.label}}</p>-->
  12. <!--</div>-->
  13. <!--<p class="name-p" style="margin-left:10px;">人</p>-->
  14. </div>
  15. <div class="video-max-big-box">
  16. <H5PlayerVideo style="margin:20px 28px 0 0 ;"
  17. v-for="(item,index) in videoList" :key="index" :videoProps="item"></H5PlayerVideo>
  18. <img v-if="!videoList[0]" class="null-img" src="@/assets/ZDimages/null-data-1.png">
  19. </div>
  20. <pagination v-show="videoTotal>0"
  21. style="margin:0 20px 28px 0;"
  22. :total="videoTotal"
  23. layout="total, prev, pager, next"
  24. :page.sync="videoQueryParams.page"
  25. :limit.sync="videoQueryParams.pageSize"
  26. @pagination="videoInitialize"
  27. />
  28. <fullH5PlayerVideo v-if="fullVideoType" :fullVideoProps="fullVideoProps"></fullH5PlayerVideo>
  29. </div>
  30. </template>
  31. <script>
  32. import { iotCameraFindByCondition } from "@/api/index";
  33. import H5PlayerVideo from '@/components/H5PlayerVideo/H5PlayerVideo.vue';
  34. import fullH5PlayerVideo from '@/components/fullH5PlayerVideo/fullH5PlayerVideo.vue'
  35. export default {
  36. name: 'videoComponent',
  37. components: {
  38. H5PlayerVideo,
  39. fullH5PlayerVideo
  40. },
  41. data () {
  42. return {
  43. //地址
  44. addressList:[],
  45. //人数
  46. floorUserNum:null,
  47. //视频
  48. // width:685,
  49. width:635,
  50. // height:350,
  51. height:350,
  52. videoType:false,
  53. videoList:[],
  54. videoTotal:0,
  55. videoQueryParams:{
  56. page:1,
  57. pageSize:4,
  58. streamType:1,
  59. source:0,
  60. },
  61. //全屏视频参数
  62. fullVideoProps:{},
  63. fullVideoType:false,
  64. }
  65. },
  66. created(){
  67. },
  68. mounted(){
  69. },
  70. methods:{
  71. //刷新地址
  72. getAddress(list){
  73. this.$set(this,'addressList',list);
  74. },
  75. //刷新人数
  76. getUserNum(num){
  77. if(num == 0){
  78. this.$set(this,'floorUserNum',[{
  79. value:'a0',
  80. label:'0',
  81. }]);
  82. }else{
  83. let list = [];
  84. let newNum = num;
  85. newNum = newNum+'';
  86. for(let i=0;i<newNum.length;i++){
  87. list.push({
  88. value:'a'+i,
  89. label:newNum[i]+'',
  90. })
  91. }
  92. this.$set(this,'floorUserNum',list);
  93. }
  94. },
  95. //刷新视屏
  96. getVideoData(data){
  97. let obj = {
  98. page:1,
  99. pageSize:4,
  100. passageway:'',
  101. protocol:window.location.href.indexOf('https') !== -1?'wss':'ws',
  102. streamType:1,
  103. source:0,
  104. };
  105. if(data.level == 4){
  106. obj.buildId = data.treeId;
  107. }else if(data.level == 5){
  108. obj.floorId = data.treeId;
  109. }else if(!data.subId&&!data.level){
  110. obj.floorId = data.treeId;
  111. }else if(data.subId&&!data.level){
  112. obj.subIds = [data.treeId];
  113. }
  114. this.$set(this,'videoQueryParams',obj);
  115. this.$nextTick(()=>{
  116. this.videoInitialize()
  117. })
  118. },
  119. videoInitialize() {
  120. let self = this;
  121. self.$set(self, 'videoType', false);
  122. self.$set(self, 'videoList', []);
  123. iotCameraFindByCondition(this.videoQueryParams).then(response => {
  124. let list = [];
  125. for(let i=0;i<response.data.records.length;i++){
  126. list.push(
  127. {
  128. width: this.width, //(宽度:非必传-默认600)
  129. height: this.height, //(高度:非必传-默认338)
  130. url: response.data.records[i].streamUrl,
  131. cameraIndexCode: response.data.records[i].deviceNo,
  132. }
  133. )
  134. }
  135. this.$set(this,'videoList',list)
  136. this.$set(this,'videoTotal',response.data.total);
  137. this.$nextTick(()=>{
  138. setTimeout(function(){
  139. self.$set(self, 'videoType', true);
  140. },1000);
  141. })
  142. });
  143. },
  144. //全屏开启-关闭轮播
  145. stopTime(cameraIndexCode){
  146. this.$set(this,'fullVideoProps',{cameraIndexCode:cameraIndexCode});
  147. this.$set(this,'fullVideoType',true);
  148. },
  149. //全屏关闭-开启轮播
  150. outFullScreen(){
  151. let self = this;
  152. this.$set(this,'fullVideoType',false);
  153. this.$set(this,'fullVideoProps',{});
  154. },
  155. },
  156. }
  157. </script>
  158. <style scoped lang="scss">
  159. .videoComponent{
  160. width: 1350px;
  161. height: 874px;
  162. /*background: linear-gradient(180deg, rgba(4, 117, 129, 0.2) 0%, rgba(0, 15, 22, 0) 100%);*/
  163. display: flex;
  164. flex-direction: column;
  165. .top-num-max-box{
  166. padding:0 20px;
  167. height:40px;
  168. display: flex;
  169. .for-address-box{
  170. display: flex;
  171. }
  172. .name-p{
  173. margin:0;
  174. line-height:40px;
  175. font-size:16px;
  176. color:#ffffff;
  177. }
  178. .icon-p{
  179. width:40px;
  180. text-align: center;
  181. color:#03B7CA;
  182. font-size:16px;
  183. line-height:40px;
  184. margin:0;
  185. }
  186. .num-img{
  187. display: block;
  188. margin:0 10px 0 96px;
  189. width:40px;
  190. height:40px;
  191. }
  192. .for-p{
  193. margin:0 0 0 10px;
  194. width:34px;
  195. height:40px;
  196. line-height:40px;
  197. font-size:36px;
  198. text-align: center;
  199. border:1px solid #117977;
  200. background-color: #073e42;
  201. border-radius:2px;
  202. p{
  203. margin:0;
  204. background: -webkit-linear-gradient(0deg, #FFFFFF, #0183FA); /* Chrome, Safari */
  205. background: linear-gradient(0deg, #FFFFFF, #0183FA); /* 标准语法 */
  206. -webkit-background-clip: text; /* Chrome, Safari */
  207. background-clip: text;
  208. -webkit-text-fill-color: transparent; /* Chrome, Safari */
  209. color: transparent; /* 其他浏览器 */
  210. }
  211. }
  212. }
  213. .video-max-big-box{
  214. flex:1;
  215. padding:0 0 0 20px;
  216. .null-img{
  217. display: block;
  218. width:300px;
  219. margin:270px auto;
  220. }
  221. }
  222. }
  223. </style>