article-body.vue
3.44 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<template>
<Scroll class="scroll-wrapper" :options="scrollOpts">
<Author v-if="articleDetail" :data="articleDetail.getAuthor"></Author>
<div class="post-content" v-if="articleDetail">
<template v-for="item in articleDetail.getArticleContent">
<template v-if="item.text">
<div class="text" v-html="item.text"></div>
</template>
<template v-if="item.bigImage">
<div class="big-img-block">
<ImageFormat :lazy="false" :src="item.bigImage" width="640" height="640" ></ImageFormat>
</div>
</template>
<template v-if="item.smallImage">
<div class="small-img-block clearfix">
<ImageFormat :lazy="false" :src="i.src" width="315" height="420" v-for="i in item.smallImage" ></ImageFormat>
</div>
</template>
<template v-if="item.video">
<video src="item.video.src" controls="controls" :poster="item.video.cover_image" preload="none">
不好意思,您的浏览器不支持此视频!
</video>
</template>
<template v-if="item.relatedReco">
<div class="products">
<ProductItem class="product-item" v-for="p in item.relatedReco.goods" :src="p.default_images" :price="p.sales_price" :name="p.product_name"></ProductItem>
</div>
</template>
</template>
</div>
<ZanBar class="zanbar" v-if="articleDetail" v-bind="articleDetail.zanBar"></ZanBar>
<TagBar class="tagbar" v-if="articleDetail" :list="articleDetail.tagBar"></TagBar>
<Recommend v-if="articleDetail && articleDetail.getRecommendProducts.length > 0">
<RecommendProductList :list="articleDetail.getRecommendProducts"></RecommendProductList>
</Recommend>
</Scroll>
</template>
<script>
import {Scroll} from 'cube-ui';
import RecommendProductList from './recommend-product-list';
import Recommend from './recommend';
import Author from './author';
import ZanBar from './zan-bar';
import TagBar from './tag-bar';
import { createNamespacedHelpers } from 'vuex';
const { mapState } = createNamespacedHelpers('article');
export default {
name: 'ArticleBody',
components: {
Scroll,
RecommendProductList,
Recommend,
Author,
ZanBar,
TagBar
},
data() {
return {
scrollOpts: {
eventPassthrough: 'horizontal'
}
};
},
computed: {
...mapState(['articleDetail'])
},
mounted() {
},
methods: {
}
};
</script>
<style lang="scss" scoped>
.scroll-wrapper {
background-color: white;
}
.post-content {
padding-left: 30px;
padding-right: 30px;
padding-top: 26px;
/deep/ .normal {
width: 100% !important;
margin-top: 30px;
margin-bottom: 30px;
}
/deep/ .large {
width: 100% !important;
margin-top: 30px;
margin-bottom: 30px;
}
/deep/ p {
font-size: 24px;
color: #444;
text-align: left;
line-height: 44px;
}
}
.zanbar {
margin-bottom: 40px;
padding-left: 30px;
padding-right: 30px;
}
.tagbar {
margin-bottom: 50px;
padding-left: 30px;
padding-right: 30px;
}
.products {
margin-top: 40px;
margin-bottom: 40px;
}
.product-item + .product-item {
margin-top: 64px;
}
.big-img-block {
background: #fff;
position: relative;
padding-bottom: 10px;
/deep/ img {
width: 100%;
}
}
.small-img-block {
padding-bottom: 16px;
background: #fff;
/deep/ img {
float: right;
width: 50%;
&:first-child {
float: left;
}
}
}
</style>