guide.vue 6.5 KB

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