article-footer.vue
2.55 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
<template>
<div class="article-footer-wrapper layout-footer-wrap" :style="actionBarStyle">
<div class="footer-wrapper-content">
<slot name="before"></slot>
<div class="tool-bar">
<WidgetIconBtn class="item" type="msg" :text="commentCount" :option="optionComment" :share="share" @click="onComment"></WidgetIconBtn>
<WidgetIconBtn ref="favIcon" class="item" type="fav" :pos-id="sceneId" :text="praiseCount" :articleId="articleId" :option="optionPraise" :share="share"></WidgetIconBtn>
<WidgetIconBtn class="item" type="star" :pos-id="sceneId" :text="favoriteCount" :articleId="articleId" :option="optionFav" :share="share"></WidgetIconBtn>
</div>
<slot name="after">
</slot>
</div>
</div>
</template>
<script>
import {mapState} from 'vuex';
import YAS from 'utils/yas-constants';
export default {
name: 'ArticleFooter',
props: ['favoriteCount', 'praiseCount', 'commentCount', 'hasFavor', 'hasPraise', 'articleId', 'share'],
data() {
return {
optionComment: {
emitName: 'click',
canSelect: false
},
sceneId: YAS.scene.newsDetail
};
},
computed: {
...mapState(['yoho']),
actionBarStyle() {
if (this.yoho.window.actionBarHeight) {
return {
paddingBottom: this.yoho.window.actionBarHeight + 'px'
};
}
return {};
},
optionPraise() {
return {
selected: this.hasPraise === 'Y'
};
},
optionFav() {
return {
selected: this.hasFavor === 'Y'
};
}
},
methods: {
onComment() {
this.$emit('on-comment-click');
},
onClose() {
this.$emit('on-close');
},
onPraise() {
if (this.hasPraise !== 'Y') {
this.$refs.favIcon.onClick();
}
},
},
};
</script>
<style lang="scss" scoped>
.article-footer-wrapper {
/* border-top: 1px solid #f0f0f0; */
background-color: white;
position: relative;
&.disable:after {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 3;
}
.footer-wrapper-content {
display: flex;
height: 120px;
}
}
.item:nth-child(1) {
margin-left: 40px;
}
.item:nth-child(3) {
margin-right: 40px;
}
.tool-bar {
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
/deep/ .icon-btn-text {
width: 0;
}
}
.close {
width: 200px;
color: white;
font-size: 32px;
line-height: 100px;
font-weight: 300;
background-color: #d0021b;
text-align: center;
}
.ml20 {
margin-left: 20px;
}
</style>