videoComponent.vue 6.3 KB

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