|
|
@@ -1,8 +1,6 @@
|
|
|
<template>
|
|
|
<div class="tab7">
|
|
|
- <div class="insideTop">
|
|
|
- 留言审核
|
|
|
- </div>
|
|
|
+ <div class="insideTop">留言审核</div>
|
|
|
<div class="obstruct"></div>
|
|
|
<!-- 主要内容 -->
|
|
|
<div class="conten">
|
|
|
@@ -26,19 +24,19 @@
|
|
|
></el-input>
|
|
|
<span class="search_k">状态:</span>
|
|
|
<el-select
|
|
|
- v-model="formData.type"
|
|
|
+ v-model="formData.status"
|
|
|
placeholder="请选择"
|
|
|
style="width: 240px"
|
|
|
>
|
|
|
<el-option label="全部" value=""></el-option>
|
|
|
- <el-option label="待审核" value="1"></el-option>
|
|
|
- <el-option label="审核通过" value="time"></el-option>
|
|
|
- <el-option label="审核不通过" value="number"></el-option>
|
|
|
+ <el-option label="待审核" :value="0"></el-option>
|
|
|
+ <el-option label="审核通过" :value="2"></el-option>
|
|
|
+ <el-option label="审核不通过" :value="1"></el-option>
|
|
|
</el-select>
|
|
|
<!-- 右侧按钮 -->
|
|
|
<div class="search_btn">
|
|
|
- <el-button type="primary">查 询</el-button>
|
|
|
- <el-button>重 置</el-button>
|
|
|
+ <el-button type="primary" @click="searchBtn">查 询</el-button>
|
|
|
+ <el-button @click="resetBtn">重 置</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 表格 -->
|
|
|
@@ -51,21 +49,31 @@
|
|
|
}}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="留言内容">
|
|
|
- <template #default="{ row }">
|
|
|
- <span class="table_name" :title="row.name1">{{ row.name1 }}</span>
|
|
|
- </template>
|
|
|
+ <el-table-column label="留言内容" prop="content"></el-table-column>
|
|
|
+ <el-table-column prop="creatorName" label="发布人" width="200">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name2" label="发布人" width="180"> </el-table-column>
|
|
|
- <el-table-column prop="name2" label="发布时间" width="180">
|
|
|
+ <el-table-column prop="createTime" label="发布时间" width="200">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name2" label="审核状态" width="180">
|
|
|
+ <el-table-column prop="status" label="审核状态" width="150">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="180">
|
|
|
- <template #default>
|
|
|
- <el-button type="text" style="color: #254e91;">通过</el-button>
|
|
|
- <el-button type="text">不通过</el-button>
|
|
|
- <el-button type="text">删除</el-button>
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button
|
|
|
+ v-if="row.status !== '通过'"
|
|
|
+ type="text"
|
|
|
+ style="color: #254e91"
|
|
|
+ @click="passMes(2, row.id)"
|
|
|
+ >通过</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" @click="passMes(1, row.id)" v-if="row.status !== '不通过'"
|
|
|
+ >不通过</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="delMes(row.id)"
|
|
|
+ v-if="row.status !== '通过'"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -86,36 +94,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { commentList, commentAudit, commentRemove } from '@/apis/tab7'
|
|
|
export default {
|
|
|
name: 'tab7',
|
|
|
components: {},
|
|
|
data () {
|
|
|
// 这里存放数据
|
|
|
return {
|
|
|
- total: 100,
|
|
|
+ total: 0,
|
|
|
time: '',
|
|
|
formData: {
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
pageNum: 1,
|
|
|
- pageSize: 9999,
|
|
|
+ pageSize: 10,
|
|
|
searchKey: '',
|
|
|
- type: 'time'
|
|
|
+ status: ''
|
|
|
},
|
|
|
- tableData: [
|
|
|
- { name1: '1231231231231231231123123123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false },
|
|
|
- { name1: '123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false },
|
|
|
- { name1: '123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false },
|
|
|
- { name1: '123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false },
|
|
|
- { name1: '123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false },
|
|
|
- { name1: '123', name2: '2013-12-26 13:33:23', name3: true },
|
|
|
- { name1: '123', name2: '123', name3: false }
|
|
|
- ]
|
|
|
+ tableData: []
|
|
|
}
|
|
|
},
|
|
|
// 监听属性 类似于data概念
|
|
|
@@ -128,18 +124,68 @@ export default {
|
|
|
},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
+ // 点击通过和不通过
|
|
|
+ async passMes (status, id) {
|
|
|
+ const res = await commentAudit(status, id)
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ this.commentList(this.formData)
|
|
|
+ } else this.$message.warning(res.msg)
|
|
|
+ },
|
|
|
+ // 点击删除
|
|
|
+ delMes (id) {
|
|
|
+ this.$confirm('确定删除吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ const res = await commentRemove(id)
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.commentList(this.formData)
|
|
|
+ } else this.$message.warning(res.msg)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message.info('已取消')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 点击重置
|
|
|
+ resetBtn () {
|
|
|
+ this.formData.searchKey = ''
|
|
|
+ this.formData.status = ''
|
|
|
+ this.time = ''
|
|
|
+ this.formData.pageNum = 1
|
|
|
+ this.formData.startTime = this.formData.endTime = ''
|
|
|
+ this.commentList(this.formData)
|
|
|
+ },
|
|
|
+ // 点击查询
|
|
|
+ searchBtn () {
|
|
|
+ this.formData.pageNum = 1
|
|
|
+ this.commentList(this.formData)
|
|
|
+ },
|
|
|
+ // 封装获取留言列表的方法
|
|
|
+ async commentList (data) {
|
|
|
+ const res = await commentList(data)
|
|
|
+ this.total = res.data.total
|
|
|
+ res.data.records.forEach((v) => {
|
|
|
+ if (v.status === 0) v.status = '待审核'
|
|
|
+ else if (v.status === 1) v.status = '不通过'
|
|
|
+ else if (v.status === 2) v.status = '通过'
|
|
|
+ })
|
|
|
+ this.tableData = res.data.records
|
|
|
+ },
|
|
|
// 分页器方法
|
|
|
currentChange (val) {
|
|
|
// console.log('当前页改变了', val)
|
|
|
+ this.formData.pageNum = val
|
|
|
+ this.commentList(this.formData)
|
|
|
},
|
|
|
sizeChange (val) {
|
|
|
// console.log('条数改变了', val)
|
|
|
- }, // 点击查看
|
|
|
- lookGood (id) {
|
|
|
- this.$router.push({
|
|
|
- path: '/layout/tab7Look'
|
|
|
- // query: { conLeftId: this.conLeft }
|
|
|
- })
|
|
|
+ this.formData.pageNum = 1
|
|
|
+ this.formData.pageSize = val
|
|
|
+ this.commentList(this.formData)
|
|
|
},
|
|
|
// 时间处理----------------
|
|
|
handleSelect (e) {
|
|
|
@@ -176,7 +222,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created () {},
|
|
|
+ created () {
|
|
|
+ // 调用获取列表方法
|
|
|
+ this.commentList(this.formData)
|
|
|
+ },
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted () {},
|
|
|
beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
@@ -191,7 +240,7 @@ export default {
|
|
|
<style lang='less' scoped>
|
|
|
.tab7 {
|
|
|
height: 100%;
|
|
|
- .insideTop .add{
|
|
|
+ .insideTop .add {
|
|
|
right: 55px;
|
|
|
}
|
|
|
.conten {
|