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

341 lines
8.8 KiB
Vue
Raw Normal View History

2023-03-20 08:32:07 +08:00
<template>
2023-03-20 08:58:04 +08:00
<div class="AppNewFarmerBank">
2023-03-28 15:25:51 +08:00
<div class="swiper-content">
<img src="https://cdn.cunwuyun.cn/fengdu/img-gongdeyinhang.png" alt="">
</div>
<div class="welcome">
<div class="welcome-user">
2023-03-30 10:04:06 +08:00
<span class="name">{{ user.realName || user.nickName }}</span>
2023-03-31 11:33:31 +08:00
<span v-if="!user.idNumber">欢迎来到功德银行</span>
2023-03-30 10:19:52 +08:00
<span v-else>欢迎进入{{ user.areaName }}</span>
2023-03-30 10:04:06 +08:00
2023-03-28 15:25:51 +08:00
</div>
2023-04-04 14:56:10 +08:00
<div class="signin" @click="toPages('./signIn',status)">{{ status==1? '已签到':'签到' }}</div>
2023-03-28 15:25:51 +08:00
</div>
<div class="card-list">
2023-04-03 13:51:58 +08:00
<div class="jfsq" @click="toPages('./integralApply')">
2023-03-28 15:25:51 +08:00
<p>积分申请</p>
<h4>好事自荐得积分</h4>
</div>
2023-03-29 18:20:14 +08:00
<div class="jsrw" @click="toPages('./integralTask')">
2023-03-28 15:25:51 +08:00
<p>积分任务</p>
<h4>完成任务得积分</h4>
</div>
2023-03-30 13:51:46 +08:00
<div class="jfph" @click="toPages('./integralRank')">
2023-03-28 15:25:51 +08:00
<p>积分排行</p>
<h4>社区荣誉榜</h4>
</div>
2023-03-29 10:16:36 +08:00
<div class="jfsc" @click="$u.toast('内容建设中...')">
2023-03-28 15:25:51 +08:00
<p>积分商城</p>
<h4>兑换得好物</h4>
</div>
</div>
2023-04-04 16:31:04 +08:00
<div class="handpick" v-if="list.length">
2023-04-03 17:03:43 +08:00
<div class="title">
<h1>精选动态</h1>
2023-04-06 10:56:30 +08:00
<div class="more" v-if="allList.length > 3" @click="toPages('./handpick')">
2023-04-03 17:03:43 +08:00
<span>更多</span>
<u-icon name="arrow-right" color="#687DA6" size="28"></u-icon>
</div>
</div>
2023-04-04 18:00:23 +08:00
<div class="list" v-if="list.length">
2023-04-06 10:56:30 +08:00
<div class="card" v-for="(item,index) in list" :key="index">
2023-04-04 16:31:04 +08:00
<div class="top">
2023-04-06 10:56:30 +08:00
<div class="left" @click="toPages(`./pickDetail?id=${item.id}`)">{{ item.content }}</div>
<div class="right" @click="upCount(item.id,index)">
<img :src="item.upStatus==0? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png':'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png'" alt="">
<div>
<span>{{ item.upCount || 0 }}</span><span v-if="item.upCount > 99">+</span>
</div>
2023-04-04 16:31:04 +08:00
</div>
</div>
2023-04-06 10:56:30 +08:00
<div class="imgs" v-if="item.images.length">
<image v-for="(img, i) in item.images" :key="i" class="banner" :src="img.url"/>
</div>
<div class="imgs" v-if="!item.images.length && item.videos.length">
<video v-for="(video, ins) in item.videos" :key="ins" class="file-img" :src="video.url"/>
2023-03-28 15:25:51 +08:00
</div>
</div>
</div>
2023-04-04 16:31:04 +08:00
<!-- <AiEmpty :description="`暂无数据`" class="emptyWrap" v-else/> -->
2023-03-28 15:25:51 +08:00
</div>
2023-03-20 08:32:07 +08:00
</div>
</template>
<script>
2023-03-29 10:16:36 +08:00
import { mapState } from 'vuex'
2023-03-20 08:32:07 +08:00
export default {
2023-03-20 08:58:04 +08:00
name: "AppNewFarmerBank",
2023-03-28 15:25:51 +08:00
appName: "功德银行",
2023-03-20 08:32:07 +08:00
data() {
return {
2023-04-04 14:56:10 +08:00
status: null,
2023-04-04 16:31:04 +08:00
current: 1,
list: [],
2023-04-06 10:56:30 +08:00
allList: [],
flag: false,
2023-03-20 08:32:07 +08:00
}
},
2023-03-29 10:16:36 +08:00
computed: {
...mapState(['user'])
},
2023-03-20 08:32:07 +08:00
methods: {
2023-04-04 16:31:04 +08:00
getList(moduleId) {
this.$instance.post(`/app/appcontentinfo/list-web`,null,{
params: {
moduleId: moduleId,
current: this.current,
2023-04-06 10:56:30 +08:00
areaId: this.user.areaId,
containContent: true,
2023-04-04 16:31:04 +08:00
}
}).then(res=> {
2023-04-03 17:03:43 +08:00
if(res?.data) {
2023-04-06 10:56:30 +08:00
this.allList = res.data.records
let newList = res.data.records.length > 3 ? res.data.records.slice(0,3) : res.data.records
let mapList = newList.map(e=> {
return {
...e,
images: e?.files.filter(i=> i.name.split('.')[1]=='jpeg') || e?.files.filter(i => i.name.split('.')[1] == 'jpg') || e?.files.filter(i => i.name.split('.')[1] == 'png') || [],
videos: e?.files.filter(i => i.name.split('.')[1] == 'mp4') || [],
}
})
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
}
})
2023-04-03 17:03:43 +08:00
}
})
2023-03-28 15:25:51 +08:00
},
handleBannerClick() {
2023-04-04 18:00:23 +08:00
2023-04-06 10:56:30 +08:00
},
// 点赞
upCount(id,index) {
if (this.flag) return
this.flag = true
this.$instance.post(`/app/appcontentinfo/supportById?id=${id}`).then(res=> {
if(res?.code==0) {
this.list[index].upStatus = 1
this.$u.toast(`点赞成功`)
}
})
2023-03-29 17:46:29 +08:00
},
2023-04-04 14:56:10 +08:00
toPages(url,status) {
2023-03-29 17:46:29 +08:00
if(!this.user.idNumber) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
2023-03-30 16:58:25 +08:00
}).then(() => {
2023-03-30 17:31:01 +08:00
this.$linkTo('/pages/AppMine/userInfo')
2023-03-29 17:46:29 +08:00
}).catch(() => {
})
} else {
2023-04-04 14:56:10 +08:00
if(!status) {
this.$linkTo(url)
} else {
// 停留
}
2023-03-29 17:46:29 +08:00
}
2023-04-04 14:56:10 +08:00
},
getStatus() {
this.$instance.post(`/app/appwechatsigninfo/checkSign`).then(res=> {
if(res?.data !== null) {
this.status = 1
}
})
2023-04-04 16:31:04 +08:00
},
getModule() {
this.$instance.post(`/app/appintegraluserapply/queryModuleByName`).then(res=> {
if(res?.data) {
this.getList(res.data)
}
})
2023-03-28 15:25:51 +08:00
}
2023-04-04 16:31:04 +08:00
2023-03-20 08:32:07 +08:00
},
onShow() {
2023-04-04 14:56:10 +08:00
this.getStatus()
2023-04-04 16:31:04 +08:00
this.getModule()
2023-03-20 08:32:07 +08:00
},
}
</script>
2023-03-20 14:54:29 +08:00
<style lang="scss" scoped>
.AppNewFarmerBank {
2023-04-04 18:00:23 +08:00
padding-bottom: 20px;
box-sizing: border-box;
2023-03-28 15:25:51 +08:00
.swiper-content {
width: 100%;
2023-03-29 18:20:14 +08:00
height: 332px;
padding: 32px 32px 0;
box-sizing: border-box;
background: #FFF;
2023-03-28 15:25:51 +08:00
img {
width: 100%;
height: 100%;
2023-03-29 18:20:14 +08:00
border-radius: 16px;
2023-03-28 15:25:51 +08:00
}
}
.welcome {
display: flex;
align-items: center;
width: 100%;
height: 120px;
padding: 0 32px;
box-sizing: border-box;
background: #FFF;
.signin {
width: 104px;
height: 52px;
line-height: 52px;
border: 2px solid #2D7DFF;
border-radius: 40px;
color: #2D7DFF;
text-align: center;
font-size: 22px;
font-weight: 400;
}
.welcome-user {
width: calc(100% - 60px);
font-size: 30px;
font-weight: 400;
font-family: "PingFang SC";
.name {
color: #2D7DFF;
font-weight: 500;
}
}
}
.card-list {
background: #FFF;
padding: 0 32px;
display: flex;
flex-wrap: wrap;
.jfsq,
.jsrw,
.jfph,
.jfsc {
width: 328px;
height: 144px;
margin-bottom: 32px;
padding: 28px 32px;
box-sizing: border-box;
p {
font-size: 30px;
font-weight: 600;
}
h4 {
font-size: 20px;
font-weight: 400;
margin-top: 8px;
}
}
.jfsq {
background: url('https://cdn.cunwuyun.cn/fengdu/img-jifenshenqing.png') no-repeat;
background-size: 100% 100%;
color: #DF863E;
}
.jsrw {
background: url('https://cdn.cunwuyun.cn/fengdu/img-jifenrenwu.png') no-repeat;
background-size: 100% 100%;
color: #2D7DFF;
}
.jfph {
background: url('https://cdn.cunwuyun.cn/fengdu/img-jifenpaihang.png') no-repeat;
background-size: 100% 100%;
color: #338A77;
}
.jfsc {
background: url('https://cdn.cunwuyun.cn/fengdu/img-jifenshangcheng.png') no-repeat;
background-size: 100% 100%;
color: #D9606E;
}
& > div:nth-child(2n+1) {
margin-right: 30px;
}
2023-03-20 14:54:29 +08:00
}
2023-03-28 15:25:51 +08:00
.handpick {
padding: 0 32px;
box-sizing: border-box;
.title {
margin: 32px 0;
2023-04-03 17:03:43 +08:00
display: flex;
justify-content: space-between;
align-items: center;
h1 {
font-size: 34px;
font-weight: 500;
}
.more {
width: 200px;
color: #687DA6;
font-size: 28px;
font-weight: 400;
text-align: right;
}
2023-03-28 15:25:51 +08:00
}
.list {
2023-04-04 18:00:23 +08:00
.card {
margin-bottom: 24px;
padding: 32px 24px;
box-sizing: border-box;
background: #FFF;
border-radius: 12px;
.top {
display: flex;
justify-content: space-between;
.left {
width: 562px;
overflow:hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
2023-03-28 15:25:51 +08:00
}
2023-04-04 18:00:23 +08:00
.right {
width: 52px;
text-align: center;
img {
width: 40px;
height: 40px;
}
span {
font-size: 28px;
font-weight: 400;
color: #687DA6;
}
2023-03-28 17:08:46 +08:00
}
2023-03-28 15:25:51 +08:00
}
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-04 18:00:23 +08:00
}
2023-03-28 15:25:51 +08:00
}
}
}
}
2023-03-20 14:54:29 +08:00
}
2023-03-20 08:32:07 +08:00
</style>