guide-pc.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="bg-guide">
  3. <video v-for="item in topADList" id="ad" :key="item.id" class="w345h120" :poster="item.imgUrls[0]" :src="item.videoUrl" @click="playAd()" />
  4. <v-tabs v-model="tab" color="#3666F2" background-color="transparent" style="height: 42px;">
  5. <v-tab v-for="item in videoList" :key="item.plateId" style="height: 42px;">{{item.plateName}}</v-tab>
  6. <v-tabs-items v-model="tab">
  7. <v-tab-item v-for="item in videoList" :key="item.plateId" style="padding: 10px;">
  8. <video v-for="ele in item.videoCourseList" :id="'el-video-' + ele.id" :key="ele.id" class="w165h148" preload="auto" :poster="'http://110.53.221.195:8210/document/newFile/download/0/e858720c23ke455aa60e?fileKey=' + ele.coverImageKey" :src="'http://110.53.221.195:8210/document/newFile/download/0/e858720c23ke455aa60e?fileKey=' + ele.videoKey" @click="play('el-video-' + ele.id)" />
  9. </v-tab-item>
  10. </v-tabs-items>
  11. </v-tabs>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'GuidePc',
  17. auth: false,
  18. data() {
  19. return {
  20. tab: null,
  21. videoList: [],
  22. topADList: [],
  23. token: ''
  24. }
  25. },
  26. fetch() {
  27. this.token = this.$route.query.token;
  28. },
  29. created() {
  30. this.getActiveInfo()
  31. this.getAdInfoByAdPlace()
  32. },
  33. methods: {
  34. async getActiveInfo() {
  35. const res = await this.$axios.$get('/videoCourse/client/list');
  36. this.videoList = res.data;
  37. },
  38. async getAdInfoByAdPlace() {
  39. const data = {
  40. id: 1,
  41. adPlace: 511,
  42. os: 1
  43. }
  44. const res = await this.$axios.$post('/v5/advertising/getAdInfoByAdPlace', data);
  45. this.topADList = res.data;
  46. },
  47. play(item, ele) {
  48. const elVideo = document.getElementById('el-video-' + ele.id)
  49. if (elVideo.requestFullscreen) {
  50. elVideo.requestFullscreen()
  51. elVideo.play()
  52. } else if (elVideo.mozRequestFullscreen) {
  53. elVideo.mozRequestFullscreen()
  54. elVideo.play()
  55. } else if (elVideo.webkitRequestFullscreen) {
  56. elVideo.webkitRequestFullscreen()
  57. elVideo.play()
  58. }
  59. this.submit(item, ele, 1)
  60. },
  61. playAd(item, ele) {
  62. const elVideo = document.getElementById('ad')
  63. if (elVideo.requestFullscreen) {
  64. elVideo.requestFullscreen()
  65. elVideo.play()
  66. } else if (elVideo.mozRequestFullscreen) {
  67. elVideo.mozRequestFullscreen()
  68. elVideo.play()
  69. } else if (elVideo.webkitRequestFullscreen) {
  70. elVideo.webkitRequestFullscreen()
  71. elVideo.play()
  72. }
  73. this.submit(item, ele, 2)
  74. },
  75. submit(item, ele, flag) {
  76. const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2 }
  77. this.$axios.$post('/v5/advertising/getAdInfoByAdPlace', data, {headers: {Authorization: this.token}});
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss">
  83. @media (min-width: 0px) {
  84. .bg-guide {
  85. & .v-tabs-bar {
  86. height: 42px !important;
  87. }
  88. }
  89. }
  90. </style>
  91. <style lang="scss" scoped>
  92. @media (min-width: 0px) {
  93. .bg-guide {
  94. min-height: 100vh;
  95. overflow: hidden;
  96. & .v-tab {
  97. font-size: 12px;
  98. min-width: 88px;
  99. }
  100. & .v-tabs-bar {
  101. height: 42px !important;
  102. }
  103. }
  104. .w345h120 {
  105. width: 345px;
  106. height: 120px;
  107. margin: 10px auto;
  108. display: block;
  109. background: #FAFAFA;
  110. }
  111. .w165h148 {
  112. width: 165px;
  113. height: 148px;
  114. margin-bottom: 10px;
  115. margin-right: 30px;
  116. &:nth-of-type(4n+0){
  117. margin-right: 0px;
  118. }
  119. }
  120. }
  121. </style>