banner.vue
3.6 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
<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" :class="{invisible: !data.articleAmount}">{{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) {
let topicImageUrl = this.data.topicImageUrl.split('?')[0];
style.backgroundImage = `url(//${topicImageUrl.split('//')[1]}?imageView2/2/w/750/h/300/format/jpg/interlace/1)`;
}
return style;
}
},
methods: {
onFollow(follow) {
this.$emit('on-follow', follow);
},
}
};
</script>
<style scoped lang="scss">
.topic-banner {
background-size: cover;
background-repeat: no-repeat;
background-color: #eee;
background-position: center;
color: #fff;
position: relative;
&:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
}
.banner-main {
height: 240px;
position: relative;
z-index: 2;
}
.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;
&:before {
content: "";
display: inline-block;
width: 28px;
height: 28px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAMAAADyHTlpAAAASFBMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////neHiwAAAAF3RSTlMAgC3B2mz485KHFeDetqWhj3xJHgYkVgWN1eoAAAELSURBVDjLpZXhkoMgDISXgFKUqrT28v5ver05HBSqgen3Y3/tjHGHbJBBYdLGWqOnQLiAFs87/HLmfs5cMD9RsrqeP9C7FRmD5hP0kE058ikjHZyWL7A77zDyJeOAyKpZQG//5ljExTz7YzxKuaiJ/j/fLHkDvDZNzHhDfOQOPKLuIQBLZr0BXdQ9CwCfWTvgFnWPL7/PD+AeNZsgcEL9MQDdpooTARMnUMCJCbrWqmGyAX4AivrmkLeVstqwsFJWyWqkrNIA+QN8ASbqEd0SVqi1BlCtlQBfl5UHsEhZpUdIdVlRXBg5q7lcQ6dUv2m2hg3L3VAZjUUk11t7acpV3Fzw8tn47hjJJ+4Xnidmo39mnugAAAAASUVORK5CYII=");
background-size: 100% 100%;
margin-right: 10px;
}
}
.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;
&.loading {
padding: 0 36px 0 10px;
}
&.follow {
background: none;
border-color: #fff;
}
}
}
}
</style>