Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
shuaiguo
5 years ago
Commit
79830d77a9e7ab744529e5623693e0b0e4d87885
1 parent
5bc64f92
feat(商品详情): 增加视频资源位
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
9 deletions
apps/pages/home/channel/components/banner.vue
apps/pages/home/channel/components/swiper.vue
apps/pages/product/mixins.js
apps/pages/product/product-detail.vue
apps/store/product/actions.js
apps/pages/home/channel/components/banner.vue
View file @
79830d7
...
...
@@ -40,7 +40,7 @@ export default {
let videoUrl = null;
for(const resourceInfo of this.list) {
const { url} = resourceInfo;
if(/(\.mp4)
$
/.test(url)) {
if(/(\.mp4)/.test(url)) {
videoUrl = url
break;
}
...
...
@@ -52,7 +52,7 @@ export default {
onClickHandler(e, url, index) {
e.stopPropagation();
e.preventDefault();
if(/(\.mp4)
$
/.test(url)) {
if(/(\.mp4)/.test(url)) {
const key = `videoPlayer-${index+1}`;
this.$refs[key][0].parentHandleclick()
}
...
...
apps/pages/home/channel/components/swiper.vue
View file @
79830d7
...
...
@@ -65,7 +65,7 @@ export default {
let videoInfo = null;
for(const resourceInfo of this.list) {
const { url, id } = resourceInfo;
if(/(\.mp4)
$
/.test(url)) {
if(/(\.mp4)/.test(url)) {
videoInfo = {url, id};
break;
}
...
...
@@ -84,7 +84,7 @@ export default {
onClickHandler(e, url) {
e.stopPropagation();
e.preventDefault();
if(/(\.mp4)
$
/.test(url)) {
if(/(\.mp4)/.test(url)) {
this.$refs.videoPlayer.parentHandleclick()
}
}
...
...
apps/pages/product/mixins.js
View file @
79830d7
...
...
@@ -16,6 +16,9 @@ export default {
resource
()
{
return
this
.
productDetail
.
resource
||
{};
},
videoResource
()
{
return
this
.
productDetail
.
videoResource
||
{};
},
activity
()
{
return
this
.
productDetail
.
activity
;
},
...
...
apps/pages/product/product-detail.vue
View file @
79830d7
...
...
@@ -52,6 +52,22 @@
<img class="ref-img" v-lazy="prdDetailTip"/>
</div>
<!-- 视频资源位 -->
<a
class="banner video-resource"
ref="videoResourceImg"
v-if="videoResource.src">
<div
class="video-mask"
@click="onVideoPlay"></div>
<VideoPlayer
ref="videoPlayer"
class="video-player"
:source="videoResource.url"
/>
<img-size :src="sizeImg(videoResource.src)"/>
</a>
<img class="ref-img" v-lazy="prdDetailImage" />
<div class="recommend" v-if="recommend"><h2>相关推荐</h2>
...
...
@@ -118,6 +134,7 @@ export default {
'cube-slide': Slide,
'cube-slide-item': Slide.Item,
'cube-popup': Popup,
VideoPlayer
},
props: {
productId: {
...
...
@@ -129,7 +146,6 @@ export default {
slideOptions: {
eventPassthrough: 'vertical',
},
videoUrl: 'https://v.yohobuy.com/d3afd3b6vodtranscq1400201211/e553618a5285890795944899907/v.f30.mp4',
prdDetailTip,
prdDetailImage,
...
...
@@ -790,22 +806,46 @@ export default {
title: `淘口令#${this.productDetail.product_name}`, // 分享标题
text: '' // 分享描述
}, yasReportHandler);
},
onVideoPlay() {
this.$refs.videoPlayer.parentHandleclick()
}
},
};
</script>
<style lang="scss" scoped>
@import "./product-detail";
.video-wrapper {
overflow: hidden;
.video-mask {
z-index: 10;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.video-player {
display: block;
height: 40px;
height: 100%;
width: 100%;
opacity: 0;
position: absolute;
bottom: 0;
overflow: hidden;
/deep/ .video-js {
padding: 0;
height: 100%;
}
}
.video-resource {
margin-top: 30px;
position: relative;
overflow: hidden;
}
.cube-btn {
...
...
apps/store/product/actions.js
View file @
79830d7
...
...
@@ -26,12 +26,17 @@ export default {
});
let
[
detail
,
resource
,
activity
,
recommend
,
limitInfo
]
=
await
Promise
.
all
(
queryTasks
);
// 视频资源位
const
videoResourceInfo
=
resource
.
find
(
r
=>
/
(\.
mp4
)
/
.
test
(
r
.
data
[
0
].
url
));
const
videoResource
=
get
(
videoResourceInfo
,
'data[0]'
,
{});
resource
=
get
(
resource
,
'[0].data[0]'
,
{});
const
{
product_info
=
{}}
=
detail
||
{};
commit
(
Types
.
UPDATE_PRODUCT_DETAIL
,
Object
.
assign
(
product_info
,
{
resource
,
videoResource
,
activity
:
activity
||
[],
recommend
:
recommend
&&
recommend
.
product_list
||
[],
limitInfo
:
limitInfo
||
{}
...
...
Please
register
or
login
to post a comment