guide.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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-page" 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 === '5' || item.actionType === '6') {
  104. window.open(item.clickUrl, '_blank')
  105. } else if (item.actionType === '4') {
  106. if (this.$userAgent.isIos) {
  107. window.open(item.deeplink, '_blank')
  108. } else {
  109. window.open(item.clickUrl, '_blank')
  110. }
  111. }
  112. },
  113. submit(item, ele, flag) {
  114. const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2, adId: item.id, adName: item.title }
  115. this.$axios.$post('/activity/videoCourse/statistics/save', data, {headers: {Authorization: this.token}});
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .hide {
  122. display: none;
  123. }
  124. .videobox {
  125. position: fixed;
  126. left: 0;
  127. top: 0;
  128. right: 0;
  129. bottom: 0;
  130. background: #000;
  131. z-index: 2;
  132. width: 100vw;
  133. height: 100vh;
  134. overflow: hidden;
  135. }
  136. .wh24 {
  137. width: 24px;
  138. height: 24px;
  139. margin: 10px auto;
  140. position: fixed;
  141. bottom: 0;
  142. left: 50%;
  143. margin-left: -12px;
  144. z-index: 4;
  145. }
  146. .videobox video {
  147. height: calc(100vh - 44px);
  148. width: 100vw;
  149. position: absolute;
  150. left: 0;
  151. top: 0;
  152. z-index: 3;
  153. }
  154. .video-player--is-cssfullscreen {
  155. position: fixed !important;
  156. left: 0 !important;
  157. top: 0 !important;
  158. width: 100% !important;
  159. height: 100% !important;
  160. z-index: 999;
  161. }
  162. .video-card {
  163. width: 165px;
  164. height: 148px;
  165. border-radius: 5px;
  166. position: relative;
  167. margin-bottom: 10px;
  168. z-index: 1;
  169. & .video-card-title {
  170. width: 100%;
  171. height: 45px;
  172. line-height: 45px;
  173. text-align: center;
  174. font-size: 14px;
  175. font-weight: 500;
  176. color: #1c1c1e;
  177. background: #fff;
  178. position: absolute;
  179. left: 0;
  180. bottom: 0;
  181. border-radius: 0 0 9px 9px;
  182. }
  183. }
  184. .bg2C2C2D {
  185. background-color: #1c1c1e;
  186. min-height: 100vh;
  187. overflow: hidden;
  188. }
  189. .w345h120 {
  190. width: 345px;
  191. height: 120px;
  192. margin: 15px;
  193. border-radius: 5px;
  194. }
  195. .fs16 {
  196. font-weight: 500;
  197. color: #ffffff;
  198. font-size: 16px;
  199. margin-left: 15px;
  200. display: flex;
  201. align-items: center;
  202. }
  203. .jcjc-list {
  204. padding: 0 15px;
  205. overflow-x: scroll;
  206. overflow-y: hidden;
  207. display: flex;
  208. margin: 15px 0;
  209. .video-card {
  210. margin-right: 10px;
  211. &:last-child {
  212. margin-right: 0;
  213. }
  214. }
  215. }
  216. .fs16::before {
  217. content: '';
  218. display: inline-block;
  219. width: 6px;
  220. height: 14px;
  221. background: #3b7fff;
  222. border-radius: 3px 3px 3px 3px;
  223. opacity: 1;
  224. margin-right: 6px;
  225. }
  226. .w144h140 {
  227. width: 144px;
  228. height: 140px;
  229. margin-right: 10px;
  230. }
  231. .w144h140:last-child {
  232. margin-right: 0;
  233. }
  234. .jjjc-list {
  235. display: flex;
  236. flex-flow: wrap;
  237. justify-content: space-between;
  238. padding: 15px;
  239. }
  240. .w165h148 {
  241. width: 165px;
  242. height: 148px;
  243. object-fit: contain;
  244. margin-bottom: 15px;
  245. border-radius: 10px;
  246. }
  247. .return {
  248. width: 42px;
  249. height: 42px;
  250. margin-left: 20px;
  251. margin-bottom: 40px;
  252. &.out {
  253. border-radius: 50%;
  254. padding: 1px;
  255. background: linear-gradient(
  256. 46deg,
  257. rgba(48, 49, 53, 1),
  258. rgba(113, 116, 127, 1)
  259. );
  260. box-shadow: 0px 9px 17px 0px rgba(0, 0, 0, 0.5);
  261. }
  262. .in {
  263. width: 40px;
  264. height: 40px;
  265. border-radius: 50%;
  266. background: linear-gradient(180deg, #232427 0%, #4b4c52 100%);
  267. opacity: 1;
  268. text-align: center;
  269. line-height: 40px;
  270. }
  271. img {
  272. width: 16px;
  273. height: 16px;
  274. }
  275. }
  276. </style>