guide.vue 4.8 KB

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