guide.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div class="bg2C2C2D">
  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. <div v-for="(item, index) in videoList" :key="item.plateId">
  7. <div class="fs16">{{item.plateName}}</div>
  8. <div :class="item.displayMode === 1 ? 'jcjc-list' : 'jjjc-list'">
  9. <div v-for="(ele, i) in item.videoCourseList" :key="ele.id" class="video-card">
  10. <img
  11. class="w165h148" :src="videoURL(ele.coverImageKey)" @click="play(item, ele, index, i)" />
  12. </div>
  13. </div>
  14. </div>
  15. <div v-show="showVideo" class="videobox">
  16. <div v-for="e in videoList" :key="e.plateId">
  17. <video
  18. v-for="element in e.videoCourseList" :id="'el-video-' + element.id" :key="element.id" :class="element.isShow ? '' : 'hide'" controls :src="videoURL(element.videoKey)" preload="auto" webkit-playsinline="true" playsinline="true" x-webkit-airplay="allow" x5-video-player-type="h5" x5-video-player-fullscreen="true" x5-video-orientation="portraint"
  19. style="object-fit:contain">
  20. </video>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { fileKeyToUrl } from '@/plugins/file-center.js';
  27. export default {
  28. name: 'Guide',
  29. auth: false,
  30. data() {
  31. return {
  32. videoList: [],
  33. topADList: [],
  34. token: '',
  35. showVideo: false
  36. }
  37. },
  38. async fetch() {
  39. if (this.$userAgent.isAndroid) {
  40. this.token = await window.native.getToken();
  41. } else {
  42. this.token = this.$route.query.token;
  43. }
  44. },
  45. computed: {
  46. videoURL() {
  47. return (key) => {
  48. return fileKeyToUrl(key)
  49. }
  50. }
  51. },
  52. created() {
  53. this.getActiveInfo()
  54. this.getAdInfoByAdPlace()
  55. },
  56. methods: {
  57. async getActiveInfo() {
  58. const res = await this.$axios.$get('/activity/videoCourse/client/list');
  59. res.data.forEach(item => {
  60. item.videoCourseList.forEach(ele => {
  61. ele.isShow = false
  62. })
  63. });
  64. this.videoList = res.data
  65. },
  66. async getAdInfoByAdPlace() {
  67. const data = {
  68. id: 1,
  69. adPlace: 20,
  70. os: 1
  71. }
  72. const res = await this.$axios.$post('/public/v5/advertising/getAdInfoByAdPlace', data);
  73. this.topADList = res.data;
  74. },
  75. play(item, ele, index, idx) {
  76. this.showVideo = true
  77. this.videoList[index].videoCourseList[idx].isShow = true
  78. const elVideo = document.getElementById('el-video-' + ele.id)
  79. elVideo.addEventListener("ended", () => {
  80. elVideo.pause();
  81. this.showVideo = false
  82. this.videoList[index].videoCourseList[idx].isShow = false
  83. });
  84. this.submit(item, ele, 1)
  85. },
  86. playAd(item) {
  87. this.submit(item, '', 2)
  88. if (item.actionType === '1' || item.actionType === '3' || item.actionType === '4' || item.actionType === '5' || item.actionType === '6') {
  89. window.open('', '_blank', item.clickUrl)
  90. }
  91. },
  92. submit(item, ele, flag) {
  93. const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2, adId: item.id, adName: item.title }
  94. this.$axios.$post('/activity/v5/advertising/getAdInfoByAdPlace', data, {headers: {Authorization: this.token}});
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .hide {
  101. display: none;
  102. }
  103. .videobox {
  104. position: fixed;
  105. left: 0;
  106. top: 0;
  107. right: 0;
  108. bottom: 0;
  109. background: #1c1c1e;
  110. z-index: 2;
  111. width: 100vw;
  112. height: 100vh;
  113. overflow: hidden;
  114. }
  115. .videobox video {
  116. height: 100vh;
  117. width: 100vw;
  118. position: absolute;
  119. left: 0;
  120. top: 0;
  121. z-index: 3;
  122. }
  123. .video-player--is-cssfullscreen {
  124. position: fixed !important;
  125. left: 0 !important;
  126. top: 0 !important;
  127. width: 100% !important;
  128. height: 100% !important;
  129. z-index: 999;
  130. }
  131. .video-card {
  132. width: 165px;
  133. height: 148px;
  134. border-radius: 5px;
  135. position: relative;
  136. margin-bottom: 10px;
  137. z-index: 1;
  138. & .video-card-title {
  139. width: 100%;
  140. height: 45px;
  141. line-height: 45px;
  142. text-align: center;
  143. font-size: 14px;
  144. font-weight: 500;
  145. color: #1c1c1e;
  146. background: #fff;
  147. position: absolute;
  148. left: 0;
  149. bottom: 0;
  150. border-radius: 0 0 9px 9px;
  151. }
  152. }
  153. .bg2C2C2D {
  154. background-color: #1c1c1e;
  155. min-height: 100vh;
  156. overflow: hidden;
  157. }
  158. .w345h120 {
  159. width: 345px;
  160. height: 120px;
  161. margin: 15px;
  162. border-radius: 5px;
  163. }
  164. .fs16 {
  165. font-weight: 500;
  166. color: #ffffff;
  167. font-size: 16px;
  168. margin-left: 15px;
  169. display: flex;
  170. align-items: center;
  171. }
  172. .jcjc-list {
  173. padding: 0 15px;
  174. overflow-x: scroll;
  175. overflow-y: hidden;
  176. display: flex;
  177. margin: 15px 0;
  178. .video-card {
  179. margin-right: 10px;
  180. &:last-child {
  181. margin-right: 0;
  182. }
  183. }
  184. }
  185. .fs16::before {
  186. content: '';
  187. display: inline-block;
  188. width: 6px;
  189. height: 14px;
  190. background: #3b7fff;
  191. border-radius: 3px 3px 3px 3px;
  192. opacity: 1;
  193. margin-right: 6px;
  194. }
  195. .w144h140 {
  196. width: 144px;
  197. height: 140px;
  198. margin-right: 10px;
  199. }
  200. .w144h140:last-child {
  201. margin-right: 0;
  202. }
  203. .jjjc-list {
  204. display: flex;
  205. flex-flow: wrap;
  206. justify-content: space-between;
  207. padding: 15px;
  208. }
  209. .w165h148 {
  210. width: 165px;
  211. height: 148px;
  212. object-fit: contain;
  213. margin-bottom: 15px;
  214. border-radius: 10px;
  215. }
  216. .return {
  217. width: 42px;
  218. height: 42px;
  219. margin-left: 20px;
  220. margin-bottom: 40px;
  221. &.out {
  222. border-radius: 50%;
  223. padding: 1px;
  224. background: linear-gradient(
  225. 46deg,
  226. rgba(48, 49, 53, 1),
  227. rgba(113, 116, 127, 1)
  228. );
  229. box-shadow: 0px 9px 17px 0px rgba(0, 0, 0, 0.5);
  230. }
  231. .in {
  232. width: 40px;
  233. height: 40px;
  234. border-radius: 50%;
  235. background: linear-gradient(180deg, #232427 0%, #4b4c52 100%);
  236. opacity: 1;
  237. text-align: center;
  238. line-height: 40px;
  239. }
  240. img {
  241. width: 16px;
  242. height: 16px;
  243. }
  244. }
  245. </style>