guide.vue 6.8 KB

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