luntanlist.vue
15.9 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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
<template>
<view class="content">
<view class="searchGoods-wrap">
<view class="search-nav">
<!-- search -->
<view class="search">
<view class="searchimg">
<image src="../../static/search.png" mode=""></image>
</view>
<input type="text" confirm-type="search" placeholder-class="placeholder" placeholder="请输入关键词搜索" @confirm="finish"
@input="enterword" />
<!-- <view class="search-btn">
北京
<image src="../../static/huixia.png" />
</view> -->
<picker @change="bindproChange" :value="index" :range="provincelist" range-key="name">
<!-- <view class="uni-input">{{array[index]}}</view> -->
<view class="proselect flexthree">
<text class="proname">{{provincename}}</text>
<image class="down-ico" src="../../static/huixia.png" />
</view>
</picker>
</view>
<!-- nav -->
<view class="nav-menus">
<scroll-view class="nav-menu" scroll-x="true">
<view :class="item.chose==true?'active':''" @click="kindchange(item,index)" :data-id="item.id" v-for="(item,index) in kindlist" :key="index">
{{item.name}}
</view>
<!-- <view :class="kindtype=='1'?'active':''" @click="kindchange" :data-id="1">
帮工招聘求职
</view>
<view :class="kindtype=='2'?'active':''" @click="kindchange" :data-id="2">
面坊转让求购
</view>
<view :class="kindtype=='3'?'active':''" @click="kindchange" :data-id="3">
征婚交友
</view> -->
</scroll-view>
</view>
<view class="nav-menus">
<scroll-view class="nav-menu" scroll-x="true" v-if="kindtype!=1">
<view :class="search_type==0?'active':''" @click="searchtype" :data-id="0">
全部
</view>
<view :class="search_type==1?'active':''" @click="searchtype" :data-id="1" v-if="kindtype==2">
招聘
</view>
<view :class="search_type==2?'active':''" @click="searchtype" :data-id="2" v-if="kindtype==2">
求职
</view>
<view :class="search_type==3?'active':''" @click="searchtype" :data-id="3" v-if="kindtype==3">
求购
</view>
<view :class="search_type==4?'active':''" @click="searchtype" :data-id="4" v-if="kindtype==3">
转让
</view>
<view :class="search_type==5?'active':''" @click="searchtype" :data-id="5" v-if="kindtype==4">
找男友
</view>
<view :class="search_type==6?'active':''" @click="searchtype" :data-id="6" v-if="kindtype==4">
找女友
</view>
<!-- <view :class="kindtype=='1'?'active':''" @click="kindchange" :data-id="1">
帮工招聘求职
</view>
<view :class="kindtype=='2'?'active':''" @click="kindchange" :data-id="2">
面坊转让求购
</view>
<view :class="kindtype=='3'?'active':''" @click="kindchange" :data-id="3">
征婚交友
</view> -->
</scroll-view>
</view>
</view>
<!-- 列表 -->
<view :class="kindtype!=1?'listk':'list'">
<!-- content -->
<view class="new-release-content" v-for="(item,index) in luntanlist" :key="index" @click="luntandetail(item)">
<!-- 头像,名称,等级 -->
<view class="userinfo-wrap">
<image :src="item.user.avatar" style="border-radius: 50%;"></image>
<text class="title">{{item.user.nickname}}</text>
<view class="VIP">
<image src="../../icons/vip.png"></image>
{{item.user.level.name1}}
</view>
</view>
<!-- type -->
<view class="type-wrap">
{{item.category_name}}
<text v-for="(item,index) in item.user.label" :key="index">{{item.name_label}}</text>
<!-- <text>配送员</text>
<text>销售员</text> -->
</view>
<!-- content -->
<view class="release-text">
<view class="release-text-title">
{{item.title}}
</view>
<view class="release-text-content">
<rich-text :nodes="item.content"></rich-text>
</view>
<view class="imglist flexone" v-if="item.images" style="flex-wrap: wrap;">
<view class="imglistitem" v-for="(item,indexk) in item.images" :key="indexk" @click.stop="previewimg(index,indexk)">
<image :src="item" mode=""></image>
</view>
</view>
<view class="lunimg" @click.stop="govideo(item.video)" v-if="item.video">
<image :src="item.video_image" mode=""></image>
<view class="palyimg">
<image src="../../static/videoplay.png" mode=""></image>
</view>
</view>
</view>
<!-- 点赞, 人数 -->
<view class="thumbs-number" @click.stop="praisedian(item,index)">
<view class="thumbs">
<image src="../../static/tienozan.png" v-if="item.is_praise==2"></image>
<image src="../../static/tiezan.png" v-else></image>
{{item.praise}}
</view>
<view class="number">
<image src="../../icons/number.png"></image>
{{item.view}}
</view>
</view>
</view>
</view>
</view>
<!-- 发布按钮 -->
<view class="publishbtn">
<view class="btnpush" @click="publishtie">发布</view>
</view>
<!-- 发布 -->
<view class="release-news" v-if="publish">
<view class="release-content">
<view class="nav-wrap publishnav">
<view class="navigator" @click="publishitezi(item,index)" :data-id="item.id" v-for="(item,index) in kindlist" :key="index">
<image :src="item.image" style="border-radius: 50%;"></image>
<text>{{item.name}}</text>
</view>
<!-- <view class="navigator" @click="publishitezi" :data-id="1">
<image src="../../static/helppeople.png"></image>
<text>帮工招聘求职</text>
</view>
<view class="navigator" @click="publishitezi" :data-id="2">
<image src="../../static/mianturn.png"></image>
<text>面坊求购转让</text>
</view>
<view class="navigator" @click="publishitezi" :data-id="3">
<image src="../../static/friend.png"></image>
<text>征婚交友</text>
</view>
<view class="navigator" @click="publishitezi" :data-id="4">
<image src="../../static/logok.png" class="logoimgk"></image>
<text>短视频专区</text>
</view> -->
</view>
<!-- close -->
<view class="close" @click="hidepublish">
<image src="../../static/publishchahao.png" />
</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data() {
return {
showbanben: false,
kindtype: '',
provincelist: [],
province_id:'',
provincename: '',
index: 0,
keyword: '',
luntanlist: [],
kindlist:[],
publish:false,
search_type:0
}
},
onLoad(options) {
this.kindtype = options.id;
this.getprovincelist();
this.getkind()
},
methods: {
hidepublish() {
this.publish = false
},
// 预览图片
previewimg(index,indexk){
console.log(index,indexk)
let that=this;
wx.previewImage({
current: that.luntanlist[index].images[indexk],
urls: that.luntanlist[index].images,
success: function (res) { },
fail: function (res) { },
complete: function (res) { },
})
},
// 发布帖子
publishtie(){
this.publish=true
},
searchtype(e){
this.search_type=e.currentTarget.dataset.id;;
this.page = 1;
this.luntanlist = [];
this.getluntanlist()
},
// 发布评论
publishitezi(item) {
let token=uni.getStorageSync("token");
if(token==''){
uni.navigateTo({
url:'/pages/login/loginindex'
})
}else{
let type = item.id;
uni.navigateTo({
url: '/pages/luntan/addcontract?type=' + type
})
}
},
// 获取帖子分类
getkind(){
let that = this;
var url = 'forum/get_forum_category';
var params = {
}
console.log('帖子种类参数', params)
app.post(url, params).then((res) => {
console.log(res);
let data=res.data.data;
let arr=[]
data.forEach(function(value,index,array){
value.chose=false;
if(index<4){
arr.push(value)
}
})
that.kindlist=arr;
that.kindlist.forEach(function(value,index,array){
if(value.id==that.kindtype){
value.chose=true
}
})
}).catch((err) => {
console.log(err)
})
},
//
kindchange(item,index) {
this.kindlist.forEach(function(value,indexk,array){
if(index==indexk){
value.chose=true
}else{
value.chose=false
}
})
this.kindtype =item.id;
this.search_type=0;
this.page = 1;
this.luntanlist = [];
this.getluntanlist()
},
// 输入完成
finish() {
this.page = 1;
this.luntanlist = [];
// this.getluntanlist()
},
// 输入关键字
enterword(e) {
this.keyword = e.detail.value
},
// 获取省份列表
getprovincelist() {
let that = this;
var url = 'forum/get_province';
var params = {
is_forum_hot: ''
}
console.log('7766554', params)
app.post(url, params).then((res) => {
console.log(res);
that.provincelist = res.data.data;
this.provincename = res.data.data[0].name;
that.province_id = res.data.data[0].id;
// 获取论坛列表
this.getluntanlist()
}).catch((err) => {
})
},
bindproChange(e) {
this.index = e.target.value;
this.provincename = this.provincelist[e.target.value].name;
this.province_id = this.provincelist[e.target.value].id;
this.page = 1;
this.luntanlist = [];
// 获取论坛列表
this.getluntanlist();
},
// 获取论坛列表
getluntanlist() {
let that = this;
var url = 'forum/get_forum';
var params = {
search_type:that.search_type,
keyword: that.keyword,
province_id: that.province_id,
type: that.kindtype,
page: that.page,
pageNum: 10
}
console.log('参数', params)
app.post(url, params).then((res) => {
console.log(res);
that.luntanlist = that.luntanlist.concat(res.data.data);
console.log('9999', this.luntanlist)
}).catch((err) => {
console.log(err)
})
},
// 进入视频
govideo(video){
uni.navigateTo({
url:'/pages/luntan/video?src='+video
})
},
praisedian(item,index){
let that = this;
if(that.luntanlist[index].is_praise==2){
uni.showToast({
title:'点赞成功',
icon:'none'
})
that.luntanlist[index].is_praise=1;
that.luntanlist[index].praise=that.luntanlist[index].praise+1
}else{
uni.showToast({
title:'取消点赞成功',
icon:'none'
})
that.luntanlist[index].is_praise=2;
that.luntanlist[index].praise=that.luntanlist[index].praise-1
}
that.luntanlist=that.luntanlist;
var url = 'forum/praise';
var params = {
forum_id:item.id
}
console.log('参数',params)
app.post(url, params).then((res) => {
console.log(res);
}).catch((err) => {
console.log(err)
})
},
luntandetail(item) {
uni.navigateTo({
url:'/pages/luntan/luntandetail?id='+item.id
})
}
}
}
</script>
<style>
page {
background: #f9f9f9;
}
.imglistitem{
width:200rpx;
height:200rpx;
font-size: 0;
margin-right:20rpx;
margin-bottom:20rpx;
}
.searchGoods-wrap{
padding-bottom: 120rpx;
}
.publishbtn{
width:750rpx;
padding: 14rpx 32rpx;
box-sizing: border-box;
background: #fff;
position: fixed;
bottom:0;
left:0
}
.btnpush{
width:686rpx;
height:88rpx;
color:#ffF;
font-size:32rpx;
text-align: center;
line-height: 88rpx;
margin:0 auto;
background:#C29445 ;
}
.release-news{
z-index:99999!important
}
.nav-wrap {
width:750rpx;
background: #fff;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
padding: 32rpx 0 0 44rpx;
box-sizing: border-box;
margin-bottom: 16rpx;
}
.nav-wrapk{
margin-top: calc(var(--status-bar-height) + 100rpx);
}
.publishnav {
padding: 0 44rpx 32rpx 0!important;
box-sizing: border-box!important;
}
.nav-wrap .navigator {
text-align: center;
margin-right:40rpx;
margin-bottom:32rpx;
}
.nav-wrap .navigator image {
width: 88rpx;
height: 88rpx;
margin: auto;
}
.nav-wrap .navigator text {
width: 104rpx;
display: block;
color: #3D454C;
font-size: 26rpx;
}
.new-release-wrap .new-release-title {
height: 84rpx;
line-height: 84rpx;
padding-left: 32rpx;
position: relative;
background: #fff;
font-size: 32rpx;
color: #061220;
/* border-bottom: 1px solid #E3E2E1; */
}
.new-release-wrap .new-release-title:after {
content: "";
position: absolute;
top: 20rpx;
left: 0;
height: 44rpx;
width: 8rpx;
background: var(--themeColor);
border-top-right-radius: 6rpx;
border-bottom-right-radius: 6rpx;
}
.release-news {
position: fixed;
width: 750rpx;
height: 100%;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 10;
}
.release-news .release-content {
position: absolute;
width: 750rpx;
bottom: 0;
left: 0;
background: #fff;
z-index: 1000;
padding: 60rpx;
box-sizing: border-box;
border-top-left-radius: 40rpx;
border-top-right-radius: 40rpx;
}
.release-news .meun-lists {
display: flex;
justify-content: space-between;
}
.release-news .meun-lists navigator {
text-align: center;
}
.release-news .meun-lists navigator image {
width: 88rpx;
height: 88rpx;
margin: auto;
}
.release-news .meun-lists navigator text {
width: 104rpx;
display: block;
color: #3D454C;
font-size: 26rpx;
}
.release-news .close {
display: flex;
justify-content: center;
margin-top: 38rpx;
}
.release-news .close image {
width: 60rpx;
height: 60rpx;
}
.search-wrap .navigator:nth-child(3) {
/* font-size: 20rpx; */
}
.avatarimgk{
border-radius: 50%;
}
.zuiactive{
color:#FF9417!important;
}
.lunimg{
width:686rpx;
height:380rpx;
font-size: 0;
position: relative;
}
.palyimg{
width:130rpx;
height:130rpx;
font-size: 0;
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
.search {
position: relative;
}
.proname {
color: #BDC4CE;
font-size: 24rpx;
}
.down-ico {
width: 16rpx;
height: 16rpx;
}
.searchimg {
width: 28rpx;
height: 28rpx;
font-size: 0;
position: absolute;
left: 54rpx;
top: 19rpx;
}
.search-nav {
width: 750rpx;
padding: 14rpx 14rpx 0;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
z-index: 1000;
background: #fff;
}
.search-nav .search {
padding: 0 32rpx;
display: flex;
justify-content: flex-start;
align-items: center;
}
.search-nav .search .placeholder {
font-size: 24rpx;
color: #BDC4CE;
}
.search-nav .search icon {
position: absolute;
top: 14rpx;
left: 45rpx;
}
.search-nav .search input {
height: 60rpx;
width: 72vw;
border: 1px solid #eee;
background: #F9F9F9;
border-radius: 50px;
padding-left: 60rpx;
}
.search-nav .search .search-btn {
color: #BDC4CE;
font-size: 24rpx;
margin-left: 24rpx;
border: 1px solid #EEEEEE;
width: 120rpx;
height: 60rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50px;
}
.search-nav .search .search-btn image {
width: 16rpx;
height: 16rpx;
margin-left: 10rpx;
}
.search-nav .nav-menus {
padding-left: 36rpx;
padding-right: 8rpx;
}
.search-nav .nav-menu {
white-space: nowrap;
}
.search-nav .nav-menu view {
display: inline-block;
color: #232323;
font-size: 30rpx;
height: 88rpx;
line-height: 88rpx;
margin-right: 28rpx;
}
.search-nav .nav-menu .active {
color: #FF9417;
position: relative;
}
.search-nav .nav-menu .active::after {
content: "";
position: absolute;
bottom: 0rpx;
left: 0;
height: 2px;
width: 100%;
background: #FF9417;
}
.activek{
position: relative;
color:#FF9417!important;
}
.activek::after{
content: "";
position: absolute!important;
bottom: 0!important;
left: 0;
height: 2px!important;
width: 100%;
background: #FF9417;
}
.list {
padding-top: 182rpx;
}
.listk{
padding-top: 250rpx;
}
</style>