article-body.vue
3.66 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<template>
<div class="scroll-wrapper">
<Author v-if="articleDetail && articleDetail.getAuthor" :data="articleDetail.getAuthor"></Author>
<div class="post-content" v-if="articleDetail && articleDetail.getArticleContent">
<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,index) in item.smallImage" :key="index"></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">
<ProductGroup v-for="(p,index) in item.relatedReco.goods" :data="[p]" :key="index"></ProductGroup>
</div>
</template>
</template>
</div>
<ZanBar class="zanbar" v-if="articleDetail && articleDetail.zanBar" v-bind="articleDetail.zanBar"></ZanBar>
<TagBar class="tagbar" v-if="articleDetail" :list="articleDetail.tagBar"></TagBar>
<Recommend v-if="articleDetail && articleDetail.getRecommendProducts && articleDetail.getRecommendProducts.length > 0">
<RecommendProductList :list="articleDetail.getRecommendProducts"></RecommendProductList>
</Recommend>
</div>
</template>
<script>
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: {
RecommendProductList,
Recommend,
Author,
ZanBar,
TagBar
},
data() {
return {
scrollOpts: {
eventPassthrough: 'horizontal',
bounce: false
}
};
},
computed: {
...mapState(['articleDetail'])
},
mounted() {
},
methods: {
}
};
</script>
<style lang="scss" scoped>
@mixin paddingLR {
padding-left: 30px;
padding-right: 30px;
}
.scroll-wrapper {
background-color: white;
}
.post-content {
@include paddingLR;
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 {
/deep/ .product-group {
height: 220px;
padding-top: 0;
padding-bottom: 0;
margin: 40px 0;
overflow: initial;
}
/deep/ .product-item {
margin-left: 0;
}
/deep/ .single {
width: 670px;
}
}
.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>