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

299 lines
6.6 KiB
Vue
Raw Normal View History

2023-03-16 17:11:40 +08:00
<template>
<div class="TopicDetail">
2023-03-17 14:10:05 +08:00
<h2>#{{ name }}</h2>
2023-03-16 17:11:40 +08:00
<p>贴子23913</p>
<div class="tab">
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>
<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?isFrom=topic&id=' + item.id + '&name=' + name + '&themeId=' + themeId)">
2023-03-16 17:11:40 +08:00
<div class="item-top">
2023-03-17 15:47:31 +08:00
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
2023-03-16 17:11:40 +08:00
<div class="right">
2023-03-17 14:10:05 +08:00
<h3>{{ item.createUserName }}</h3>
2023-03-20 09:08:49 +08:00
<span v-if="item.publishDepartName">{{ 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
<text>{{ item.content }}</text>
2023-03-16 17:11:40 +08:00
</div>
2023-03-17 14:10:05 +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 14:10:05 +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 14:10:05 +08:00
<i>{{ item.sharedCount }}</i>
2023-03-16 17:11:40 +08:00
</div>
<div>
2023-03-17 17:51:10 +08:00
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" />
2023-03-17 14:10:05 +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 14:10:05 +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>
<AiLogin ref="login"/>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: 'TopicDetail',
appName: '话题详情',
data () {
return {
2023-03-17 14:10:05 +08:00
currIndex: 0,
name: '',
themeId: '',
list: [],
isMore: false,
current: 1,
total: 0
2023-03-16 17:11:40 +08:00
}
},
computed: {
...mapState(['user', 'token'])
},
2023-03-17 14:10:05 +08:00
onLoad (query) {
this.themeId = query.themeId
this.name = query.name
this.$nextTick(() => {
this.getList()
})
2023-03-16 17:11:40 +08:00
},
methods: {
2023-03-17 14:10:05 +08:00
...mapActions(['autoLogin', 'authCheck']),
changeTab (index) {
this.currIndex = index
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getList()
})
},
getList () {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
themeId: this.themeId,
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]
} else {
this.list = res.data.records
}
this.total = res.data.total
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onReachBottom () {
this.getList()
2023-03-16 17:11:40 +08:00
}
}
</script>
<style scoped lang="scss">
.TopicDetail {
padding-top: 32px;
padding-bottom: 40px;
div {
box-sizing: border-box;
}
& > h2 {
margin: 0 32px 24px;
font-size: 46px;
color: #3d3d3d;
}
.tab {
margin: 0 32px 24px;
}
& > p {
margin: 0 32px 12px;
color: #999999;
font-size: 28px;
}
.AppCircle-list {
.item {
margin: 0 24px 24px;
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 {
color: #333333;
text-align: left;
font-size: 34px;
font-weight: 500;
}
span {
2023-03-20 09:08:49 +08:00
margin-top: 12px;
2023-03-16 17:11:40 +08:00
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
2023-03-20 11:09:30 +08:00
flex-wrap: wrap;
2023-03-16 17:11:40 +08:00
image {
2023-03-20 11:09:30 +08:00
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
2023-03-16 17:11:40 +08:00
&:nth-of-type(3n) {
2023-03-20 11:09:30 +08:00
padding-right: 0;
2023-03-16 17:11:40 +08:00
}
}
}
& > p {
2023-03-20 11:09:30 +08:00
margin: 12px 0;
2023-03-16 17:11:40 +08:00
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 17:51:10 +08:00
margin: 16px 0;
2023-03-16 17:11:40 +08:00
line-height: 1.3;
2023-03-17 17:51:10 +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;
}
}
}
}
.tab {
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: ' ';
}
}
}
}
}
</style>