123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <template>
- <div class="bg-guide">
- <v-carousel :show-arrows="false" cycle interval="3000" height="120" hide-delimiter-background class="w345h120" delimiter-icon="mdi-minus">
- <v-carousel-item v-for="item in topADList" :key="item.id" :src="item.imgUrls[0]" @click="playAd(item)"></v-carousel-item>
- </v-carousel>
- <v-tabs v-model="tab" color="#3666F2" background-color="transparent" style="height: 42px;">
- <v-tab v-for="item in videoList" :key="item.plateId" style="height: 42px;">{{item.plateName}}</v-tab>
- <v-tabs-items v-model="tab">
- <v-tab-item v-for="(item, index) in videoList" :key="item.plateId" style="padding: 10px;background: #FAFAFA;min-height: calc(100vh - 162px);">
- <div v-for="(ele, i) in item.videoCourseList" :key="ele.id" class="video-card">
- <!-- <video :id="'el-video-' + ele.id" class="w165h148" preload="auto" :poster="videoURL(ele.coverImageKey)" :src="videoURL(ele.videoKey)" /> -->
- <!-- <div class="video-card-title">{{ele.videoName}}</div> -->
- <img class="w165h148" :src="videoURL(ele.coverImageKey)" @click="play(item, ele, index, i)" />
- </div>
- </v-tab-item>
- </v-tabs-items>
- </v-tabs>
- <div v-show="showVideo" class="videobox">
- <div v-for="e in videoList" :key="e.plateId">
- <video
- 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" style="object-fit:contain">
- </video>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { fileKeyToUrl } from '@/plugins/file-center.js';
- export default {
- name: 'GuidePc',
- auth: false,
- data() {
- return {
- tab: null,
- videoList: [],
- topADList: [],
- token: '',
- showVideo: false
- }
- },
- fetch() {
- this.token = this.$route.query.token;
- },
- computed: {
- videoURL() {
- return (key) => {
- return fileKeyToUrl(key)
- }
- }
- },
- created() {
- this.getActiveInfo()
- this.getAdInfoByAdPlace()
- },
- methods: {
- async getActiveInfo() {
- const res = await this.$axios.$get('/activity/videoCourse/client/list');
- this.videoList = res.data;
- res.data.forEach(item => {
- item.videoCourseList.forEach(ele => {
- ele.isShow = false
- })
- });
- },
- async getAdInfoByAdPlace() {
- const data = {
- id: 1,
- adPlace: 20,
- os: 1
- }
- const res = await this.$axios.$post('/public/v5/advertising/getAdInfoByAdPlace', data);
- this.topADList = res.data;
- },
- play(item, ele, index, idx) {
- this.showVideo = true
- this.videoList[index].videoCourseList[idx].isShow = true
- const elVideo = document.getElementById('el-video-' + ele.id)
- elVideo.addEventListener("ended", () => {
- elVideo.pause();
- this.showVideo = false
- this.videoList[index].videoCourseList[idx].isShow = false
- });
- this.submit(item, ele, 1)
- },
- playAd(item) {
- this.submit(item, '', 2)
- if (item.actionType === '1' || item.actionType === '3' || item.actionType === '4' || item.actionType === '5' || item.actionType === '6') {
- window.open('', '_blank', item.clickUrl)
- }
- },
- submit(item, ele, flag) {
- const data = flag === 1 ? { id: ele.id, plateId: item.plateId, type: flag, videoId: ele.id } : { type: 2, adId: item.id, adName: item.title }
- this.$axios.$post('/activity/v5/advertising/getAdInfoByAdPlace', data, { headers: { Authorization: this.token } });
- }
- }
- }
- </script>
- <style lang="scss">
- @media (min-width: 0px) {
- .bg-guide {
- & .v-tabs-bar {
- height: 42px !important;
- }
- }
- }
- </style>
- <style lang="scss" scoped>
- .bgFAFAFA {
- background: #fafafa;
- }
- @media (min-width: 0px) {
- .hide {
- display: none;
- }
- .videobox {
- position: fixed;
- left: 0;
- top: 0;
- right: 0;
- bottom: 0;
- background: #1c1c1e;
- z-index: 2;
- width: 100vw;
- height: 100vh;
- overflow: hidden;
- }
- .videobox video {
- height: 100vh;
- width: 100vw;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 3;
- }
- .video-card {
- width: 165px;
- height: 148px;
- border-radius: 5px;
- position: relative;
- display: inline-block;
- margin-right: 30px;
- z-index: 1;
- &:nth-of-type(4n + 0) {
- margin-right: 0px;
- }
- & .video-card-title {
- width: 100%;
- height: 45px;
- line-height: 45px;
- text-align: center;
- font-size: 14px;
- font-weight: 500;
- color: #1c1c1e;
- background: #fff;
- border-radius: 0 0 9px 9px;
- position: absolute;
- left: 0;
- bottom: 0;
- }
- }
- .bg-guide {
- min-height: 100vh;
- overflow: hidden;
- & .v-tab {
- font-size: 12px;
- min-width: 88px;
- }
- & .v-tabs-bar {
- height: 42px !important;
- }
- }
- .w345h120 {
- width: 345px;
- height: 120px;
- margin: 10px auto;
- display: block;
- background: #fafafa;
- border-radius: 5px;
- }
- .w165h148 {
- width: 165px;
- height: 148px;
- margin-bottom: 10px;
- margin-right: 30px;
- border-radius: 10px;
- &:nth-of-type(4n + 0) {
- margin-right: 0px;
- }
- }
- }
- </style>
|