video-container.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div v-if="videoData.length === 1" class="video-container1">
  3. <div class="video-item">
  4. <div class="tag" :title="videoData[0].name">
  5. <div class="name">{{ videoData[0].name }}</div>
  6. </div>
  7. <HKVideo :dot_data="videoData[0]" :height="866" />
  8. </div>
  9. </div>
  10. <div v-else-if="videoData.length >= 2 && videoData.length <= 4" class="video-container2">
  11. <div v-for="(item, index) in videoData" :key="index" class="video-item">
  12. <div class="tag" :title="item.name">
  13. <div class="name">{{ item.name }}</div>
  14. </div>
  15. <HKVideo :dot_data="item" :height="410" />
  16. </div>
  17. </div>
  18. <div v-else-if="videoData.length >= 5 && videoData.length <= 6" class="video-container3">
  19. <div class="box1">
  20. <div class="video-item2">
  21. <div class="tag" :title="videoData[0].name">
  22. <div class="name">{{ videoData[0].name }}</div>
  23. </div>
  24. <HKVideo :dot_data="videoData[0]" :height="562" />
  25. </div>
  26. </div>
  27. <div class="box2">
  28. <div class="video-item3">
  29. <div class="tag" :title="videoData[1].name">
  30. <div class="name">{{ videoData[1].name }}</div>
  31. </div>
  32. <HKVideo :dot_data="videoData[1]" :height="258" />
  33. </div>
  34. <div class="video-item3">
  35. <div class="tag" :title="videoData[2].name">
  36. <div class="name">{{ videoData[2].name }}</div>
  37. </div>
  38. <HKVideo :dot_data="videoData[2]" :height="258" />
  39. </div>
  40. </div>
  41. <div class="box3">
  42. <div class="video-item">
  43. <div class="tag" :title="videoData[3].name">
  44. <div class="name">{{ videoData[3].name }}</div>
  45. </div>
  46. <HKVideo :dot_data="videoData[3]" :height="258" />
  47. </div>
  48. <div class="video-item">
  49. <div class="tag" :title="videoData[4].name">
  50. <div class="name">{{ videoData[4].name }}</div>
  51. </div>
  52. <HKVideo :dot_data="videoData[4]" :height="258" />
  53. </div>
  54. <div class="video-item">
  55. <div class="tag" :title="videoData[5].name">
  56. <div class="name">{{ videoData[5].name }}</div>
  57. </div>
  58. <HKVideo :dot_data="videoData[5]" :height="258" />
  59. </div>
  60. </div>
  61. </div>
  62. <div v-else-if="videoData.length >= 7" class="video-container4">
  63. <div v-for="(item, index) in videoData" :key="index" class="video-item">
  64. <div class="tag" :title="item.name">
  65. <div class="name">{{ item.name }}</div>
  66. </div>
  67. <HKVideo :dot_data="item" :height="258" />
  68. </div>
  69. </div>
  70. <div v-else class="tip">附近没有可用监控视频</div>
  71. </template>
  72. <script lang="ts" setup>
  73. interface Props {
  74. videoData: any[];
  75. }
  76. const props = withDefaults(defineProps<Props>(), {});
  77. </script>
  78. <style lang="scss" scoped>
  79. .video-container1 {
  80. width: 100%;
  81. height: 100%;
  82. font-size: 38px;
  83. .video-item {
  84. width: 100%;
  85. height: 100%;
  86. }
  87. }
  88. .video-container2 {
  89. display: flex;
  90. flex-wrap: wrap;
  91. width: 100%;
  92. height: 100%;
  93. font-size: 38px;
  94. .video-item {
  95. width: calc(50% - 12px);
  96. height: 432px;
  97. margin-bottom: 12px;
  98. margin-right: 12px;
  99. &:nth-child(2n) {
  100. margin-right: 0;
  101. }
  102. }
  103. }
  104. .video-container3 {
  105. display: flex;
  106. flex-wrap: wrap;
  107. width: 100%;
  108. height: 100%;
  109. font-size: 38px;
  110. .box1 {
  111. width: calc(66.66666% - 6px);
  112. height: 596px;
  113. margin-bottom: 12px;
  114. margin-right: 12px;
  115. .video-item2 {
  116. width: 100%;
  117. height: 100%;
  118. }
  119. }
  120. .box2 {
  121. width: calc(33.33333% - 6px);
  122. height: 596px;
  123. .video-item3 {
  124. width: 100%;
  125. height: 292px;
  126. margin-bottom: 12px;
  127. &:nth-child(2) {
  128. margin-top: 12px;
  129. }
  130. }
  131. }
  132. .box3 {
  133. width: 100%;
  134. height: 292px;
  135. display: flex;
  136. }
  137. .video-item {
  138. width: calc(33.33333% - 8px);
  139. height: 292px;
  140. margin-bottom: 12px;
  141. margin-right: 12px;
  142. &:nth-child(3n) {
  143. margin-right: 0;
  144. }
  145. }
  146. }
  147. .video-container4 {
  148. display: flex;
  149. flex-wrap: wrap;
  150. width: 100%;
  151. height: 100%;
  152. overflow-y: auto;
  153. font-size: 38px;
  154. .video-item {
  155. width: calc(33.33333% - 8px);
  156. height: 292px;
  157. margin-bottom: 12px;
  158. margin-right: 12px;
  159. &:nth-child(3n) {
  160. margin-right: 0;
  161. }
  162. }
  163. }
  164. .tip {
  165. width: 100%;
  166. height: 100%;
  167. font-size: 44px;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. }
  172. .video-item,
  173. .video-item2,
  174. .video-item3 {
  175. position: relative;
  176. background: url('@/assets/images/video/videoBg.png');
  177. background-size: 100% 100%;
  178. padding: 17px;
  179. .tag {
  180. position: absolute;
  181. bottom: 17px;
  182. right: 17px;
  183. color: #fff;
  184. z-index: 11;
  185. width: 425px;
  186. height: 75px;
  187. background: url('@/assets/images/video/tag2.png') no-repeat;
  188. display: flex;
  189. justify-content: flex-end;
  190. align-items: center;
  191. .name {
  192. width: 360px;
  193. white-space: nowrap;
  194. overflow: hidden;
  195. text-overflow: ellipsis;
  196. text-align: left;
  197. padding-right: 5px;
  198. }
  199. }
  200. }
  201. </style>