guide.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="bg2C2C2D">
  3. <video v-for="item in topADList" id="ad" :key="item.id" class="w345h120" :poster="item.imgUrls[0]" :src="item.videoUrl" @click="playAd()" />
  4. <div v-for="item in videoList" :key="item.plateId">
  5. <div class="fs16">{{item.plateName}}</div>
  6. <div :class="item.displayMode === 1 ? 'jjjc-list' : 'jcjc-list'">
  7. <video v-for="ele in item.videoCourseList" :id="'el-video-' + ele.id" :key="ele.id" class="w165h148" preload="auto" :poster="videoURL(ele.coverImageKey)" :src="videoURL(ele.videoKey)" @click="play(item, ele)" />
  8. </div>
  9. </div>
  10. <div class="return out"><div class="in"><img src="~/assets/image/activity/invite-user/guide/left.png" /></div></div>
  11. </div>
  12. </template>
  13. <script>
  14. import { fileKeyToUrl } from '@/plugins/file-center.js';
  15. export default {
  16. name: 'Guide',
  17. auth: false,
  18. data() {
  19. return {
  20. videoList: [],
  21. topADList: [],
  22. token: ''
  23. }
  24. },
  25. fetch() {
  26. this.token = this.$route.query.token;
  27. },
  28. computed: {
  29. videoURL() {
  30. return (key) => {
  31. return fileKeyToUrl + key
  32. }
  33. }
  34. },
  35. created() {
  36. this.getActiveInfo()
  37. this.getAdInfoByAdPlace()
  38. },
  39. methods: {
  40. async getActiveInfo() {
  41. const res = await this.$axios.$get('/api/activity/videoCourse/client/list');
  42. this.videoList = res.data;
  43. },
  44. async getAdInfoByAdPlace() {
  45. const data = {
  46. id: 1,
  47. adPlace: 20,
  48. os: 1
  49. }
  50. const res = await this.$axios.$post('/api/public/v5/advertising/getAdInfoByAdPlace', data);
  51. this.topADList = res.data;
  52. },
  53. play(item, ele) {
  54. const elVideo = document.getElementById('el-video-' + ele.id)
  55. if (elVideo.requestFullscreen) {
  56. elVideo.requestFullscreen()
  57. elVideo.play()
  58. } else if (elVideo.mozRequestFullscreen) {
  59. elVideo.mozRequestFullscreen()
  60. elVideo.play()
  61. } else if (elVideo.webkitRequestFullscreen) {
  62. elVideo.webkitRequestFullscreen()
  63. elVideo.play()
  64. }
  65. this.submit(item, ele, 1)
  66. },
  67. playAd(item, ele) {
  68. const elVideo = document.getElementById('ad')
  69. if (elVideo.requestFullscreen) {
  70. elVideo.requestFullscreen()
  71. elVideo.play()
  72. } else if (elVideo.mozRequestFullscreen) {
  73. elVideo.mozRequestFullscreen()
  74. elVideo.play()
  75. } else if (elVideo.webkitRequestFullscreen) {
  76. elVideo.webkitRequestFullscreen()
  77. elVideo.play()
  78. }
  79. this.submit(item, ele, 2)
  80. },
  81. submit(item, ele, flag) {
  82. const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2 }
  83. this.$axios.$post('/api/activity/videoCourse/statistics/save', data, {headers: {Authorization: this.token}});
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .bg2C2C2D {
  90. background-color: #1C1C1E;
  91. min-height: 100vh;
  92. overflow: hidden;
  93. }
  94. .w345h120 {
  95. width: 345px;
  96. height: 120px;
  97. margin: 15px;
  98. }
  99. .fs16 {
  100. font-weight: 500;
  101. color: #ffffff;
  102. font-size: 16px;
  103. margin-left: 15px;
  104. display: flex;
  105. align-items: center;
  106. }
  107. .jcjc-list {
  108. padding: 0 15px;
  109. overflow-x: scroll;
  110. display: flex;
  111. margin: 15px 0;
  112. .w165h148 {
  113. margin-right: 10px;
  114. &:last-child {
  115. margin-right: 0;
  116. }
  117. }
  118. }
  119. .fs16::before {
  120. content: '';
  121. display: inline-block;
  122. width: 6px;
  123. height: 14px;
  124. background: #3b7fff;
  125. border-radius: 3px 3px 3px 3px;
  126. opacity: 1;
  127. margin-right: 6px;
  128. }
  129. .w144h140 {
  130. width: 144px;
  131. height: 140px;
  132. margin-right: 10px;
  133. }
  134. .w144h140:last-child {
  135. margin-right: 0;
  136. }
  137. .jjjc-list {
  138. display: flex;
  139. flex-flow: wrap;
  140. justify-content: space-between;
  141. padding: 15px;
  142. }
  143. .w165h148 {
  144. width: 165px;
  145. height: 148px;
  146. object-fit: contain;
  147. margin-bottom: 15px;
  148. }
  149. .return {
  150. width: 42px;
  151. height: 42px;
  152. margin-left: 20px;
  153. margin-bottom: 40px;
  154. &.out {
  155. border-radius: 50%;
  156. padding: 1px;
  157. background: linear-gradient(46deg, rgba(48, 49, 53, 1), rgba(113, 116, 127, 1));
  158. box-shadow: 0px 9px 17px 0px rgba(0,0,0,0.5);
  159. }
  160. .in {
  161. width: 40px;
  162. height: 40px;
  163. border-radius: 50%;
  164. background: linear-gradient(180deg, #232427 0%, #4B4C52 100%);
  165. opacity: 1;
  166. text-align: center;
  167. line-height: 40px;
  168. }
  169. img {
  170. width: 16px;
  171. height: 16px;
  172. }
  173. }
  174. </style>