previewVideo.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="previewVideo">
  3. <div class="h2 flex-center">视频列表</div>
  4. <div class="video-list">
  5. <div
  6. class="video-item"
  7. v-for="(item, index) in videoList"
  8. :key="index"
  9. @click="onDetail(item)"
  10. >
  11. <!-- <videoPlayer
  12. class="ql-video video"
  13. height="100%"
  14. preload="auto"
  15. :playLarge="false"
  16. :src="`${item.url}#t=1`"
  17. @play="onPlay(index)"
  18. :ref="`video${index}`"
  19. ></videoPlayer> -->
  20. <img src="../images/video_default.png" class="video" />
  21. <p class="time">{{ item.createdTime }}</p>
  22. </div>
  23. <MEmpty
  24. v-if="!videoStatus"
  25. msg="暂无视频"
  26. style="width: 100%; margin-bottom: 0.1rem"
  27. />
  28. <van-popup
  29. v-model="videoPopup"
  30. :class="[os == 'mobile' ? 'androidClass' : 'iosClass']"
  31. closeable
  32. >
  33. <!-- height="1.915rem" -->
  34. <videoPlayer
  35. v-if="videoPopup"
  36. class="ql-video"
  37. :fullscreen="isAndroid && os == 'mobile' ? false : true"
  38. :height="os == 'mobile' ? '100%' : '1.915rem'"
  39. :src="videoSrc"
  40. ></videoPlayer>
  41. </van-popup>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import { browser } from "@/common/common";
  47. import MEmpty from "@/components/MEmpty";
  48. import videoPlayer from "@/components/video";
  49. import { queryRoomDetail } from "../api";
  50. export default {
  51. components: {
  52. videoPlayer,
  53. MEmpty,
  54. },
  55. data() {
  56. const query = this.$route.query;
  57. return {
  58. roomUid: query.roomUid,
  59. videoStatus: true,
  60. videoList: [],
  61. videoPopup: false,
  62. videoSrc: "",
  63. os: "",
  64. };
  65. },
  66. // props: ["videoList"],
  67. computed: {
  68. isAndroid() {
  69. return browser().android;
  70. },
  71. },
  72. mounted() {
  73. document.title = "视频列表";
  74. this.getVideoList();
  75. },
  76. methods: {
  77. onDetail(item) {
  78. this.videoPopup = true;
  79. this.videoSrc = item.url + "#t=1";
  80. this.os = item.os;
  81. },
  82. async getVideoList() {
  83. try {
  84. this.videoStatus = true;
  85. const res = await queryRoomDetail({ roomUid: this.roomUid });
  86. const result = res.data;
  87. this.videoList = result || [];
  88. this.videoStatus = this.videoList.length > 0;
  89. } catch {
  90. //
  91. }
  92. },
  93. onPlay(index) {
  94. // #t=1
  95. console.log(index, "index");
  96. },
  97. },
  98. };
  99. </script>
  100. <style lang="less" scoped>
  101. .flex-center {
  102. display: flex;
  103. justify-content: flex-start;
  104. align-items: center;
  105. }
  106. /deep/.icon_nodata {
  107. margin-top: 0.2rem !important;
  108. }
  109. .previewVideo {
  110. min-height: calc(100vh - 0.44rem);
  111. padding: 0.22rem 0.16rem;
  112. }
  113. .h2 {
  114. margin-bottom: 0.1rem;
  115. font-size: 0.18rem;
  116. font-weight: 500;
  117. color: #333333;
  118. &::before {
  119. display: inline-block;
  120. content: " ";
  121. width: 4px;
  122. height: 17px;
  123. background: #01c1b5;
  124. border-radius: 3px;
  125. margin-right: 0.07rem;
  126. }
  127. }
  128. .video-list {
  129. display: flex;
  130. align-items: center;
  131. flex-wrap: wrap;
  132. justify-content: space-between;
  133. }
  134. .video-item {
  135. width: 48%;
  136. margin-bottom: 0.1rem;
  137. .video {
  138. width: 100%;
  139. height: 1rem;
  140. background: #d8d8d8;
  141. border-radius: 0.1rem;
  142. overflow: hidden;
  143. vertical-align: middle;
  144. }
  145. .time {
  146. font-size: 0.12rem;
  147. color: #666666;
  148. line-height: 0.28rem;
  149. }
  150. /deep/.plyr {
  151. min-width: 100%;
  152. }
  153. }
  154. .iosClass {
  155. width: 90%;
  156. }
  157. .androidClass {
  158. width: 100%;
  159. height: 100%;
  160. display: flex;
  161. }
  162. </style>