zhangzengfei
2021-06-25 603076cf722b47d472f26b28d7cd69d39734b036
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
  <div class="event-video-content">
    <div class="video-player">
      <video :src="videoUrl" controls autoplay></video>
    </div>
    <div class="more-videos">
      <div class="top">
        <div class="title">更多视频</div>
        <div class="total">
          共
          <span class="num">{{eventVideoArr.length}}</span>
          条
        </div>
      </div>
      <div class="gallery">
        <div
          class="video-item"
          :class="{'act':item.ID == curVideo.ID}"
          v-for="item in eventVideoArr"
          :key="item.ID"
          @click="checkVideo(item)"
        >
          <img :src="`/httpImage/` + item.Cover" alt />
          <div class="time">{{item.EventTime}}</div>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import { getVideoUrl } from "@/api/shuohuang"
 
export default {
  props: {
    eventVideoArr: {
      type: Array,
      default: () => { return [] }
    }
  },
  data() {
    return {
      curVideo: {},
      videoUrl: ""
    }
  },
 
  mounted() {
    //this.eventVideoArr.length && (this.curVideo = this.eventVideoArr[0]);
    //this.curVideo = this.eventVideoArr[0];
    this.$nextTick(() => {
      this.eventVideoArr.length && (this.curVideo = this.eventVideoArr[0]);
    })
  },
  methods: {
    checkVideo(item) {
      this.curVideo = item;
      getVideoUrl({ id: item.ID }).then(rsp => {
        if (rsp && rsp.success) {
          this.videoUrl = "/httpImage/" + rsp.data.videoUrl;
        }
      })
    }
  }
}
</script>
 
<style lang="scss">
.event-video-content {
  padding: 10px 14px;
  .video-player {
    background: #fff;
    margin-bottom: 14px;
    video {
      margin: 20px auto;
      width: 576px;
      height: 324px;
      background: #000;
    }
  }
  .more-videos {
    background: #fff;
    .top {
      padding: 10px 20px;
      display: flex;
      justify-content: space-between;
      .total {
        .num {
          padding: 0 2px;
          color: #0096fa;
        }
      }
    }
    .gallery {
      display: flex;
      flex-wrap: wrap;
      padding: 0 20px 10px;
      height: 300px;
      overflow-y: auto;
      // &:after{
      //   content: "";
      //   flex: auto;
      // }
      .video-item {
        width: 200px;
        height: fit-content;
        margin: 10px 40px;
        //background: rgb(200, 223, 251);
        padding: 10px;
        border: 1px solid #eee;
        border-radius: 3px;
        cursor: pointer;
        &.act {
          border-color: #0096fa;
        }
        img {
          width: 100%;
        }
      }
    }
  }
}
</style>