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

405 lines
9.5 KiB
Vue
Raw Normal View History

2023-03-16 17:11:40 +08:00
<template>
<div class="AppCircle">
<div class="top">
<div class="left">
2023-03-17 14:10:05 +08:00
<span @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">广场</span>
<span @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">社区</span>
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 10:35:46 +08:00
<div class="right" @click="$linkTo('./MyPostList')">
2023-03-16 17:11:40 +08:00
<span>我的贴子</span>
<i>1</i>
</div>
</div>
2023-03-17 14:10:05 +08:00
<div class="nav" v-if="topic.length">
<div
class="nav-item"
hover-class="text-hover"
v-for="(item, index) in topic" :key="index" @click="$linkTo('./TopicDetail?themeId=' + item.id + '&name=' + item.title)">
2023-03-17 11:35:02 +08:00
<image :src="item.picUrl" mode="aspectFill" />
<h2>{{ item.title }}</h2>
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 11:35:02 +08:00
<div class="nav-item" @click="$linkTo('./Topic')" v-if="topicList.length > 7">
2023-03-16 17:11:40 +08:00
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-more.png" />
<h2>更多</h2>
</div>
</div>
<div class="AppCircle-list">
2023-03-17 14:10:05 +08:00
<div class="item" v-for="(item, index) in list" :key="index" @click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
2023-03-16 17:11:40 +08:00
<div class="item-top">
2023-03-17 11:35:02 +08:00
<image :src="item.createUserAvatar" />
2023-03-16 17:11:40 +08:00
<div class="right">
2023-03-17 11:35:02 +08:00
<h3>{{ item.createUserName }}</h3>
<span>{{ item.publishDepartName }}</span>
2023-03-16 17:11:40 +08:00
</div>
</div>
<div class="item-content">
2023-03-17 14:10:05 +08:00
<span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
2023-03-17 11:35:02 +08:00
<text>{{ item.content }}</text>
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 11:35:02 +08:00
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" v-for="(item, index) in item.files" :key="index" :src="item.url" />
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 11:35:02 +08:00
<p>{{ item.createTime }}</p>
2023-03-16 17:11:40 +08:00
<div class="item-bottom">
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
2023-03-17 11:35:02 +08:00
<i>{{ item.sharedCount }}</i>
2023-03-16 17:11:40 +08:00
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png" />
2023-03-17 11:35:02 +08:00
<i>{{ item.appreciateCount }}</i>
2023-03-16 17:11:40 +08:00
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" />
2023-03-17 11:35:02 +08:00
<i>{{ item.commentCount }}</i>
2023-03-16 17:11:40 +08:00
</div>
</div>
</div>
2023-03-17 14:10:05 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 09:35:55 +08:00
<div class="add" hover-class="text-hover" @click="$linkTo('./Add')">
2023-03-16 17:11:40 +08:00
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-fatie.png" />
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: 'AppCircle',
appName: '邻里互助',
data () {
return {
2023-03-17 11:35:02 +08:00
currIndex: 0,
topicList: [],
2023-03-17 14:10:05 +08:00
list: [],
isMore: false,
current: 1
2023-03-16 17:11:40 +08:00
}
},
computed: {
2023-03-17 11:35:02 +08:00
...mapState(['user', 'token']),
topic () {
return this.topicList.filter((v, index) => index < 8)
}
2023-03-16 17:11:40 +08:00
},
onLoad() {
2023-03-17 11:35:02 +08:00
this.getTopicList()
2023-03-16 17:11:40 +08:00
},
methods: {
2023-03-17 11:35:02 +08:00
getTopicList () {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
// withoutToken: true,
params: {
current: 1,
size: 100
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
this.getList()
}
})
},
2023-03-17 14:10:05 +08:00
changeTab (index) {
this.currIndex = index
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getList()
})
},
2023-03-17 11:35:02 +08:00
getList () {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
visibleRange: this.currIndex === 0 ? 1 : 0
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})]
} else {
this.list = res.data.records.map(e => {
return {
...e,
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
2023-03-16 17:11:40 +08:00
2023-03-17 11:35:02 +08:00
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
2023-03-16 17:11:40 +08:00
}
2023-03-17 11:35:02 +08:00
},
onReachBottom () {
this.getList()
2023-03-16 17:11:40 +08:00
}
}
</script>
<style scoped lang="scss">
.AppCircle {
padding-top: 120px;
padding-bottom: 40px;
div {
box-sizing: border-box;
}
.add {
position: fixed;
right: 32px;
bottom: 32px;
z-index: 111;
image {
width: 104px;
height: 104px;
}
}
.nav {
display: flex;
align-items: center;
flex-wrap: wrap;
margin: 0 32px 24px;
padding-top: 30px;
background: #ffffff;
border-radius: 16px;
box-shadow: inset 0 -1px 0 0 #eeeeee;
.nav-item {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 25%;
padding-bottom: 32px;
image {
width: 108px;
height: 108px;
}
h2 {
2023-03-17 14:10:05 +08:00
line-height: 32px;
margin-top: 8px;
2023-03-16 17:11:40 +08:00
font-size: 26px;
font-weight: 400;
}
}
}
.AppCircle-list {
.item {
2023-03-17 09:35:55 +08:00
margin: 0 32px 24px;
2023-03-16 17:11:40 +08:00
padding: 24px 24px 0;
background: #ffffff;
border-radius: 16px;
box-shadow: inset 0 -1px 0 0 #eeeeee;
.item-top {
display: flex;
align-items: center;
image {
width: 96px;
height: 96px;
margin-right: 16px;
border-radius: 50%;
}
h3 {
margin-bottom: 12px;
color: #333333;
text-align: left;
font-size: 34px;
font-weight: 500;
}
span {
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
image {
flex: 1;
height: 202px;
margin-right: 12px;
&:nth-of-type(3n) {
margin-right: 0;
}
}
}
& > p {
margin: 24px 0;
font-size: 28px;
color: #333333;
}
.item-bottom {
display: flex;
align-items: center;
height: 88px;
border-top: 1px solid #eeeeee;
div {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
image {
width: 40px;
height: 40px;
margin: 16px;
}
i {
color: #687DA6;
font-size: 28px;
}
}
}
.item-content {
2023-03-17 11:35:02 +08:00
margin: 16px 0;
2023-03-16 17:11:40 +08:00
line-height: 1.3;
2023-03-17 11:35:02 +08:00
text-align: justify;
2023-03-16 17:11:40 +08:00
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
}
}
.top {
display: flex;
position: fixed;
align-items: center;
justify-content: space-between;
top: 0;
left: 0;
z-index: 11;
width: 100%;
height: 100px;
padding: 0 32px;
background: #ffffff;
.left {
display: flex;
align-items: center;
height: 100px;
span {
position: relative;
height: 100px;
line-height: 100px;
color: #222;
font-size: 30px;
&:first-child {
margin-right: 64px;
}
&.active {
font-weight: 600;
font-size: 32px;
&::after {
position: absolute;
bottom: 12px;
left: 50%;
width: 40px;
height: 6px;
border-radius: 3px;
background: #2d7dffff;
transform: translateX(-50%);
content: ' ';
}
}
}
}
.right {
position: relative;
i {
position: absolute;
top: -6px;
right: 0;
z-index: 11;
height: 24px;
line-height: 24px;
padding: 0 10px;
font-size: 16px;
color: #fff;
border-radius: 50%;
border: 2px solid #ffffff;
background: #ff5e5e;
box-sizing: border-box;
transform: translateX(50%);
}
span {
display: block;
width: 120px;
height: 60px;
line-height: 60px;
text-align: center;
color: #df6b6c;
font-size: 24px;
border-radius: 10px;
border: 1px solid #df6b6c;
}
}
}
}
</style>