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="top">
<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>
</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 class="bottom">
<div class="bottom-item" @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">
@@ -32,32 +32,32 @@
hover-stop-propagation
@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'" />
<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" />
<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.themeId" @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" />
<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" />
<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'" />
<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" />
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i>
</div>
</div>
@@ -71,32 +71,32 @@
hover-stop-propagation
@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'" />
<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" />
<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.themeId" @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" />
<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" />
<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'" />
<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" />
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ item.commentCount }}</i>
</div>
</div>
@@ -106,7 +106,8 @@
<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" />
<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
@@ -114,7 +115,7 @@
hover-class="text-hover"
@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'" />
<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>
@@ -125,7 +126,7 @@
<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" />
<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>
@@ -135,14 +136,14 @@
</div>
</template>
<script>
import {mapState} from "vuex";
import {mapState} from "vuex";
export default {
export default {
name: 'MyPostList',
appName: '我的帖子',
navigationBarBackgroundColor: '#ffffff',
navigationBarTextStyle: 'black',
data () {
data() {
return {
currIndex: 0,
totalInfo: {},
@@ -154,15 +155,16 @@
computed: {
...mapState(['user', 'token']),
isAuth: v => !!v.user.areaId
},
onLoad () {
onLoad() {
this.getTopicList()
this.getInfo()
},
methods: {
getTopicList () {
getTopicList() {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
@@ -177,7 +179,7 @@
})
},
getInfo () {
getInfo() {
this.$instance.post(`/app/appneighborhoodassistance/wechatInfo`).then(res => {
if (res.code === 0) {
this.totalInfo = res.data
@@ -185,14 +187,14 @@
})
},
previewImage (url, files) {
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
remove (id) {
remove(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定删除该帖子吗?'
@@ -205,9 +207,10 @@
this.changeTab(this.currIndex)
}
})
}).catch(() => {})
}).catch(() => {
})
},
removeLike(id){
removeLike(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定取消点赞吗?'
@@ -222,7 +225,7 @@
})
}).catch(() => 0)
},
removeComment (id) {
removeComment(id) {
this.$dialog.confirm({
title: '温馨提示',
content: '您确定删除吗?'
@@ -235,9 +238,10 @@
this.changeTab(this.currIndex)
}
})
}).catch(() => {})
}).catch(() => {
})
},
changeTab (index) {
changeTab(index) {
this.currIndex = index
this.isMore = false
this.current = 1
@@ -253,7 +257,7 @@
})
},
getMyPublish () {
getMyPublish() {
if (this.isMore) return
this.$loading()
@@ -296,7 +300,7 @@
})
},
getMyCommentList () {
getMyCommentList() {
if (this.isMore) return
this.$loading()
@@ -340,7 +344,7 @@
})
},
myPraiseList () {
myPraiseList() {
if (this.isMore) return
this.$loading()
@@ -382,10 +386,22 @@
}).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 () {
onReachBottom() {
if (this.currIndex === 0) {
this.getMyPublish()
} else if (this.currIndex === 1) {
@@ -394,11 +410,11 @@
this.getMyCommentList()
}
}
}
}
</script>
<style scoped lang="scss">
.MyPostList {
.MyPostList {
padding-bottom: 40px;
box-sizing: border-box;
@@ -720,5 +736,5 @@
}
}
}
}
}
</style>