Find.vue
6.08 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<template>
<div class="find">
<form action="1" class="searchBox">
<van-search v-model="searchValue" shape="round" placeholder="搜索相关故事" input-align="center" @search="onSearch" />
</form>
<div class="areaList">
<div class="box">
<span :class="areaActive == 0 ? 'active' : ''" @click="areaClick(0, '')"><b>最新</b><u></u></span>
<span
:class="areaActive == item.area_code ? 'active' : ''"
@click="areaClick(item.area_code, item.area_name)"
v-for="(item, index) in AreaList"
:key="index"
><b>{{ item.area_name.substring(0, 2) }}</b
><u></u
></span>
</div>
</div>
<ul class="likeList">
<li v-for="(n, i) in likeList" :key="i" @click="gostoryDetail(n.id)">
<div class="top">
<span>故事</span>
<div class="position">
<van-icon name="location" />
<b>杭州</b>
</div>
<img :src="n.coverUrl" alt="" />
</div>
<div class="bottom">
<h3>{{ n.title }}</h3>
<div>
<img :src="n.faceUrl ? n.faceUrl : require('../assets/boy.png')" alt="" />
<span class="name">{{ n.name }}</span>
<div class="zan">
<van-icon name="good-job-o" />
<span>{{ n.likeCount }}</span>
</div>
</div>
</div>
</li>
<van-empty
class="custom-image"
image="https://img.yzcdn.cn/vant/custom-empty-image.png"
description="暂无故事"
v-if="likeList.length == 0"
/>
</ul>
<div class="appendMore" v-if="likeList.length < likeCount" @click="likeMore">查看更多</div>
<BottomNav :BottomNav="navActive"></BottomNav>
<div :is="background"></div>
</div>
</template>
<script>
import BottomNav from '../components/BottomNav.vue'
import Background from '../components/Background.vue'
export default {
components: {
BottomNav,
Background,
},
data() {
return {
navActive: 2,
searchValue: '',
AreaList: '',
areaActive: 0,
likeList: [],
likePage: 1,
likeCount: 0,
isNew: 1,
areaName: '',
background: '',
}
},
created() {
this.GetZJSysAreaList()
this.GetStoryList(1)
},
methods: {
gostoryDetail(id) {
this.$router.push({ path: '/StoryDetail', query: { id: id } })
},
GetZJSysAreaList() {
var that = this
this.http
.GetZJSysAreaList({
cityCode: this.projectCityCode,
})
.then(function(res) {
if (res.status == 1) {
that.AreaList = res.data
}
})
},
GetStoryList(page) {
var that = this
this.http
.GetStoryList({
pageIndex: page,
pageSize: 10,
title: this.searchValue,
city: this.areaName,
isNew: this.isNew,
cs: this.projectCity,
})
.then(function (res) {
if (res.status == 1) {
that.likeCount = res.data.count
that.likeList = that.likeList.concat(res.data.items)
}
})
},
likeMore() {
this.likePage++
this.GetStudyBaseList(this.likePage)
},
areaClick(id, name) {
this.areaActive = id
if (id != 0) {
this.isNew = 0
this.areaName = name
} else {
this.isNew = 1
this.areaName = ''
}
this.likeList = []
this.likePage = 1
this.GetStoryList(1)
},
onSearch() {
this.likeList = []
this.likePage = 1
this.GetStoryList(1)
},
backgroundShow(text) {
this.background = text
},
},
filters: {},
}
</script>
<style lang="stylus" scoped>
.find{
padding 0 40px 120px 40px
box-sizing border-box
.appendMore{
background-color #F7F7F7
border-radius 10px
text-align center
padding 220px 0
color #64B1FF
font-size 1.2rem
margin-bottom 20px
}
.areaList{
width 100%
overflow auto
padding 20px 0
div{
width 1200px
span{
display inline-block
width 100px
text-align center
font-size 1.6rem
color #202228
font-weight 500
vertical-align middle
}
span.active{
position relative
font-size 2rem
b{
position relative
z-index 100
}
u{
width 100%
height 16px
border-radius 100px
background-image linear-gradient(to right,#3FCC95,#ffffff)
position absolute
bottom 0
left 0
}
}
}
}
.likeList{
overflow hidden
li{
float left
width 50%
box-sizing border-box
margin-bottom 20px
.top{
position relative
span{
position absolute
background-image linear-gradient(#5EFFC1,#10E693)
left 20px
top 20px
z-index 100
padding 6px 10px
border-radius 6px
}
img{
width 100%
object-fit cover
border-radius 20px
}
.position{
position absolute
bottom 20px
left 20px
i{
color #06CB67
vertical-align middle
font-size 1.8rem
}
b{
display inline-block
vertical-align middle
color white
font-size 1.8rem
}
}
}
.bottom{
background-color white
border-radius 0 0 10px 10px
h3{
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
margin 0
font-size 1.6rem
}
div{
position relative
padding 10px 0
img{
width 40px
height 40px
border-radius 50%
display inline-block
vertical-align middle
margin-right 10px
}
span.name{
display inline-block
vertical-align middle
color #7E7F81
font-size 1.2rem
}
div.zan{
position absolute
right 20px
bottom 6px
font-size 1.2rem
color #7E7F81
i{
font-size 1.4rem
vertical-align top
}
span{
display inline-block
vertical-align top
}
}
}
}
}
li:nth-child(2n){
padding-left 20px
}
li:nth-child(2n+1){
padding-right 20px
}
}
}
</style>