guide-pc.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="bg-guide">
  3. <v-carousel :show-arrows="false" cycle interval="3000" height="120" hide-delimiter-background class="w345h120" delimiter-icon="mdi-minus">
  4. <v-carousel-item v-for="item in topADList" :key="item.id" :src="item.imgUrls[0]" @click="playAd(item)"></v-carousel-item>
  5. </v-carousel>
  6. <v-tabs v-model="tab" color="#3666F2" background-color="transparent" style="height: 42px;">
  7. <v-tab v-for="item in videoList" :key="item.plateId" style="height: 42px;">{{item.plateName}}</v-tab>
  8. <v-tabs-items v-model="tab">
  9. <v-tab-item v-for="item in videoList" :key="item.plateId" style="padding: 10px;background: #FAFAFA;min-height: calc(100vh - 162px);">
  10. <div v-for="ele in item.videoCourseList" :key="ele.id" class="video-card" @click="play(item, ele)">
  11. <video :id="'el-video-' + ele.id" class="w165h148" preload="auto" :poster="videoURL(ele.coverImageKey)" :src="videoURL(ele.videoKey)" />
  12. <!-- <div class="video-card-title">{{ele.videoName}}</div> -->
  13. </div>
  14. </v-tab-item>
  15. </v-tabs-items>
  16. </v-tabs>
  17. </div>
  18. </template>
  19. <script>
  20. import { fileKeyToUrl } from '@/plugins/file-center.js';
  21. export default {
  22. name: 'GuidePc',
  23. auth: false,
  24. data() {
  25. return {
  26. tab: null,
  27. videoList: [],
  28. topADList: [],
  29. token: ''
  30. }
  31. },
  32. fetch() {
  33. this.token = this.$route.query.token;
  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. } else {
  72. elVideo.requestFullscreen()
  73. elVideo.play()
  74. }
  75. this.submit(item, ele, 1)
  76. },
  77. playAd(item) {
  78. this.submit(item, '', 2)
  79. if (item.actionType === '1' || item.actionType === '3' || item.actionType === '4' || item.actionType === '5' || item.actionType === '6') {
  80. window.location.href = item.clickUrl
  81. }
  82. },
  83. submit(item, ele, flag) {
  84. const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2 }
  85. this.$axios.$post('/activity/v5/advertising/getAdInfoByAdPlace', data, {headers: {Authorization: this.token}});
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. @media (min-width: 0px) {
  92. .bg-guide {
  93. & .v-tabs-bar {
  94. height: 42px !important;
  95. }
  96. }
  97. }
  98. </style>
  99. <style lang="scss" scoped>
  100. .bgFAFAFA {
  101. background: #FAFAFA;
  102. }
  103. @media (min-width: 0px) {
  104. .video-card {
  105. width: 165px;
  106. height: 148px;
  107. border-radius: 5px;
  108. position: relative;
  109. display: inline-block;
  110. margin-right: 30px;
  111. &:nth-of-type(4n+0){
  112. margin-right: 0px;
  113. }
  114. & .video-card-title {
  115. width: 100%;
  116. height: 45px;
  117. line-height: 45px;
  118. text-align: center;
  119. font-size: 14px;
  120. font-weight: 500;
  121. color: #1C1C1E;
  122. background: #fff;
  123. border-radius: 0 0 9px 9px;
  124. position: absolute;
  125. left: 0;
  126. bottom: 0;
  127. }
  128. }
  129. .bg-guide {
  130. min-height: 100vh;
  131. overflow: hidden;
  132. & .v-tab {
  133. font-size: 12px;
  134. min-width: 88px;
  135. }
  136. & .v-tabs-bar {
  137. height: 42px !important;
  138. }
  139. }
  140. .w345h120 {
  141. width: 345px;
  142. height: 120px;
  143. margin: 10px auto;
  144. display: block;
  145. background: #FAFAFA;
  146. border-radius: 5px;
  147. }
  148. .w165h148 {
  149. width: 165px;
  150. height: 148px;
  151. margin-bottom: 10px;
  152. margin-right: 30px;
  153. border-radius: 10px;
  154. &:nth-of-type(4n+0){
  155. margin-right: 0px;
  156. }
  157. }
  158. }
  159. </style>