Commit 8397249f authored by 罗林杰's avatar 罗林杰

修改审核问题

parent 9a799160
......@@ -68,10 +68,14 @@ export function exportOpmArticle(query) {
}
// 7. 逻辑删除动态评论
export function deleteComment(businessId) {
export function deleteComment(data) {
return request({
url: '/opmarticle/deleteComment/' + businessId,
method: 'delete'
url: '/opmarticle/deleteComment/' + data.businessId,
method: 'delete',
data: JSON.stringify(data), // 确保数据被正确序列化为 JSON 字符串
headers: {
'Content-Type': 'application/json' // 设置正确的 Content-Type
}
})
}
......
......@@ -108,7 +108,7 @@
@click="handleView(scope.row)"
>详情</el-button>
<el-button
v-show="scope.row.examStatus === '0'"
v-show="scope.row.examStatus === '0' || scope.row.examStatus === '4'"
v-has-permi="['opm:article:update']"
:class="commonField.resetPasClass"
:type="commonField.typeParent"
......@@ -361,6 +361,7 @@ export default {
// pagination
total: 0,
fullscreenLoading: false,
articleId: '',
rules: {}
}
},
......@@ -506,17 +507,25 @@ export default {
/** 审核按钮操作 */
handleExam(row) {
this.reset()
const id = row.businessId
getOpmArticle(id).then(async response => {
this.articleId = row.businessId
this.getDetail()
this.title = '动态审核'
this.open = true
this.isEdit = true
},
getDetail() {
getOpmArticle(this.articleId).then(async response => {
this.form = response.data
// 处理图片
if (response.data.pictureId !== '' && response.data.pictureId !== null) {
const urlArray = JSON.parse(response.data.pictureId)
const url = []
urlArray.id.forEach(item => {
getOssUrl(item).then(imgRes => {
url.push(imgRes.data)
})
if (item !== '' && item !== null) {
getOssUrl(item).then(imgRes => {
url.push(imgRes.data)
})
}
})
this.form.url = url
}
......@@ -528,23 +537,23 @@ export default {
// 处理评论的头像
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.avatarId !== '' && item.avatarId !== null) {
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
})
if (children.avatarId !== '' && children.avatarId !== null) {
getOssUrl(children.avatarId).then(resp => {
children.avatarUrl = resp.data
})
}
})
}
})
}
console.log('this.form', this.form)
this.title = '动态审核'
this.open = true
this.isEdit = true
})
},
/** 删除按钮操作 */
......@@ -595,11 +604,14 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return deleteComment(row.businessId)
const form = {
businessId: row.businessId,
parentId: row.parentId,
articleId: this.articleId
}
return deleteComment(form)
}).then(() => {
// 使用 filter 创建一个新的数组,并重新赋值给 this.form.comments
this.form.articleCommentVOList = this.form.articleCommentVOList.filter(comment => comment.businessId !== row.businessId)
this.$forceUpdate()
this.getDetail()
// 触发视图更新
this.$nextTick(() => {
this.$message({
......@@ -615,15 +627,14 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return deleteComment(row.businessId)
const form = {
businessId: row.businessId,
parentId: row.parentId,
articleId: this.articleId
}
return deleteComment(form)
}).then(() => {
// 遍历找到对应的父评论,并更新其子评论
this.form.articleCommentVOList.forEach(comment => {
if (comment.businessId === row.parentId) {
comment.children = comment.children.filter(reply => reply.businessId !== row.businessId)
}
})
this.$forceUpdate()
this.getDetail()
// 触发视图更新
this.$nextTick(() => {
this.$message({
......
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