Merge branch 'feature/0715' into release/6.9.8
Showing
3 changed files
with
39 additions
and
7 deletions
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | <video | 3 | <video |
4 | ref="videoPlayer" | 4 | ref="videoPlayer" |
5 | class="video-js vjs-matrix vjs-yoho" | 5 | class="video-js vjs-matrix vjs-yoho" |
6 | + :poster="coverImg" | ||
6 | controls | 7 | controls |
7 | preload="auto" | 8 | preload="auto" |
8 | playsinline | 9 | playsinline |
@@ -24,6 +25,7 @@ export default { | @@ -24,6 +25,7 @@ export default { | ||
24 | name: 'VideoPlayer', | 25 | name: 'VideoPlayer', |
25 | props: { | 26 | props: { |
26 | source: String, | 27 | source: String, |
28 | + cover: String, | ||
27 | options: { | 29 | options: { |
28 | type: Object, | 30 | type: Object, |
29 | default() { | 31 | default() { |
@@ -40,10 +42,17 @@ export default { | @@ -40,10 +42,17 @@ export default { | ||
40 | player: null | 42 | player: null |
41 | }; | 43 | }; |
42 | }, | 44 | }, |
45 | + computed: { | ||
46 | + coverImg() { | ||
47 | + if (this.cover) { | ||
48 | + return this.cover.split('?')[0]; | ||
49 | + } else { | ||
50 | + return ''; | ||
51 | + } | ||
52 | + }, | ||
53 | + }, | ||
43 | mounted() { | 54 | mounted() { |
44 | - this.player = videojs(this.$refs.videoPlayer, this.options, function onPlayerReady() { | ||
45 | - this.play(); | ||
46 | - }); | 55 | + this.player = videojs(this.$refs.videoPlayer, this.options); |
47 | }, | 56 | }, |
48 | beforeDestroy() { | 57 | beforeDestroy() { |
49 | if (this.player) { | 58 | if (this.player) { |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | {{data.emptyTip || '文章不存在或文章被删除'}} | 7 | {{data.emptyTip || '文章不存在或文章被删除'}} |
8 | </div> | 8 | </div> |
9 | <div v-else class="article-context"> | 9 | <div v-else class="article-context"> |
10 | - <VideoPlayer v-if="+data.sort === 4" :source="data.videoUrl"></VideoPlayer> | 10 | + <VideoPlayer v-if="+data.sort === 4" :source="data.videoUrl" :cover="data.coverUrl"></VideoPlayer> |
11 | <ArticleItemSlide v-else :thumb="thumb" :share="share" :data="slideData" :slide-index="slideIndex" :lazy="lazy" @on-praise="onPraise" @change="onChangeSlide"></ArticleItemSlide> | 11 | <ArticleItemSlide v-else :thumb="thumb" :share="share" :data="slideData" :slide-index="slideIndex" :lazy="lazy" @on-praise="onPraise" @change="onChangeSlide"></ArticleItemSlide> |
12 | <ProductGroup :article-id="data.articleId" :pos-id="0" :index="0" :thumb="thumb" v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup> | 12 | <ProductGroup :article-id="data.articleId" :pos-id="0" :index="0" :thumb="thumb" v-if="productListData.length" :share="share" :data="productListData" :lazy="lazy"></ProductGroup> |
13 | 13 |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <a v-if="actionUrl" class="action-article" :href="actionUrl" target="_blank"></a> | 5 | <a v-if="actionUrl" class="action-article" :href="actionUrl" target="_blank"></a> |
6 | <div class="layer-image" @click="onClick" :style="`height: ${data.blockWidth * data.scale}px`"> | 6 | <div class="layer-image" @click="onClick" :style="`height: ${data.blockWidth * data.scale}px`"> |
7 | <div v-if="data.authStatus == 2" class="failed-cover">未审核通过</div> | 7 | <div v-if="data.authStatus == 2" class="failed-cover">未审核通过</div> |
8 | - <div v-if="data.sort === 2" class="article-long-icon"></div> | 8 | + <div v-if="cornerMark" class="article-corner-mark" :class="cornerMark"></div> |
9 | <ImageFormat :mode="1" :src="data.coverImage" :width="imgWidth" :height="Math.floor(data.scale * imgWidth)"></ImageFormat> | 9 | <ImageFormat :mode="1" :src="data.coverImage" :width="imgWidth" :height="Math.floor(data.scale * imgWidth)"></ImageFormat> |
10 | </div> | 10 | </div> |
11 | <div v-if="data.content" class="description" @click="onClick('article')"> | 11 | <div v-if="data.content" class="description" @click="onClick('article')"> |
@@ -68,6 +68,22 @@ export default { | @@ -68,6 +68,22 @@ export default { | ||
68 | } | 68 | } |
69 | 69 | ||
70 | return ''; | 70 | return ''; |
71 | + }, | ||
72 | + cornerMark() { | ||
73 | + let className = ''; | ||
74 | + | ||
75 | + switch (+this.data.sort) { | ||
76 | + case 2: | ||
77 | + className = 'article-long-icon'; | ||
78 | + break; | ||
79 | + case 4: | ||
80 | + className = 'article-video-icon'; | ||
81 | + break; | ||
82 | + default: | ||
83 | + break; | ||
84 | + } | ||
85 | + | ||
86 | + return className; | ||
71 | } | 87 | } |
72 | }, | 88 | }, |
73 | methods: { | 89 | methods: { |
@@ -147,16 +163,23 @@ export default { | @@ -147,16 +163,23 @@ export default { | ||
147 | justify-content: center; | 163 | justify-content: center; |
148 | } | 164 | } |
149 | 165 | ||
150 | - .article-long-icon { | 166 | + .article-corner-mark { |
151 | width: 36px; | 167 | width: 36px; |
152 | height: 36px; | 168 | height: 36px; |
153 | position: absolute; | 169 | position: absolute; |
154 | top: 18px; | 170 | top: 18px; |
155 | right: 18px; | 171 | right: 18px; |
156 | - background-image: url("~statics/image/article/article-long-icon.png"); | ||
157 | background-size: 100% 100%; | 172 | background-size: 100% 100%; |
158 | } | 173 | } |
159 | 174 | ||
175 | + .article-long-icon { | ||
176 | + background-image: url("~statics/image/article/article-long-icon.png"); | ||
177 | + } | ||
178 | + | ||
179 | + .article-video-icon { | ||
180 | + background-image: url("~statics/image/article/article-video-icon.png"); | ||
181 | + } | ||
182 | + | ||
160 | > img { | 183 | > img { |
161 | width: 100%; | 184 | width: 100%; |
162 | height: 100%; | 185 | height: 100%; |
-
Please register or login to post a comment