Files
dvcp_v2_wechat_app/src/project/fengdu/AppNewFarmerBank/handpick.vue

186 lines
4.8 KiB
Vue
Raw Normal View History

2023-04-03 17:03:43 +08:00
<template>
<div class="handpick">
2023-04-24 11:14:23 +08:00
<div class="list" v-for="(item,index) in list" :key="index" @click="$linkTo(`./pickDetail?id=${item.id}`)">
<div class="title-info" v-if="item.girdName">
{{item.girdName}}
2023-04-24 10:50:12 +08:00
</div>
2023-04-24 11:14:23 +08:00
<div class="type-info">{{item.createUserName}}<span>{{item.title}}</span></div>
2023-04-03 17:47:57 +08:00
<div class="top">
2023-04-24 11:14:23 +08:00
<div class="left" >
2023-04-06 15:30:23 +08:00
<p>{{ item.content }}</p>
2023-04-06 15:05:00 +08:00
</div>
2023-04-24 11:14:23 +08:00
<div class="right" @click.stop="upCount(item.id, index)">
2023-04-06 10:56:30 +08:00
<img :src="item.upStatus == 0 ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png'" alt="">
2023-04-24 10:50:12 +08:00
<span>{{ item.upCount || 0 }}</span><span v-if="item.upCount > 99">+</span>
2023-04-03 17:47:57 +08:00
</div>
</div>
2023-04-24 11:14:23 +08:00
<div class="imgs" v-if="item.images.length">
2023-04-06 10:56:30 +08:00
<image v-for="(img, i) in item.images" :key="i" class="banner" :src="img.url"/>
</div>
2023-04-24 11:14:23 +08:00
<div class="imgs" v-if="!item.images.length && item.videos.length">
2023-04-07 15:52:00 +08:00
<image v-for="(video, i) in item.videos" :key="i" class="banner" :src="video.facePicture.toString()"/>
2023-04-03 17:47:57 +08:00
</div>
</div>
2023-04-03 17:03:43 +08:00
</div>
</template>
<script>
2023-04-06 10:56:30 +08:00
import { mapState } from 'vuex'
2023-04-03 17:03:43 +08:00
export default {
name: "handpick",
appName: "精选动态",
2023-04-06 10:56:30 +08:00
computed: {
...mapState(['user'])
},
2023-04-03 17:03:43 +08:00
data() {
return {
2023-04-06 10:56:30 +08:00
list: [],
flag: false,
2023-04-12 09:03:02 +08:00
current: 1,
moduleId: ''
2023-04-03 17:03:43 +08:00
}
},
methods: {
2023-04-06 10:56:30 +08:00
getModule() {
this.$instance.post(`/app/appintegraluserapply/queryModuleByName`).then(res => {
if (res?.data) {
2023-04-12 09:03:02 +08:00
this.moduleId = res.data
this.getList()
2023-04-06 10:56:30 +08:00
}
})
},
2023-04-12 09:03:02 +08:00
getList() {
2023-04-06 10:56:30 +08:00
this.$instance.post(`/app/appcontentinfo/list-web`, null, {
params: {
2023-04-12 09:03:02 +08:00
moduleId: this.moduleId,
2023-04-06 10:56:30 +08:00
current: this.current,
2023-04-24 10:56:15 +08:00
girdId: this.user.girdId,
2023-04-06 10:56:30 +08:00
containContent: true,
}
}).then(res => {
if (res?.data) {
this.allList = res.data.records
let newList = this.current==1? res.data.records : [...this.list, ...res.data.records]
let mapList = newList.map(e => {
return {
...e,
2023-04-07 15:52:00 +08:00
images: e?.files.filter(i => (i.postfix == '.jpg' || i.postfix == '.jpeg' || i.postfix == '.png')),
videos: e?.files.filter(i => (i.postfix == '.mp4' || i.postfix == '.MP4')),
2023-04-06 10:56:30 +08:00
}
})
this.list = mapList.map(v => {
return {
...v,
images: v.images.length > 3 ? v.images.slice(0, 3) : v.images,
videos: v.videos.length > 3 ? v.videos.slice(0, 3) : v.videos,
upStatus: 0
}
})
}
})
},
// 点赞
upCount(id,index) {
if (this.flag) return
this.flag = true
this.$instance.post(`/app/appcontentinfo/supportById?id=${id}`).then(res => {
if (res?.code == 0) {
2023-04-06 15:05:00 +08:00
this.flag = false
2023-04-06 10:56:30 +08:00
this.list[index].upStatus = 1
this.$u.toast(`点赞成功`)
}
2023-04-06 15:05:00 +08:00
}).finally(() => this.flag = false)
2023-04-06 10:56:30 +08:00
},
},
onShow() {
this.getModule()
2023-04-03 17:03:43 +08:00
},
onReachBottom() {
this.current++
this.getList()
},
}
</script>
2023-04-03 17:47:57 +08:00
<style lang="scss" scoped>
.handpick {
padding: 24px 32px;
box-sizing: border-box;
.list {
padding: 32px 24px;
box-sizing: border-box;
background: #FFF;
border-radius: 12px;
2023-04-06 10:56:30 +08:00
margin-bottom: 24px;
2023-04-24 11:14:23 +08:00
.title-info {
font-family: PingFangSC-SNaNpxibold;
font-weight: 600;
font-size: 34px;
2023-04-24 10:50:12 +08:00
color: #333;
2023-04-24 11:14:23 +08:00
letter-spacing: 0;
line-height: 40px;
margin-bottom: 16px;
}
.type-info {
font-family: PingFangSC-Regular;
font-size: 34px;
color: #687DA6;
line-height: 40px;
2023-04-24 10:50:12 +08:00
span {
2023-04-24 11:14:23 +08:00
display: inline-block;
font-family: PingFangSC-Regular;
font-size: 26px;
2023-04-24 10:50:12 +08:00
color: #666;
2023-04-24 11:14:23 +08:00
line-height: 40px;
margin-left: 20px;
2023-04-24 10:50:12 +08:00
}
}
2023-04-03 17:47:57 +08:00
.top {
display: flex;
justify-content: space-between;
2023-04-24 10:50:12 +08:00
margin-bottom: 16px;
2023-04-03 17:47:57 +08:00
.left {
2023-04-24 10:50:12 +08:00
width: calc(100% - 100px);
2023-04-06 15:30:23 +08:00
p {
overflow:hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
2023-04-03 17:47:57 +08:00
}
.right {
2023-04-24 10:50:12 +08:00
width: 100px;
2023-04-03 17:47:57 +08:00
text-align: center;
img {
width: 40px;
height: 40px;
2023-04-24 10:50:12 +08:00
vertical-align: bottom;
2023-04-03 17:47:57 +08:00
}
span {
font-size: 28px;
font-weight: 400;
color: #687DA6;
}
}
}
2023-04-06 10:56:30 +08:00
.imgs {
display: flex;
flex-wrap: wrap;
background: #FFF;
image,
video {
width: 200px;
height: 200px;
margin: 0 12px 0 0;
}
image:nth-child(3n + 0),
video:nth-child(3n + 0) {
margin: 0;
2023-04-03 17:47:57 +08:00
}
}
}
}
2023-04-03 17:03:43 +08:00
</style>