邻里互助

This commit is contained in:
liuye
2023-12-20 14:00:13 +08:00
parent e5c5e4584b
commit 44afde131d
8 changed files with 2789 additions and 0 deletions

View File

@@ -0,0 +1,266 @@
<template>
<div class="Add">
<div class="add-content">
<div class="top">
<!-- <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-edit.png" /> -->
<textarea placeholder="发布内容" v-model="form.content" :maxlength="500"></textarea>
<div class="bottom">
<div></div>
<div>
<i>{{ form.content.length }}</i>
<span>/500</span>
</div>
</div>
</div>
<div class="bottom">
<h2>最多上传9张</h2>
<div class="img">
<AiUploader v-model="form.files" :limit="9" multiple/>
</div>
<div class="topic">
<h3 v-if="!form.themeId" @click="isShow = true">#绑定话题</h3>
<div class="choosed" v-else @click="isShow = true">
<span>#{{ form.themeTitle }}</span>
</div>
<p>绑定一个与您发布内容相关很高的话题会被更多人看到哦</p>
</div>
</div>
</div>
<!-- <div class="bottom">
<h2>仅本社区可见</h2>
<switch color="#2D7DFF" @change="onSwitchChange"></switch>
</div> -->
<div class="btn-wrapper">
<div class="btn" hover-class="text-hover" :class="[!form.content ? 'active' : '']" @click="submit">发布服务</div>
</div>
<!-- <u-popup v-model="isShow" mode="bottom" hidden height="700rpx" border-radius="30">
<div class="popup">
<h2>请选择</h2>
<scroll-view class="popup-list" scroll-y>
<div
v-for="(item, index) in topicList"
:class="[form.themeId === item.id ? 'active' : '']"
:key="index"
@click="form.themeId = item.id, form.themeTitle = item.title, isShow = false">
#{{ item.title }}
</div>
</scroll-view>
</div>
</u-popup> -->
<u-select v-model="isShow" :list="topicList" value-name="id"
label-name="title" @confirm="confirm"></u-select>
</div>
</template>
<script>
export default {
name: 'Add',
appName: '发新贴',
data () {
return {
form: {
files: [],
themeId: '',
themeTitle: '',
source: 0,
content: '',
visibleRange: 1
},
topicList: [],
isShow: false
}
},
onLoad () {
this.getTopicList()
},
methods: {
confirm(val) {
this.form.themeId = val[0].value;
this.form.themeTitle = val[0].label;
},
submit () {
if (!this.form.content) {
return this.$toast(`内容不能为空`)
}
if (!this.form.themeId) {
return this.$toast(`请绑定话题`)
}
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
...this.form
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.$dialog.alert({
title: '温馨提示',
content: '提交成功'
}).then(() => {
uni.navigateBack()
uni.$emit('updateList')
}).catch(() => {})
}
})
},
onSwitchChange (e) {
this.form.visibleRange = e.detail.value ? 0 : 1
},
getTopicList () {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
current: 1,
size: 100,
status: 1
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
}
})
},
}
}
</script>
<style scoped lang="scss">
.Add {
padding: 24px 0 130px;
& > div {
background: #fff;
}
.btn-wrapper .active {
background: rgba(45, 125, 255, 0.6);
}
.popup {
height: 700px;
border-radius: 20px 20px 0 0;
h2 {
height: 98px;
line-height: 98px;
text-align: center;
color: #333333;
font-size: 34px;
font-weight: 600;
}
.popup-list {
height: calc(100% - 98px);
div {
padding: 20px 48px;
color: #333333;
font-size: 30px;
&.active {
color: #2D7DFF;
}
}
}
}
div {
box-sizing: border-box;
}
.add-content {
margin-bottom: 24px;
& > .top {
padding: 32px;
border-bottom: 1px solid #eee;
textarea {
width: 100%;
height: 300px;
}
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 14px;
div {
display: flex;
align-items: center;
}
i {
font-size: 24px;
color: #666666;
}
span {
font-size: 24px;
color: #999999;
}
}
}
& > .bottom {
padding: 32px 32px;
h2 {
margin-bottom: 16px;
font-size: 24px;
color: #999;
}
.topic {
h3 {
width: 134px;
height: 52px;
line-height: 52px;
margin-bottom: 12px;
text-align: center;
border: 1px solid #999;
border-radius: 26px;
color: #666;
font-size: 22px;
}
p {
font-size: 20px;
color: #999999;
}
.choosed {
display: flex;
align-items: center;
justify-content: center;
height: 52px;
padding: 0 16px;
width: fit-content;
margin-bottom: 12px;
border: 1px solid #2D7DFF;
border-radius: 26px;
font-size: 22px;
color: #2D7DFF;
}
}
}
}
& > .bottom {
display: flex;
align-items: center;
justify-content: space-between;
height: 98px;
padding: 0 32px;
h2 {
font-size: 28px;
color: #333333;
}
}
}
</style>

View File

@@ -0,0 +1,559 @@
<template>
<div class="AppCircle">
<u-navbar :is-back="true" title="邻里互助" title-color="#000" title-width="300" title-size="32" :title-bold="true" :background="backgroundNavbar"></u-navbar>
<div class="header-bg">
<div class="header">
<div class="top">
<div class="left">
<span @click="changeTab(0)" :class="{active:currIndex === 0}">广场</span>
<!-- <span @click="changeTab(1)" :class="{active:currIndex === 1}">社区</span> -->
</div>
<div class="right" @click="$linkTo('./MyPostList')" hover-class="text-hover">
<span>我的贴子<img src="https://cdn.cunwuyun.cn/wechat/wuxi/circle-top-icon.png" alt=""></span>
<i></i>
</div>
</div>
</div>
<div class="nav-content" v-if="topic.length">
<div class="nav">
<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)">
<image :src="item.picUrl" mode="aspectFill"/>
<h2>{{ item.title }}</h2>
</div>
<div class="nav-item" hover-class="text-hover" @click="$linkTo('./Topic')" v-if="topicList.length > 6">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-more.png"/>
<h2>更多</h2>
</div>
</div>
</div>
</div>
<div class="AppCircle-list">
<div class="item"
v-for="(item, index) in list"
:key="index"
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<!-- <span v-if="item.publishDepartName">{{ item.publishDepartName }}</span> -->
<span>{{ item.createTime }}</span>
</div>
</div>
<div class="item-content">
<span hover-stop-propagation v-if="item.topicName"
@click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" @click.stop="previewImage(e.url, item.files)" v-for="(e, i) in item.files" :key="i" :src="e.url"/>
</div>
<p v-if="item.publishDepartName">{{ item.publishDepartName }}</p>
<div class="item-bottom">
<button hover-stop-propagation @click.stop="onBtnClick" open-type="share" :data-content="item.content" :data-themeid="item.themeId" :data-id="item.id"
:data-name="item.topicName">
<image src="https://cdn.cunwuyun.cn/wechat/wuxi/circle-zf-icon.png"/>
<i>{{ item.sharedCount }}</i>
</button>
<div hover-stop-propagation @click.stop="reciate(item.id, item.appreciateStatus)">
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wechat/wuxi/circle-dz-select-icon.png' : 'https://cdn.cunwuyun.cn/wechat/wuxi/circle-dz-icon.png'"/>
<i>{{ item.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wechat/wuxi/circle-pl-icon.png"/>
<i>{{ item.commentCount }}</i>
</div>
</div>
</div>
<AiEmpty v-if="!list.length"/>
</div>
<div class="add" hover-class="text-hover" @click="toAdd">
<image src="https://cdn.cunwuyun.cn/wechat/wuxi/circle-add.png" mode="aspectFill" />
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
customNavigation: true,
name: 'AppCircle',
appName: '邻里互助',
data() {
return {
currIndex: 0,
topicList: [],
list: [],
isMore: false,
current: 1,
isFixed: false,
statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
total: 0,
backgroundNavbar: {
background: 'url(https://cdn.cunwuyun.cn/wechat/wuxi/wuxi-nav-bg.png) no-repeat',
backgroundSize: 'cover',
}
}
},
computed: {
...mapState(['user', 'token']),
topic() {
return this.topicList.filter((v, index) => index < 7)
}
},
onLoad(option) {
if(option.id) { //有id直接跳入话题详情页
this.$linkTo('./TopicDetail?themeId=' + option.id + '&name=' + option.name)
}
uni.setNavigationBarTitle({
title: '邻里互助'
});
this.getTopicList()
uni.$on('updateList', () => {
this.getMyPublishCount()
this.changeTab(this.currIndex)
})
if (!this.token) {
this.autoLogin({ loginWay: 'qujing' }).then(() => {
this.getMyPublishCount()
})
} else {
this.getMyPublishCount()
}
},
onPageScroll (params) {
this.isFixed = params.scrollTop > 60
},
onUnload() {
uni.$off('updateList')
},
methods: {
...mapActions(['autoLogin']),
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
onBtnClick(e) {
},
reciate(id, appreciateStatus) {
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${id}`).then(res => {
if (res.code === 0) {
this.$toast(appreciateStatus ? '取消点赞' : '点赞成功')
this.changeTab(this.currIndex)
}
})
},
getMyPublishCount() {
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: 1,
size: 10,
listType: 0,
createUserId: this.user.id
}
}).then(res => {
if (res.code === 0) {
this.total = res.data.total
}
})
},
toAdd() {
if (this.user.areaId) {
this.$linkTo('./Add')
} else {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo?isFromTabbar=1&path=/pages/AppCircle/AppCircle')
}).catch(() => {
})
}
},
getTopicList() {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
current: 1,
size: 100,
status: 1
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
this.getList()
}
})
},
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, {
withoutToken: !this.token,
params: {
current: this.current,
size: 10,
visibleRange: this.currIndex === 0 ? 1 : 0
}
}).then(res => {
if (res.code === 0) {
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
files: e.files.filter((v, index) => index < 3),
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,
files: e.files.filter((v, index) => index < 3),
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).finally(() => this.$hideLoading())
}
},
onReachBottom() {
this.getList()
},
onShareAppMessage(e) {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${e.target.dataset.id}`).then(res => {
if (res.code === 0) {
this.changeTab(this.currIndex)
}
})
return {
title: e.target.dataset.content.substr(0, 20),
path: `/mods/AppCircle/Detail?id=${e.target.dataset.id}&themeId=${e.target.dataset.themeid}&name=${e.target.dataset.name}`
}
}
}
</script>
<style scoped lang="scss">
.AppCircle {
// padding-top: 100px;
padding-bottom: 40px;
.header-bg {
background: url('https://cdn.cunwuyun.cn/wechat/wuxi/wuxi-header-bg.png') center;
background-size: 100% 100%;
}
.header {
width: 100%;
opacity: 1;
transition: all 0.2s ease;
}
div {
box-sizing: border-box;
}
.add {
position: fixed;
right: 32px;
bottom: 32px;
z-index: 111;
image {
width: 124px;
height: 124px;
}
}
.nav-content {
padding-top: 16px;
width: 100%;
height: 192px;
margin-bottom: 230px;
}
.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 {
line-height: 32px;
margin-top: 8px;
font-size: 26px;
font-weight: 400;
}
}
}
.AppCircle-list {
.item {
margin: 0 32px 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 {
margin-top: 12px;
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
& > p {
margin: 12px 0;
font-family: PingFangSC-Regular;
font-size: 26px;
color: #999;
line-height: 36px;
}
.item-bottom {
display: flex;
align-items: center;
height: 88px;
border-top: 1px solid #eeeeee;
div, button {
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 {
margin: 16px 0;
line-height: 1.3;
text-align: justify;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
}
}
.top {
display: flex;
align-items: center;
justify-content: space-between;
top: 0;
left: 0;
z-index: 11;
width: 100%;
height: 100px;
padding: 0 32px;
.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: 8px;
background: #026AF2;
border-radius: 4px;
transform: translateX(-50%);
content: ' ';
}
}
}
}
.right {
position: relative;
i {
position: absolute;
top: -6px;
right: 0;
z-index: 11;
width: 16px;
height: 16px;
border-radius: 50%;
background: #FF4747;
// height: 24px;
// line-height: 24px;
// padding: 0 10px;
// font-size: 16px;
// color: #4181FF;
// border-radius: 50%;
// border: 2px solid #4181FF;
// background: #fff;
// box-sizing: border-box;
// transform: translateX(50%);
}
span {
display: block;
font-family: PingFangSC-Regular;
font-size: 24px;
color: #333;
line-height: 54px;
text-align: center;
width: 164px;
height: 56px;
border: 1px solid #8A929F;
border-radius: 28px;
img {
display: inline-block;
width: 24px;
height: 24px;
vertical-align: middle;
}
}
}
}
.row2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
</style>

View File

@@ -0,0 +1,791 @@
<template>
<div class="Detail" v-if="pageShow">
<div class="top">
<div class="item-top">
<image :src="info.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ info.createUserName }}</h3>
<span v-if="info.publishDepartName">{{ info.publishDepartName }}</span>
</div>
<div class="top-btn" v-if="info.integralTaskId && info.integralTaskInfo.status != 2 && info.showSignBtn"
@click="toTask">去参与
</div>
</div>
<div class="item-content">
<span v-if="name" @click="toTopic('./TopicDetail?themeId=' + themeId + '&name=' + name)">#{{ name }}</span>
<text v-if="info.integralTaskId">{{ info.integralTaskInfo.detail }}</text>
<text v-else>{{ info.content }}</text>
</div>
<div v-if="info.integralTaskId">
<div class="info-flex">
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/address-icon.png" alt="">活动地点</div>
<div class="value">{{ info.integralTaskInfo.address }}</div>
</div>
<div class="info-flex">
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/come-icon.png" alt="">任务类型</div>
<div class="value">{{ info.integralTaskInfo.type == 1 ? '报名得积分' : '打卡得积分' }}</div>
</div>
<div class="info-flex">
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/time-icon.png"
alt="">{{ info.integralTaskInfo.type == 1 ? '报名时间:' : '进场时间:' }}
</div>
<div class="value">{{ info.integralTaskInfo.intoBegintime }}{{ info.integralTaskInfo.intoEndtime }}</div>
</div>
<div class="info-flex" v-if="info.integralTaskInfo.type != 1">
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/leave-icon.png" alt="">离场时间</div>
<div class="value">{{ info.integralTaskInfo.exitBegintime }}{{ info.integralTaskInfo.exitEndtime }}</div>
</div>
</div>
<div class="item-imgs" v-if="info.files && info.files.length">
<image mode="aspectFill" @click="previewImage(item.url, info.files)" v-for="(item, index) in info.files"
:key="index" :src="item.url"/>
</div>
<p>{{ info.createTime }}</p>
<div class="item-bottom">
<button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ info.sharedCount }}</i>
</button>
<div>
<image
:src="info.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'"
@click="reciate"/>
<i>{{ info.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ info.commentCount }}</i>
</div>
</div>
</div>
<div class="comment">
<h2>评论</h2>
<div class="comment-wrapper">
<div class="comment-item" v-for="(item, index) in list" :key="index">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<p>{{ item.content }}</p>
<div class="bottom">
<span>{{ item.createTime }}</span>
<div hover-class="text-hover" @click="replay(item)">回复</div>
</div>
<div class="replay-list" v-if="item.replyList.length">
<div class="replay-item" v-for="replay in item.replyList" :key="replay.id">
<image :src="replay.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="replay-item__right">
<div class="top">
<div class="replay-left">
<h3>{{ replay.createUserName }}</h3>
<span>回复</span>
<h3>{{ item.createUserName }}</h3>
</div>
<p>{{ replay.createTime }}</p>
</div>
<p>{{ replay.content }}</p>
</div>
</div>
</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
</div>
<div class="footer" @click="showComment">
<span>请输入评论内容</span>
<!-- <div hover-class="hover-class">发送</div> -->
</div>
<u-popup v-model="isShow" mode="bottom" hidden height="350rpx" border-radius="30">
<div class="popup">
<div class="popup-title">
<h2>请选择</h2>
<image @click="isShow = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png"/>
</div>
<div class="popup-list">
<button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-wechat.png"/>
<span>微信</span>
</button>
<!-- <button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pyq.png" />
<span>朋友圈</span>
</button>
<button>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-link.png" />
<span>复制链接</span>
</button> -->
</div>
</div>
</u-popup>
<u-popup v-model="isShowComment" mode="bottom" hidden height="400rpx" border-radius="30" @close="focus = false">
<div class="popup">
<div class="popup-title">
<h2>评论</h2>
<image @click="isShowComment = false, focus = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png"/>
</div>
<div class="form">
<textarea :maxlength="100" :cursor-spacing="10"
:placeholder="commentId ? '回复' + replyName : '请输入评论内容'" :focus="focus"
v-model="content"></textarea>
<div>
<div class="send-btn" hover-class="hover-class" @click="send">发送</div>
</div>
</div>
</div>
</u-popup>
</div>
</template>
<script>
import {mapActions, mapState} from 'vuex'
export default {
name: 'Detail',
appName: '详情',
data() {
return {
id: '',
isShow: false,
info: {},
name: '',
themeId: '',
isFrom: '',
list: [],
isMore: false,
isShowComment: false,
current: 1,
content: '',
focus: false,
pageShow: false,
commentId: '',
replyName: ''
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad(query) {
this.isFrom = query.isFrom
this.id = query.id
this.themeId = query.themeId
this.name = query.name || ''
this.$loading()
Promise.resolve(this.token || this.autoLogin()).then(() =>
Promise.all([
this.getInfo(query.id),
this.getCommontList(query.id)
])
).finally(() => this.$hideLoading())
},
methods: {
...mapActions(['autoLogin']),
toTask() {
if (!this.user.areaId) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo')
})
return false
}
this.$linkTo(`/mods/AppNewFarmerBank/taskDetail?id=${this.info.integralTaskId}`)
},
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
showComment() {
if (!this.user.areaId) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo')
}).catch(() => {
})
return false
}
this.commentId = ''
this.replyName = ''
this.isShowComment = true
this.$nextTick(() => {
setTimeout(() => {
this.focus = true
}, 500)
})
},
replay(item) {
if (!this.user.areaId) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo')
}).catch(() => {
})
return false
}
this.commentId = item.id
this.replyName = item.createUserName
this.isShowComment = true
this.$nextTick(() => {
setTimeout(() => {
this.focus = true
}, 500)
})
},
getInfo(id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: !this.token,
}).then(res => {
if (res.code === 0) {
this.info = res.data
this.pageShow = true
}
uni.hideLoading()
})
},
reciate() {
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => {
if (res.code === 0) {
this.$toast(this.info.appreciateStatus ? '取消点赞' : '点赞成功')
uni.$emit('updateList')
this.getInfo(this.id)
}
uni.hideLoading()
})
},
send() {
if (!this.content) {
return this.$toast('内容不能为空')
}
this.$loading()
this.$instance.post(!this.commentId ? `/app/appneighborhoodassistance/addComment` : `/app/appneighborhoodassistance/addReply`, {
content: this.content,
naId: this.id,
type: this.commentId ? 1 : 0,
commentId: this.commentId || ''
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.isShowComment = false
this.$toast('提交成功')
this.content = ''
this.replyName = ''
this.commentId = ''
this.focus = false
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getCommontList(this.id)
})
}
})
},
toTopic(url) {
if (this.isFrom === 'topic') {
uni.navigateBack({
delta: 1
})
} else {
this.$linkTo(url)
}
},
getCommontList(id) {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: !this.token,
params: {
id,
current: this.current,
size: 10
}
}).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
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current++
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onReachBottom() {
this.getCommontList()
},
// onShareTimeline() {
// return {
// title: this.info.content,
// // path: `/mods/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
// }
// },
onShareAppMessage() {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${this.id}`).then(res => {
if (res.code === 0) {
uni.$emit('updateList')
this.getInfo(this.id)
}
})
return {
title: this.info.content,
path: `/mods/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
}
},
}
</script>
<style scoped lang="scss">
.Detail {
padding-top: 24px;
padding-bottom: 130px;
div {
box-sizing: border-box;
}
.popup {
height: 400px;
border-radius: 20px 20px 0 0;
.popup-title {
position: relative;
height: 98px;
line-height: 98px;
text-align: center;
image {
position: absolute;
right: 40px;
top: 50%;
z-index: 1;
width: 32px;
height: 32px;
transform: translateY(-50%);
}
h2 {
color: #333333;
font-size: 34px;
font-weight: 600;
}
}
.popup-list {
display: flex;
align-items: center;
margin-top: 30px;
button {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
flex-direction: column;
image {
width: 94px;
height: 94px;
margin-bottom: 8px;
}
span {
font-size: 26px;
color: #1D2229;
}
}
}
.form {
padding: 0 32px;
textarea {
width: 100%;
margin-bottom: 20px;
height: 200px;
line-height: 1.3;
padding: 20px;
font-size: 28px;
color: #333;
box-sizing: border-box;
background: #eeeeee;
}
& > div {
display: flex;
align-items: center;
justify-content: flex-end;
}
.send-btn {
display: inline-block;
width: 100px;
height: 60px;
line-height: 60px;
text-align: right;
text-align: center;
font-size: 26px;
color: #fff;
border-radius: 30px;
background: #2d7dffff;
}
}
}
.footer {
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 0;
z-index: 111;
width: 100%;
padding: 18px 32px;
background: #fff;
span {
flex: 1;
height: 70px;
line-height: 70px;
// margin-right: 16px;
padding: 0 24px;
border-radius: 36px;
font-size: 26px;
box-sizing: border-box;
background: #eeeeee;
color: #999;
}
div {
width: 100px;
height: 60px;
line-height: 60px;
text-align: center;
font-size: 26px;
color: #fff;
border-radius: 30px;
background: #2d7dffff;
}
}
.comment {
margin-top: 24px;
padding: 32px 32px 26px;
background: #fff;
.comment-wrapper {
.comment-item {
display: flex;
padding: 26px 0;
&:first-child {
padding-top: 0;
}
&:last-child {
padding-bottom: 0;
}
& > image {
width: 72px;
height: 72px;
margin-right: 16px;
border-radius: 50%;
}
.replay-list {
margin-top: 32px;
.replay-item {
display: flex;
margin-bottom: 32px;
&:last-child {
margin-bottom: 0;
}
image {
width: 48px;
height: 48px;
margin-right: 16px;
border-radius: 50%;
}
.replay-item__right {
flex: 1;
.top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
.replay-left {
display: flex;
align-items: center;
}
h3 {
color: #666666;
font-size: 24px;
}
span {
margin: 0 8px;
font-size: 24px;
color: #687DA6;
}
p {
color: #999999;
font-size: 24px;
}
}
& > p {
line-height: 1.3;
color: #333333;
font-size: 24px;
}
}
}
}
& > .right {
flex: 1;
padding-bottom: 32px;
border-bottom: 1px solid #EEEEEE;
& > h3 {
line-height: 40px;
margin-bottom: 8px;
color: #666666;
font-size: 28px;
}
& > p {
line-height: 42px;
margin-bottom: 24px;
color: #333;
font-size: 28px;
}
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
span {
color: #999999;
font-size: 24px;
}
div {
color: #687DA6;
font-size: 24px;
}
}
}
&:last-child {
padding-bottom: 0;
.right {
padding-bottom: 0;
border-bottom: none;
}
}
}
}
& > h2 {
margin-bottom: 32px;
color: #3d3d3d;
font-size: 38px;
font-weight: 600;
}
}
& > .top {
padding: 32px 32px 0;
background: #ffffff;
position: relative;
.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 {
margin-top: 12px;
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
& > p {
margin: 12px 0;
font-size: 28px;
color: #333333;
}
.item-bottom {
display: flex;
align-items: center;
height: 88px;
border-top: 1px solid #eeeeee;
div, button {
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 {
margin: 16px 0;
line-height: 1.3;
text-align: justify;
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
.info-flex {
display: flex;
color: #666;
font-size: 24px;
font-family: "PingFang SC";
line-height: 30px;
margin-bottom: 16px;
.label {
width: 160px;
img {
width: 30px;
height: 30px;
margin-right: 8px;
vertical-align: bottom;
}
}
.value {
width: calc(100% - 160px);
color: #333;
vertical-align: text-top;
}
}
.top-btn {
width: 154px;
height: 56px;
line-height: 56px;
text-align: center;
background-color: #2E7DFF;
border-radius: 28px;
color: #fff;
font-size: 30px;
font-family: "PingFang SC";
position: absolute;
top: 52px;
right: 32px;
}
}
}
</style>

View File

@@ -0,0 +1,748 @@
<template>
<div class="MyPostList">
<div class="userinfo">
<div class="top">
<div class="left">
<image :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<h2>{{ user.nickName }}</h2>
</div>
<div class="add-btn" hover-class="text-hover" @click="handleAdd">发贴</div>
</div>
<div class="bottom">
<div class="bottom-item" @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">
<span>发贴</span>
<h2>{{ totalInfo['发帖'] }}</h2>
</div>
<div class="bottom-item" @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">
<span>点赞</span>
<h2>{{ totalInfo['点赞'] }}</h2>
</div>
<div class="bottom-item" @click="changeTab(2)" :class="[currIndex === 2 ? 'active' : '']">
<span>评论</span>
<h2>{{ totalInfo['评论'] }}</h2>
</div>
</div>
</div>
<div class="body">
<div class="body-list" v-if="currIndex === 0">
<div class="item"
v-for="(item, index) in list"
:key="index"
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div>
<image hover-stop-propagation @click.stop="remove(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div>
<div class="item-content">
<span v-if="item.topicName" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" hover-stop-propagation @click.stop="previewImage(e.url, item.files)" v-for="(e, i) in item.files" :key="i" :src="e.url"/>
</div>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ item.sharedCount }}</i>
</div>
<div>
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'"/>
<i>{{ item.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i>
</div>
</div>
</div>
</div>
<div class="body-list" v-if="currIndex === 1">
<div class="item"
v-for="(item, index) in list"
:key="index"
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div>
<image hover-stop-propagation @click.stop="removeLike(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div>
<div class="item-content">
<span v-if="item.topicName" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" hover-stop-propagation @click.stop="previewImage(e.url, item.files)" v-for="(e, i) in item.files" :key="i" :src="e.url"/>
</div>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ item.sharedCount }}</i>
</div>
<div>
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'"/>
<i>{{ item.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i>
</div>
</div>
</div>
</div>
<div class="comment" v-if="currIndex === 2">
<div class="comment-item" v-for="(item, index) in list" :key="index">
<div class="comment-top">
<span>{{ item.myComment.createTime }}</span>
<image hover-stop-propagation @click.stop="removeComment(item.myComment.id)" class="remove"
src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div>
<p>{{ item.myComment.content }}</p>
<div
class="bottom"
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div>
</div>
<div class="item-content">
<span v-if="item.topicName">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" hover-stop-propagation @click.stop="previewImage(e.url, item.files)" v-for="(e, i) in item.files" :key="i" :src="e.url"/>
</div>
</div>
</div>
</div>
<AiEmpty v-if="!list.length && isMore"></AiEmpty>
</div>
</div>
</template>
<script>
import {mapState} from "vuex";
export default {
name: 'MyPostList',
appName: '我的帖子',
data() {
return {
currIndex: 0,
totalInfo: {},
list: [],
isMore: false,
current: 1
}
},
computed: {
...mapState(['user', 'token']),
isAuth: v => !!v.user.areaId
},
onLoad() {
this.getTopicList()
this.getInfo()
},
methods: {
getTopicList() {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
current: 1,
size: 1000,
status: 1
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
this.getMyPublish()
}
})
},
getInfo() {
this.$instance.post(`/app/appneighborhoodassistance/wechatInfo`).then(res => {
if (res.code === 0) {
this.totalInfo = res.data
}
})
},
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
remove(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定删除该帖子吗?'
}).then(() => {
this.$instance.post(`/app/appneighborhoodassistance/delete?id=${id}`).then(res => {
if (res.code === 0) {
this.$toast('删除成功!')
this.getInfo()
uni.$emit('updateList')
this.changeTab(this.currIndex)
}
})
}).catch(() => {
})
},
removeLike(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定取消点赞吗?'
}).then(() => {
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${id}`).then(res => {
if (res.code === 0) {
this.$toast('删除成功!')
this.getInfo()
uni.$emit('updateList')
this.changeTab(this.currIndex)
}
})
}).catch(() => 0)
},
removeComment(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定删除吗?'
}).then(() => {
this.$instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code === 0) {
this.$toast('删除成功!')
this.getInfo()
uni.$emit('updateList')
this.changeTab(this.currIndex)
}
})
}).catch(() => {
})
},
changeTab(index) {
this.currIndex = index
this.isMore = false
this.current = 1
this.$nextTick(() => {
if (this.currIndex === 0) {
this.getMyPublish()
} else if (this.currIndex === 1) {
this.myPraiseList()
} else {
this.getMyCommentList()
}
})
},
getMyPublish() {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
listType: 0,
createUserId: this.user.id
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
files: e.files.filter((v, index) => index < 3),
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,
files: e.files.filter((v, index) => index < 3),
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
},
getMyCommentList() {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
listType: 2
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
files: e.files.filter((v, index) => index < 3),
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,
files: e.files.filter((v, index) => index < 3),
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
},
myPraiseList() {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
params: {
current: this.current,
size: 10,
listType: 1
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => {
return {
...e,
files: e.files.filter((v, index) => index < 3),
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,
files: e.files.filter((v, index) => index < 3),
topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : ''
}
})
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
},
handleAdd() {
if (this.isAuth) {
this.$linkTo('./Add')
} else {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo')
}).catch(() => 0)
}
}
},
onReachBottom() {
if (this.currIndex === 0) {
this.getMyPublish()
} else if (this.currIndex === 1) {
this.myPraiseList()
} else {
this.getMyCommentList()
}
}
}
</script>
<style scoped lang="scss">
.MyPostList {
padding-bottom: 40px;
box-sizing: border-box;
* {
box-sizing: border-box;
}
.userinfo {
position: sticky;
top: 0px;
margin: 0 0 24px;
border-top: 24px solid #eee;
background: #fff;
z-index: 202303211143;
.top {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32px 56px;
border-bottom: 1px solid #eee;
.left {
display: flex;
align-items: center;
image {
width: 96px;
height: 96px;
margin-right: 16px;
border-radius: 50%;
}
h2 {
color: #333333;
font-size: 34px;
font-weight: 600;
}
}
.add-btn {
width: 132px;
height: 56px;
line-height: 56px;
text-align: center;
font-size: 30px;
color: #fff;
border-radius: 26px;
background: #2D7DFF;
}
}
.bottom {
display: flex;
height: 120px;
align-items: center;
box-sizing: border-box;
.bottom-item {
display: flex;
position: relative;
align-items: center;
justify-content: center;
flex-direction: column;
flex: 1;
text-align: center;
height: 100%;
&.active:after {
position: absolute;
bottom: 0;
left: 50%;
z-index: 1;
width: 40px;
height: 6px;
border-radius: 3px;
background: #2D7DFF;
transform: translateX(-50%);
content: ' ';
}
span {
font-size: 24px;
color: #999;
}
h2 {
line-height: 48px;
font-size: 34px;
color: #333;
}
}
}
}
.comment {
padding: 0 32px;
.comment-item {
margin-bottom: 24px;
padding: 28px 24px;
border-radius: 18px;
background: #fff;
.comment-top {
display: flex;
align-items: center;
justify-content: space-between;
span {
font-size: 28px;
color: #333;
}
image {
width: 40px;
height: 40px;
}
}
& > p {
line-height: 1.3;
margin: 26px 0 20px;
font-size: 28px;
color: #666666;
}
.bottom {
padding: 24px;
background: #f6f6f6;
}
.item-top {
display: flex;
align-items: center;
.avatar {
width: 96px;
height: 96px;
margin-right: 16px;
border-radius: 50%;
}
.right {
flex: 1;
}
.remove {
width: 40px;
height: 40px;
}
h3 {
color: #333333;
text-align: left;
font-size: 34px;
font-weight: 500;
}
span {
margin-top: 12px;
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
.item-content {
margin: 16px 0;
line-height: 1.3;
text-align: justify;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
}
}
.body-list {
.item {
margin: 0 32px 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;
.avatar {
width: 96px;
height: 96px;
margin-right: 16px;
border-radius: 50%;
}
.right {
flex: 1;
}
.remove {
width: 40px;
height: 40px;
}
h3 {
color: #333333;
text-align: left;
font-size: 34px;
font-weight: 500;
}
span {
margin-top: 12px;
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
& > p {
margin: 12px 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 {
margin: 16px 0;
line-height: 1.3;
text-align: justify;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
}
}
.row2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
</style>

View File

@@ -0,0 +1,89 @@
<template>
<div class="Topic">
<div
class="Topic-item"
v-for="(item, index) in list"
:key="index"
hover-class="text-hover"
@click="$linkTo('./TopicDetail?themeId=' + item.id + '&name=' + item.title)">
<h2>#{{item.title}}</h2>
<span>去看看</span>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
export default {
name: 'Topic',
appName: '更多话题',
data () {
return {
current: 1,
pages: 2,
list: []
}
},
onLoad() {
this.getList()
},
methods: {
getList() {
if (this.current > this.pages) return
this.$instance.post(`/app/appneighborhoodassistancetheme/list?current=${this.current}&size=20&status=1`).then(res => {
if (res.code === 0 && res.data) {
const list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.pages = Math.ceil(res.data.total / 10)
this.list = list
}
})
},
toTopicDetail(id) {
uni.navigateTo({url: `./TopicDetail?id=${id}`})
}
},
onReachBottom() {
this.current ++
this.getList()
}
}
</script>
<style scoped lang="scss">
.Topic {
min-height: 100vh;
background: #fff;
padding-bottom: 40px;
border-top: 24px solid #f4f6fa;
box-sizing: border-box;
div {
box-sizing: border-box;
}
.Topic-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 32px;
h2 {
font-size: 30px;
color: #333333;
}
span {
width: 126px;
height: 52px;
line-height: 52px;
text-align: center;
border-radius: 26px;
border: 2px solid #2d7dffff;
font-size: 24px;
color: #2D7DFF;
}
}
}
</style>

View File

@@ -0,0 +1,336 @@
<template>
<div class="TopicDetail">
<h2>#{{ name }}</h2>
<p>贴子{{ total }}</p>
<div class="tab">
<span @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">广场</span>
<!-- <span @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">社区</span> -->
</div>
<div class="AppCircle-list">
<div
class="item"
v-for="(item, index) in list"
:key="index"
@click="$linkTo('./Detail?isFrom=topic&id=' + item.id + '&name=' + name + '&themeId=' + themeId)">
<div class="item-top">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
<div class="right">
<h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div>
</div>
<div class="item-content">
<text v-if="item.integralTaskId">{{ item.integralTaskInfo.detail }}</text>
<text v-else>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" hover-stop-propagation @click.stop="previewImage(e.url, item.files)" v-for="(e, i) in item.files" :key="i" :src="e.url" />
</div>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<button
hover-stop-propagation
@click.stop=""
open-type="share"
:data-content="item.content"
:data-themeid="item.themeId"
:data-id="item.id"
:data-name="item.topicName">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<i>{{ item.sharedCount }}</i>
</button>
<div hover-stop-propagation @click.stop="reciate(item.id, item.appreciateStatus)">
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" />
<i>{{ item.appreciateCount }}</i>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" />
<i>{{ item.commentCount }}</i>
</div>
</div>
</div>
<AiEmpty v-if="!list.length"></AiEmpty>
</div>
<AiLogin ref="login"/>
</div>
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
name: 'TopicDetail',
appName: '话题详情',
data () {
return {
currIndex: 0,
name: '',
themeId: '',
list: [],
isMore: false,
current: 1,
total: 0
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad (query) {
this.themeId = query.themeId
this.name = query.name
this.$nextTick(() => {
this.getList()
})
},
methods: {
...mapActions(['autoLogin', 'authCheck']),
changeTab (index) {
this.currIndex = index
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getList()
})
},
reciate (id, appreciateStatus) {
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${id}`).then(res => {
if (res.code === 0) {
this.$toast(appreciateStatus ? '取消点赞' : '点赞成功')
this.changeTab(this.currIndex)
}
})
},
previewImage (url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
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()
},
onShareAppMessage (e) {
this.$instance.post(`/app/appneighborhoodassistance/share?id=${e.target.dataset.id}`).then(res => {
if (res.code === 0) {
this.changeTab(this.currIndex)
}
})
return {
title: e.target.dataset.content,
path: `/mods/AppCircle/Detail?id=${e.target.dataset.id}&themeId=${e.target.dataset.themeid}&name=${e.target.dataset.name}`
}
}
}
</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 {
margin-top: 12px;
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
flex-wrap: wrap;
image {
height: 208px;
width: 33.33%;
padding-right: 12px;
margin-bottom: 12px;
box-sizing: border-box;
&:nth-of-type(3n) {
padding-right: 0;
}
}
}
& > p {
margin: 12px 0;
font-size: 28px;
color: #333333;
}
.item-bottom {
display: flex;
align-items: center;
height: 88px;
border-top: 1px solid #eeeeee;
div, button {
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 {
margin: 16px 0;
line-height: 1.3;
text-align: justify;
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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB