Commit ef46a1cd authored by 罗林杰's avatar 罗林杰

修改动态审核,活动

parent d9d5c82e
......@@ -317,7 +317,7 @@ import { parseTime } from '@/utils'
import { getDataCache, setDataCache } from '@/assets/js/filterData'
import { listCmsApplication } from '@/api/contentManagement/application'
import { yesOrNo } from '@/utils/allPageData'
import {getOssUrl} from "@/api/contentManagement/opmArticle";
import { getOssUrl } from '@/api/contentManagement/opmArticle'
export default {
name: 'Index',
// components: {
......@@ -461,9 +461,6 @@ export default {
})
},
created() {
},
mounted: function() {
this.loadData()
},
methods: {
......@@ -570,18 +567,17 @@ export default {
/** 查询活动管理列表 */
loadData() {
this.loading = true
listCmsActivity(this.queryParams).then(
response => {
this.tableData = response.data
// 处理分页数据里的url
this.tableData.forEach(item => {
getOssUrl(item.pictureId).then(imgRes => {
item.url = imgRes.data
})
listCmsActivity(this.queryParams).then(response => {
this.tableData = response.data
// 处理分页数据里的url
this.tableData.forEach(item => {
getOssUrl(item.pictureId).then(imgRes => {
item.url = imgRes.data
})
this.total = response.total
this.loading = false
}
})
this.total = response.total
this.loading = false
}
)
},
/** 查看报名人数 */
......@@ -645,13 +641,19 @@ export default {
type: 'warning'
}).then(function() {
return updatePushStatus(params)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.publishStatus = row.publishStatus === '0' ? '1' : '0'
}).then((res) => {
if (res.code === 200) {
this.$message({
message: text + '成功',
type: 'success'
})
} else {
this.$message({
message: res.message,
type: 'error'
})
}
this.loadData()
})
},
handleExamination(data) {
......
......@@ -138,9 +138,20 @@
<!-- 详情弹窗 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="deviceFormRef" :model="form" label-position="right" label-width="auto">
<div class="item">
<div>
<img class="avatarSize" :src="form.avatarImg" alt="Avatar" mode="aspectFill">
</div>
<div class="center">
<template>
<div>
<span style="font-weight: bold;color: black;font-size: 18px">{{ form.memCode }}</span>
</div>
</template>
</div>
</div>
<el-row :gutter="20">
<el-col :span="24">
<span style="font-size: 20px;font-weight: bold;padding-left: 20px">内容:</span>
<div style="font-size: 15px;padding-left: 20px;padding-bottom: 20px;padding-top: 10px" class="content">{{ form.content }}</div>
</el-col>
<div>
......@@ -171,35 +182,55 @@
</el-col>
</el-row>
</div>
<el-col :span="12">
<span style="font-size: 15px;padding-left: 20px">评论数:{{ form.commentCount }}</span>
</el-col>
<el-col :span="12">
<span style="font-size: 15px;padding-left: 20px">点赞数:{{ form.likeCount }}</span>
</el-col>
<div style="font-size: 12px;color: #8c8c93">
<span>{{ form.createDate }}</span>
</div>
<div class="commentTitle">
<div>
<span>评论区</span>
</div>
<div>
<span>评论 {{ form.commentCount }}</span>
<span class="c-title-segment">|</span>
<span>点赞 {{ form.likeCount }}</span>
</div>
</div>
</el-row>
<div class="commentsSection">
<h3>评论</h3>
<ul v-if="form.articleCommentVOList" class="commentTree">
<li v-for="(comment, index) in form.articleCommentVOList" :key="index" class="commentItem">
<div style="display: flex; justify-content: space-between; align-items: center;" class="commentHeader">
<div style="display: flex; align-items: center;padding-bottom: 10px">
<img :src="comment.avatarUrl" alt="Avatar" class="avatar">
<div style="padding-left: 10px;">
<strong>{{ comment.memCode }}:</strong>
<span style="padding-left: 10px">{{ comment.content }}</span>
<img style="margin-top: -40px" :src="comment.avatarUrl" alt="Avatar" class="avatarSize">
<div style="padding-left: 10px">
<span style="font-size: 15px;font-weight: bold">{{ comment.memCode }}:</span>
<div style="flex: 1;margin-left:5px;margin-top: 10px ">
<template>
<span>{{ comment.content }}</span>
</template>
</div>
<div style="font-size: 10px;color: #8c8c93">
<span>{{ comment.createDate }}</span>
</div>
</div>
</div>
<el-button v-if="isEdit" type="text" @click="deleteComment(comment)">删除</el-button>
</div>
<ul v-if="comment.children && comment.children.length > 0" class="replies">
<li v-for="(reply, replyIndex) in comment.children" :key="replyIndex" class="replyItem">
<ul v-if="comment.childrenCommentList && comment.childrenCommentList.length > 0" class="replies">
<li v-for="(reply, replyIndex) in comment.childrenCommentList" :key="replyIndex" class="replyItem">
<div style="display: flex; justify-content: space-between; align-items: center;" class="commentHeader">
<div style="display: flex; align-items: center;">
<img :src="reply.avatarUrl" alt="Avatar" class="avatar">
<div style="padding-left: 10px;">
<strong>{{ reply.memCode }}:</strong>
<span style="padding-left: 10px">{{ reply.content }}</span>
<img style="margin-top: -40px" :src="reply.avatarUrl" alt="Avatar" class="avatarSize">
<div style="padding-left: 10px">
<span style="font-size: 15px;font-weight: bold">{{ reply.memCode }}:</span>
<div style="flex: 1;margin-left:5px;margin-top: 10px ">
<template>
<span>{{ reply.content }}</span>
</template>
</div>
<div style="font-size: 12px;color: #8c8c93;padding-top: 2px">
<span>{{ reply.createDate }}</span>
</div>
</div>
</div>
<el-button v-if="isEdit" type="text" @click="deleteReply(reply)">删除</el-button>
......@@ -247,10 +278,12 @@ import { getDataCache, setDataCache } from '@/assets/js/filterData'
import {
deleteComment,
delOpmArticle,
getOpmArticle, getOssUrl,
getOpmArticle,
getOssUrl,
listOpmArticle,
updateOpmArticle
} from '@/api/contentManagement/opmArticle'
export default {
name: 'Index',
data() {
......@@ -404,9 +437,9 @@ export default {
handleView(row) {
this.reset()
const id = row.businessId
getOpmArticle(id).then(response => {
getOpmArticle(id).then(async response => {
this.form = response.data
// 处理图片url 将url按逗号分隔成数组
// 处理图片
if (response.data.pictureId !== '' && response.data.pictureId !== null) {
const urlArray = JSON.parse(response.data.pictureId)
const url = []
......@@ -417,19 +450,42 @@ export default {
})
this.form.url = url
}
this.title = this.form.memCode
// 处理头像
if (response.data.avatarId !== '' && response.data.avatarId !== null) {
const avatarRes = await getOssUrl(response.data.avatarId)
this.form.avatarImg = avatarRes.data
}
// 处理评论的头像
if (this.form.articleCommentVOList != null && this.form.articleCommentVOList.length > 0) {
this.form.articleCommentVOList.forEach(item => {
getOssUrl(item.avatarId).then(res => {
item.avatarUrl = res.data
})
// 处理子评论头像
if (item.childrenCommentList.length > 0) {
item.childrenCommentList.forEach(children => {
getOssUrl(children.avatarId).then(resp => {
children.avatarUrl = resp.data
})
})
}
})
}
this.title = '动态详情'
this.open = true
this.isEdit = false
this.getComment()
})
},
getAvatarImg(id) {
return getOssUrl(id)
},
/** 审核按钮操作 */
handleExam(row) {
this.reset()
const id = row.businessId
getOpmArticle(id).then(response => {
getOpmArticle(id).then(async response => {
this.form = response.data
// 处理图片url
// 处理图片
if (response.data.pictureId !== '' && response.data.pictureId !== null) {
const urlArray = JSON.parse(response.data.pictureId)
const url = []
......@@ -440,40 +496,32 @@ export default {
})
this.form.url = url
}
this.title = this.form.memCode
this.open = true
this.isEdit = true
if (this.form.articleCommentVOList !== null && this.form.articleCommentVOList.length > 0) {
this.getComment()
// 处理头像
if (response.data.avatarId !== '' && response.data.avatarId !== null) {
const avatarRes = await getOssUrl(response.data.avatarId)
this.form.avatarImg = avatarRes.data
}
})
},
getComment() {
// 创建一个映射表,用于快速查找每个评论
const commentMap = new Map()
// 保存顶级评论(parentId 为 null 的评论)
const rootComments = []
// 首先填充映射表
this.form.articleCommentVOList.forEach(comment => {
comment.children = [] // 为每个评论添加 children 属性
commentMap.set(comment.businessId, comment)
})
// 再次遍历评论列表,这次是为了设置父子关系
this.form.articleCommentVOList.forEach(comment => {
if (comment.parentId === null) {
// 如果是顶级评论,直接添加到 rootComments
rootComments.push(comment)
} else {
// 否则找到父评论并添加到其 children 数组中
const parentComment = commentMap.get(comment.parentId)
if (parentComment) {
parentComment.children.push(comment)
}
// 处理评论的头像
if (this.form.articleCommentVOList != null && this.form.articleCommentVOList.length > 0) {
await this.form.articleCommentVOList.forEach(item => {
getOssUrl(item.avatarId).then(res => {
item.avatarUrl = res.data
})
// 处理子评论头像
if (item.childrenCommentList.length > 0) {
item.childrenCommentList.forEach(children => {
getOssUrl(children.avatarId).then(resp => {
children.avatarUrl = resp.data
})
})
}
})
}
console.log('this.form', this.form)
this.title = '动态审核'
this.open = true
this.isEdit = true
})
this.form.comments = rootComments
},
/** 删除按钮操作 */
removeCourse(row) {
......@@ -573,20 +621,13 @@ export default {
height: 45px;
}
}
::v-deep.avatar {
width: 200px;
height: 178px;
display: block;
.avatarSize{
width: 32px;
height: 32px;
border-radius: 50%
}
.commentsSection {
margin-top: 20px;
padding: 0 20px;
h3 {
font-size: 20px;
font-weight: bold;
margin-bottom: 10px;
}
.commentTree {
list-style-type: none;
......@@ -655,4 +696,27 @@ export default {
height: 178px;
display: block;
}
.commentTitle{
display: flex;
justify-content: space-between;
padding:20px 25px;
font-size: 16px;
color: rgb(132, 132, 132);
.c-title-segment{
color: rgb(212, 210, 210);
padding-left: 15px;
padding-right: 15px
}
}
.item {
display: flex;
justify-content: space-between;
padding: 5px 0 20px 0;
margin-left: 5px;
margin-right: 10px;
.center {
margin: 10px 10px;
flex: 1;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment