previewVideo.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 v-model="videoPopup" style="width: 90%" closeable>
  29. <videoPlayer
  30. v-if="videoPopup"
  31. class="ql-video"
  32. height="1.915rem"
  33. :src="videoSrc"
  34. ></videoPlayer>
  35. </van-popup>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import MEmpty from "@/components/MEmpty";
  41. import videoPlayer from "@/components/video";
  42. import { queryRoomDetail } from "../api";
  43. export default {
  44. components: {
  45. videoPlayer,
  46. MEmpty,
  47. },
  48. data() {
  49. const query = this.$route.query;
  50. return {
  51. roomUid: query.roomUid,
  52. videoStatus: true,
  53. videoList: [],
  54. videoPopup: false,
  55. videoSrc: "",
  56. };
  57. },
  58. // props: ["videoList"],
  59. mounted() {
  60. document.title = "视频列表";
  61. this.getVideoList();
  62. },
  63. methods: {
  64. onDetail(item) {
  65. this.videoPopup = true;
  66. this.videoSrc = item.url + "#t=1";
  67. },
  68. async getVideoList() {
  69. try {
  70. this.videoStatus = true;
  71. const res = await queryRoomDetail({ roomUid: this.roomUid });
  72. const result = res.data;
  73. this.videoList = result || [];
  74. this.videoStatus = this.videoList.length > 0;
  75. } catch {
  76. //
  77. }
  78. },
  79. onPlay(index) {
  80. // #t=1
  81. console.log(index, "index");
  82. },
  83. },
  84. };
  85. </script>
  86. <style lang="less" scoped>
  87. .flex-center {
  88. display: flex;
  89. justify-content: flex-start;
  90. align-items: center;
  91. }
  92. /deep/.icon_nodata {
  93. margin-top: 0.2rem !important;
  94. }
  95. .previewVideo {
  96. min-height: calc(100vh - 0.44rem);
  97. padding: 0.22rem 0.16rem;
  98. }
  99. .h2 {
  100. margin-bottom: 0.1rem;
  101. font-size: 0.18rem;
  102. font-weight: 500;
  103. color: #333333;
  104. &::before {
  105. display: inline-block;
  106. content: " ";
  107. width: 4px;
  108. height: 17px;
  109. background: #01c1b5;
  110. border-radius: 3px;
  111. margin-right: 0.07rem;
  112. }
  113. }
  114. .video-list {
  115. display: flex;
  116. align-items: center;
  117. flex-wrap: wrap;
  118. justify-content: space-between;
  119. }
  120. .video-item {
  121. width: 48%;
  122. margin-bottom: 0.1rem;
  123. .video {
  124. width: 100%;
  125. height: 1rem;
  126. background: #d8d8d8;
  127. border-radius: 0.1rem;
  128. overflow: hidden;
  129. vertical-align: middle;
  130. }
  131. .time {
  132. font-size: 0.12rem;
  133. color: #666666;
  134. line-height: 0.28rem;
  135. }
  136. /deep/.plyr {
  137. min-width: 100%;
  138. }
  139. }
  140. </style>