This commit is contained in:
aixianling
2023-03-21 11:41:26 +08:00
parent e098bbbf9d
commit 88cc2e9e9f

View File

@@ -3,10 +3,10 @@
<div class="userinfo"> <div class="userinfo">
<div class="top"> <div class="top">
<div class="left"> <div class="left">
<image :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" /> <image :src="user.avatarUrl || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<h2>{{ user.nickName }}</h2> <h2>{{ user.nickName }}</h2>
</div> </div>
<div class="add-btn" hover-class="text-hover" @click="$linkTo('./Add')">发贴</div> <div class="add-btn" hover-class="text-hover" @click="handleAdd">发贴</div>
</div> </div>
<div class="bottom"> <div class="bottom">
<div class="bottom-item" @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']"> <div class="bottom-item" @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">
@@ -32,32 +32,32 @@
hover-stop-propagation hover-stop-propagation
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)"> @click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top"> <div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" /> <image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right"> <div class="right">
<h3>{{ item.createUserName }}</h3> <h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span> <span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div> </div>
<image hover-stop-propagation @click.stop="remove(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png" /> <image hover-stop-propagation @click.stop="remove(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div> </div>
<div class="item-content"> <div class="item-content">
<span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span> <span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text> <text>{{ item.content }}</text>
</div> </div>
<div class="item-imgs" v-if="item.files.length"> <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" /> <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>
<p>{{ item.createTime }}</p> <p>{{ item.createTime }}</p>
<div class="item-bottom"> <div class="item-bottom">
<div> <div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" /> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ item.sharedCount }}</i> <i>{{ item.sharedCount }}</i>
</div> </div>
<div> <div>
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" /> <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> <i>{{ item.appreciateCount }}</i>
</div> </div>
<div> <div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" /> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i> <i>{{ item.commentCount }}</i>
</div> </div>
</div> </div>
@@ -71,32 +71,32 @@
hover-stop-propagation hover-stop-propagation
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)"> @click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top"> <div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" /> <image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right"> <div class="right">
<h3>{{ item.createUserName }}</h3> <h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span> <span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
</div> </div>
<image hover-stop-propagation @click.stop="removeLike(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png" /> <image hover-stop-propagation @click.stop="removeLike(item.id)" class="remove" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div> </div>
<div class="item-content"> <div class="item-content">
<span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span> <span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text> <text>{{ item.content }}</text>
</div> </div>
<div class="item-imgs" v-if="item.files.length"> <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" /> <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>
<p>{{ item.createTime }}</p> <p>{{ item.createTime }}</p>
<div class="item-bottom"> <div class="item-bottom">
<div> <div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" /> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ item.sharedCount }}</i> <i>{{ item.sharedCount }}</i>
</div> </div>
<div> <div>
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" /> <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> <i>{{ item.appreciateCount }}</i>
</div> </div>
<div> <div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" /> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i> <i>{{ item.commentCount }}</i>
</div> </div>
</div> </div>
@@ -106,7 +106,8 @@
<div class="comment-item" v-for="(item, index) in list" :key="index"> <div class="comment-item" v-for="(item, index) in list" :key="index">
<div class="comment-top"> <div class="comment-top">
<span>{{ item.myComment.createTime }}</span> <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" /> <image hover-stop-propagation @click.stop="removeComment(item.myComment.id)" class="remove"
src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-delete.png"/>
</div> </div>
<p>{{ item.myComment.content }}</p> <p>{{ item.myComment.content }}</p>
<div <div
@@ -114,7 +115,7 @@
hover-class="text-hover" hover-class="text-hover"
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)"> @click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top"> <div class="item-top">
<image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" /> <image class="avatar" :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right"> <div class="right">
<h3>{{ item.createUserName }}</h3> <h3>{{ item.createUserName }}</h3>
<span v-if="item.publishDepartName">{{ item.publishDepartName }}</span> <span v-if="item.publishDepartName">{{ item.publishDepartName }}</span>
@@ -125,7 +126,7 @@
<text>{{ item.content }}</text> <text>{{ item.content }}</text>
</div> </div>
<div class="item-imgs" v-if="item.files.length"> <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" /> <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>
</div> </div>
@@ -135,14 +136,14 @@
</div> </div>
</template> </template>
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
export default { export default {
name: 'MyPostList', name: 'MyPostList',
appName: '我的帖子', appName: '我的帖子',
navigationBarBackgroundColor: '#ffffff', navigationBarBackgroundColor: '#ffffff',
navigationBarTextStyle: 'black', navigationBarTextStyle: 'black',
data () { data() {
return { return {
currIndex: 0, currIndex: 0,
totalInfo: {}, totalInfo: {},
@@ -154,15 +155,16 @@
computed: { computed: {
...mapState(['user', 'token']), ...mapState(['user', 'token']),
isAuth: v => !!v.user.areaId
}, },
onLoad () { onLoad() {
this.getTopicList() this.getTopicList()
this.getInfo() this.getInfo()
}, },
methods: { methods: {
getTopicList () { getTopicList() {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, { this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true, withoutToken: true,
params: { params: {
@@ -177,7 +179,7 @@
}) })
}, },
getInfo () { getInfo() {
this.$instance.post(`/app/appneighborhoodassistance/wechatInfo`).then(res => { this.$instance.post(`/app/appneighborhoodassistance/wechatInfo`).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.totalInfo = res.data this.totalInfo = res.data
@@ -185,14 +187,14 @@
}) })
}, },
previewImage (url, files) { previewImage(url, files) {
uni.previewImage({ uni.previewImage({
current: url, current: url,
urls: files.map(v => v.url) urls: files.map(v => v.url)
}) })
}, },
remove (id) { remove(id) {
this.$dialog.confirm({ this.$dialog.confirm({
title: '温馨提示', title: '温馨提示',
content: '您确定删除该帖子吗?' content: '您确定删除该帖子吗?'
@@ -205,9 +207,10 @@
this.changeTab(this.currIndex) this.changeTab(this.currIndex)
} }
}) })
}).catch(() => {}) }).catch(() => {
})
}, },
removeLike(id){ removeLike(id) {
this.$dialog.confirm({ this.$dialog.confirm({
title: '温馨提示', title: '温馨提示',
content: '您确定取消点赞吗?' content: '您确定取消点赞吗?'
@@ -222,7 +225,7 @@
}) })
}).catch(() => 0) }).catch(() => 0)
}, },
removeComment (id) { removeComment(id) {
this.$dialog.confirm({ this.$dialog.confirm({
title: '温馨提示', title: '温馨提示',
content: '您确定删除吗?' content: '您确定删除吗?'
@@ -235,9 +238,10 @@
this.changeTab(this.currIndex) this.changeTab(this.currIndex)
} }
}) })
}).catch(() => {}) }).catch(() => {
})
}, },
changeTab (index) { changeTab(index) {
this.currIndex = index this.currIndex = index
this.isMore = false this.isMore = false
this.current = 1 this.current = 1
@@ -253,7 +257,7 @@
}) })
}, },
getMyPublish () { getMyPublish() {
if (this.isMore) return if (this.isMore) return
this.$loading() this.$loading()
@@ -296,7 +300,7 @@
}) })
}, },
getMyCommentList () { getMyCommentList() {
if (this.isMore) return if (this.isMore) return
this.$loading() this.$loading()
@@ -340,7 +344,7 @@
}) })
}, },
myPraiseList () { myPraiseList() {
if (this.isMore) return if (this.isMore) return
this.$loading() this.$loading()
@@ -382,10 +386,22 @@
}).catch(() => { }).catch(() => {
this.$hideLoading() this.$hideLoading()
}) })
},
handleAdd() {
if (this.isAuth) {
this.$linkTo('./Add')
} else {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
confirmText: '去认证'
}).then(() => {
this.$linkTo('/pages/AppMine/userInfo')
}).catch(() => 0)
}
} }
}, },
onReachBottom () { onReachBottom() {
if (this.currIndex === 0) { if (this.currIndex === 0) {
this.getMyPublish() this.getMyPublish()
} else if (this.currIndex === 1) { } else if (this.currIndex === 1) {
@@ -394,11 +410,11 @@
this.getMyCommentList() this.getMyCommentList()
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.MyPostList { .MyPostList {
padding-bottom: 40px; padding-bottom: 40px;
box-sizing: border-box; box-sizing: border-box;
@@ -720,5 +736,5 @@
} }
} }
} }
} }
</style> </style>