index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <page-layout class="video-container">
  3. <nav-bar title="精彩视频" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view :tabbar-conflict="true">
  5. <view class="main-container">
  6. <view class="video-list">
  7. <view class="video-item" v-for="(item, index) in videoList" :key="index">
  8. <image :mode="imageMode" :src="item.cover_url" class="cover-img" />
  9. <view class="video-play" @tap="videoPlay(item)">
  10. <view class="iconfont icon-playcircle"></view>
  11. </view>
  12. </view>
  13. </view>
  14. <van-overlay :show="showOverlay" @tap="onClickHideOverlay">
  15. <view class="overlay-wrapper">
  16. <video v-if="videoUrl" :src="videoUrl" controls autoplay loop @tap.stop></video>
  17. </view>
  18. </van-overlay>
  19. </view>
  20. </u-scroll-view>
  21. <contact-us :show.sync="showContactUs" :qrcode_url="q_url" />
  22. <float-button @custom-event="updateContactStatus()"></float-button>
  23. <van-dialog id="van-dialog" />
  24. </page-layout>
  25. </template>
  26. <script>
  27. import NavBar from '@/components/layout/nav-bar'
  28. import UScrollView from '@/components/common/u-scroll-view'
  29. import VanOverlay from '@/wxcomponents/vant/overlay/index'
  30. import floatButton from "@/components/layout/float-button"
  31. import ContactUs from '@/pages/index/components/contact-us.vue'
  32. import {
  33. getDashboardInfo
  34. } from '@/api'
  35. import PageLayout from "@/components/layout/page-layout";
  36. export default {
  37. components: {
  38. PageLayout,
  39. NavBar,
  40. UScrollView,
  41. VanOverlay,
  42. floatButton,
  43. ContactUs
  44. },
  45. data() {
  46. return {
  47. showOverlay: false,
  48. videoList: [],
  49. videoUrl: '',
  50. showContactUs: false,
  51. q_url: ''
  52. }
  53. },
  54. props: {
  55. imageMode: {
  56. type: String,
  57. default: 'aspectFill' // 参考https://zh.uniapp.dcloud.io/component/image.html
  58. }
  59. },
  60. mounted() {
  61. this.getVideoData()
  62. },
  63. methods: {
  64. onClickHideOverlay() {
  65. this.showOverlay = false
  66. },
  67. getVideoData() {
  68. getDashboardInfo('', process.env.CONFERENCE_WEBSITE).then(res => {
  69. this.videoList = res.data.module3.video
  70. })
  71. },
  72. videoPlay(item) {
  73. this.videoUrl = item.url
  74. this.showOverlay = true
  75. },
  76. updateContactStatus(data) {
  77. this.showContactUs = data.showContactUs
  78. this.q_url = data.q_url
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .video-container {
  85. .video-list {
  86. display: grid;
  87. grid-template-columns: 1fr;
  88. grid-gap: 30rpx;
  89. .video-item {
  90. width: 100%;
  91. aspect-ratio: 5/3;
  92. position: relative;
  93. border-radius: 14rpx;
  94. overflow: hidden;
  95. .cover-img {
  96. position: absolute;
  97. width: 100%;
  98. height: 100%;
  99. top: 0;
  100. left: 0;
  101. z-index: 1;
  102. }
  103. .video-play {
  104. @include display-flex-center;
  105. position: absolute;
  106. top: 0;
  107. bottom: 0;
  108. right: 0;
  109. left: 0;
  110. width: 70rpx;
  111. height: 70rpx;
  112. border-radius: 50%;
  113. margin: auto;
  114. background-color: rgba(229, 117, 25, 0.5);
  115. z-index: 1;
  116. .iconfont {
  117. color: #FFFFFF;
  118. font-size: 50rpx;
  119. }
  120. }
  121. }
  122. }
  123. .overlay-wrapper {
  124. @include display-flex-center;
  125. height: 100%;
  126. video {
  127. width: 100%;
  128. }
  129. }
  130. }
  131. </style>