banner.vue
2.37 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
<template>
<div class="topic-banner" :style="headStyle">
<div class="banner-main">
<div class="topic-name">{{data.topicName}}</div>
<p class="topic-desc">{{data.topicDesc}}</p>
<div class="topic-extra">
<label class="att-amount">{{data.articleAmount}}人参与讨论</label>
<WidgetFollow v-if="+data.allowAttention" class="att-click-wrap" :topic-id="data.topicId" :follow="data.hasAttention" :share="share" @on-follow="onFollow"></WidgetFollow>
</div>
</div>
</div>
</template>
<script>
import {mapState} from 'vuex';
import {get} from 'lodash';
export default {
props: ['data', 'share'],
computed: {
...mapState(['yoho']),
headStyle() {
let top = 0;
if (this.yoho.window.statusBarStatus) {
top = get(this.yoho, 'window.statusBarHeight', 0);
}
let style = {
paddingTop: `${44 + top}px`
};
if (this.data.topicImageUrl) {
style.backgroundImage = `url(//${this.data.topicImageUrl.split('//')[1]})`;
}
return style;
}
},
methods: {
onFollow(follow) {
this.$emit('on-follow', follow);
},
}
};
</script>
<style scoped>
.topic-banner {
background-size: cover;
background-repeat: no-repeat;
background-color: #eee;
color: #fff;
position: relative;
.banner-main {
height: 240px;
}
.topic-name {
height: 50px;
padding: 0 30px;
margin: 30px 0 18px;
font-size: 36px;
letter-spacing: 0.09PX;
font-weight: 800;
display: flex;
align-items: center;
}
.topic-desc {
padding: 0 30px;
height: 60px;
font-size: 24px;
font-weight: 300;
line-height: 30px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.topic-extra {
width: 100%;
height: 36px;
margin: 34px 0 40px;
display: flex;
align-items: center;
justify-content: space-between;
.att-amount {
font-size: 26px;
font-weight: 700px;
margin-left: 30px;
}
.att-click-wrap {
width: 190px;
height: 60px;
padding-right: 36px;
margin-right: -32px;
border-radius: 31px;
border-color: #ff5660;
background-color: #ff5660;
color: #fff;
font-size: 32px;
&.follow {
background: none;
border-color: #fff;
}
}
}
}
</style>