新闻中心 新增评论模块

This commit is contained in:
yanran200730
2023-02-20 10:13:27 +08:00
parent a1c7972f9d
commit 38a6ace8d2
3 changed files with 139 additions and 2 deletions

View File

@@ -13,11 +13,13 @@
</ai-list>
<Add v-else-if="component === 'Add'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Add>
<Detail v-else-if="component === 'Detail'" :moduleName="moduleName" :moduleId="moduleId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Detail>
<Comment v-else-if="component === 'Comment'" :moduleName="moduleName" :moduleId="moduleId" :areaId="areaId" :params="params" :instance="instance" :dict="dict" :permissions="permissions" @change="onChange"></Comment>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
import Comment from './components/Comment'
import Detail from './components/Detail'
import Audit from './components/Audit'
import { mapState } from 'vuex'
@@ -50,6 +52,7 @@
Add,
List,
Audit,
Comment,
Detail
},
@@ -85,7 +88,7 @@
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
this.isShowDetail = true
this.isShowDetail = Comment
}
if (data.type === 'Audit') {
@@ -99,6 +102,12 @@
this.params = data.params
this.isShowDetail = false
}
if (data.type === 'Comment') {
this.component = 'Comment'
this.params = data.params
this.isShowDetail = true
}
},
onAreaChange () {

View File

@@ -0,0 +1,118 @@
<template>
<ai-list class="notice">
<template slot="title">
<ai-title title="评论管理" isShowBottomBorder isShowBack @onBackClick="cancel(false)"></ai-title>
</template>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
</template>
<template #right>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="show(row.id, row.isShow)">{{ row.isShow === '1' ? '隐藏' : '显示' }}</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'Comment',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
search: {
current: 1,
size: 10,
title: '',
status: ''
},
total: 10,
colConfigs: [
{ prop: 'name', label: '微信昵称', align: 'left' },
{ prop: 'content', label: '评论', align: 'center' },
{ prop: 'commentTime', label: '评论时间', align: 'center' }
],
tableData: []
}
},
created () {
this.getList()
},
methods: {
getList() {
this.instance.post(`/app/appcontentcomment/list?contentId=${this.params.id}`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
},
show (id, isShow) {
this.$confirm(isShow === '1' ? '确定隐藏该留言?' : '确定隐藏该留言').then(() => {
this.instance.post(`/app/appcontentcomment/show?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('操作成功')
this.getList()
}
})
})
},
toDetail (id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -36,9 +36,10 @@
</div>
</template>
</el-table-column>
<el-table-column slot="options" width="160px" fixed="right" label="操作" align="center">
<el-table-column slot="options" width="200px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toComment(row.id)">评论管理</el-button>
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
@@ -133,6 +134,15 @@
})
},
toComment(id) {
this.$emit('change', {
type: 'Comment',
params: {
id
}
})
},
toAdd(id) {
this.$emit('change', {
type: 'Add',