This commit is contained in:
yanran200730
2023-03-28 17:01:52 +08:00
parent f497a3a658
commit 4e14121dbd
16 changed files with 3294 additions and 0 deletions

View File

@@ -0,0 +1,294 @@
<template>
<ai-detail class="detail">
<template slot="title">
<ai-title title="帖子详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="帖子信息">
<template #content>
<div class="talk-info">
<div class="user">
<img :src="info.createUserAvatar" alt="">
<div class="info">
<h2>{{info.createUserName}}</h2>
<div class="time-flex">
<span class="area-name">{{info.publishDepartName}}</span>
<span>{{info.createTime}}</span>
</div>
</div>
</div>
<div class="content">
<span v-if="info.themeId">#{{info.themeInfo.title}}</span>{{info.content}}
</div>
<ai-uploader :instance="instance" disabled v-model="info.files">
</ai-uploader>
</div>
</template>
</ai-card>
<ai-card title="评论信息">
<template #content>
<div class="comment-list" v-if="commontList.length">
<div class="title">评论</div>
<div class="item" v-for="(item, index) in commontList" :key="index">
<div class="user">
<img :src="item.createUserAvatar" alt="">
<div class="info-flex">
<h2>{{item.createUserName}}</h2>
<span>{{item.createTime}}</span>
</div>
</div>
<div class="content-flex">
<p>{{item.content}}</p>
<div @click="delCommontOrReply('评论', item.id)">删除</div>
</div>
<div class="reply-list" v-if="item.replyList && item.replyList.length && item.isShowReply">
<div class="reply-item" v-for="(reply, indexs) in item.replyList" :key="indexs">
<div class="reply-user">
<img :src="item.createUserAvatar" alt="">
<div class="reply-name">
<span>{{reply.createUserName}}</span>回复<span>{{item.createUserName}}</span>
</div>
<span class="reply-time">{{reply.createTime}}</span>
</div>
<div class="content-flex">
<p>{{reply.content}}</p>
<div @click="delCommontOrReply('回复', reply.id)">删除</div>
</div>
</div>
</div>
<div class="reply-more" @click="item.isShowReply = !item.isShowReply" :class="[item.isShowReply ? 'active' : '']">
<span class="line"></span>{{item.isShowReply ? '收起' : `展开${item.replyList.length}条回复`}}
<i class="el-icon-arrow-down"></i>
</div>
</div>
</div>
<ai-empty v-else>暂无评论</ai-empty>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
commontList: [],
info: {},
}
},
computed: {
getAvatar(row){
return row.avatar||row.photo||'https://cdn.cunwuyun.cn/dvcp/h5/defaultAvatar.png'
}
},
created () {
this.getInfo()
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appneighborhoodassistance/commontList?id=${this.params.id}&size=100`).then(res => {
if (res.code == 0) {
res.data.records.map((item) => {
item.isShowReply = false
})
this.commontList = res.data.records
}
})
},
getInfo () {
this.instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${this.params.id}`).then(res => {
if (res.code == 0) {
if (res.data) {
this.info = res.data
}
}
})
},
cancel () {
this.$emit('change', {
type: 'List',
isRefresh: true
})
},
delCommontOrReply(text, id) {
this.$confirm(`确定删除该${text}`).then(() => {
this.instance.post(`/app/appneighborhoodassistance/delComment?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
}
}
</script>
<style scoped lang="scss">
.detail {
.talk-info {
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info {
width: calc(100% - 76px);
h2 {
font-size: 20px;
line-height: 30px;
font-weight: 400;
}
.time-flex {
display: flex;
justify-content: space-between;
color: #999;
font-size: 14px;
line-height: 30px;
.area-name {
color: #666;
}
}
}
}
.content {
font-size: 16px;
line-height: 32px;
word-break: break-all;
span {
color: #26f;
}
}
}
.comment-list {
.title {
color: #333;
font-size: 16px;
font-weight: 700;
line-height: 40px;
margin-bottom: 8px;
}
.item {
border-bottom: 1px solid #ddd;
padding-bottom: 16px;
.user {
display: flex;
margin-bottom: 8px;
img {
width: 60px;
height: 60px;
margin-right: 16px;
border-radius: 50%;
}
.info-flex {
width: calc(100% - 76px);
display: flex;
justify-content: space-between;
line-height: 60px;
h2 {
font-size: 20px;
font-weight: 400;
}
span {
color: #999;
font-size: 14px;
}
}
}
.content-flex {
display: flex;
font-size: 16px;
line-height: 30px;
margin-bottom: 8px;
padding-left: 76px;
p {
width: calc(100% - 50px);
word-break: break-all;
}
div {
color: #26f;
width: 50px;
text-align: right;
cursor: pointer;
}
}
.reply-list {
padding-left: 100px;
.reply-item {
margin-bottom: 8px;
.reply-user {
font-size: 14px;
img {
width: 50px;
height: 50px;
border-radius: 50%;
vertical-align: middle;
}
.reply-name {
display: inline-block;
color: #333;
width: 300px;
span {
display: inline-block;
color: #666;
margin: 0 8px;
}
}
.reply-time {
color: #999;
}
}
.content-flex {
font-size: 14px;
line-height: 24px;
padding-left: 58px;
}
}
}
.reply-more {
font-size: 14px;
line-height: 28px;
color: #333;
.line {
display: inline-block;
width: 120px;
border-top: 1px solid #eee;
vertical-align: middle;
margin-right: 8px;
}
.el-icon-arrow-down {
transition: all ease 0.5s;
transform: rotate(0);
margin-left: 8px;
}
&.active .el-icon-arrow-down {
transform: rotate(180deg);
}
}
}
}
}
</style>