Audit.vue
6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<template>
<el-card class="account-container">
<div class="experience">
<div class="control">
<p class="control_name">解忧杂货铺-审核中心</p>
</div>
<div class="btn_box">
<span :class="showTab1?'active':''" @click="handleChangeTab(true)">待审核问题</span>
<span :class="!showTab1?'active':''" @click="handleChangeTab(false)">待审核回复</span>
</div>
<!-- 待审核问题表 -->
<el-table v-loading="loading" :data="tableData" v-if="showTab1&&tableData.length>0">
<el-table-column label="时间">
<template #default="props">
<p class="time">{{formatTime(props.row.createTime)}}</p>
</template>
</el-table-column>
<el-table-column label="问题" min-width="220">
<template #default="props">
<p class="title">{{props.row.messageTitle}}</p>
<p class="content">{{props.row.messageContent}}</p>
</template>
</el-table-column>
<el-table-column label="操作" min-width="180" align="center">
<template #default="scope">
<el-button type="primary" @click="handlePass(scope.row)">通过</el-button>
<el-button type="danger" @click="handleNoPass(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<!-- 待审核评论表 -->
<el-table v-loading="loading" :data="tableData" v-if="!showTab1&&tableData.length>0">
<el-table-column label="时间">
<template #default="props">
<p class="time">{{formatTime(props.row.createTime)}}</p>
</template>
</el-table-column>
<el-table-column label="回复" min-width="220">
<template #default="props">
<p class="title">{{props.row.replyContent}}</p>
<p class="content">所属问题:{{props.row.messageTitle}}</p>
</template>
</el-table-column>
<el-table-column label="操作" min-width="180" align="center">
<template #default="scope">
<el-button type="primary" @click="handleReplyPass(scope.row)">通过</el-button>
<el-button type="danger" @click="handleReplyNoPass(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<el-empty description="暂无待审核内容" v-if="tableData.length==0"></el-empty>
</div>
</el-card>
</template>
<script>
import { nextTick, onMounted, reactive, ref, toRefs } from 'vue'
import { useStore } from 'vuex'
import { ElMessage } from 'element-plus'
import { formatTime } from '@/utils'
import axios from '@/utils/axios'
export default {
name: 'ExperienceAudit',
setup () {
const formRef = ref(null)
const store = useStore()
const state = reactive({
showTab1: true,//显示问题列表或回复列表
search: '',
tableData: [],
total: 0,
loading: false,
UserId: store.state.userInfo?.userId,
userType: store.state.userInfo?.userType,
})
onMounted(() => {
if (!state.UserId) return;
getPostMessage()
})
// 经验分享
const getPostMessage = () => {
state.loading = true
axios.post('/Exchange/PostMessage/List', {
"MessageTitle": state.search,
"CheckStatus": 1,
// "UserId": state.showAll ? '' : state.UserId,//显示全部userid传空
"PageIndex": 1,
"PageSize": 999
}).then(res => {
// console.log('经验分享:', res)
state.tableData = res.data
state.total = res.count
state.loading = false
}).catch(err => {
console.log('err', err)
})
}
// 问题回复列表
const getReply = () => {
state.loading = true
axios.post('/Exchange/Reply/List/All', {
"PostId": 0,
"CheckStatus": 1,
"PageIndex": 1,
"PageSize": 1000
}).then(res => {
console.log('问题回复列表:', res.data)
state.tableData = res.data
state.total = res.count
state.loading = false
}).catch(err => {
console.log('err', err)
})
}
// 显示全部或者我的问题
const handleChangeTab = (boo) => {
state.showTab1 = boo
if (boo) {
getPostMessage()
} else {
getReply()
}
}
// 问题审核通过
const handlePass = (e) => {
axios.put(`/Exchange/PostMessage/Check?id=${e.id}&status=2`).then(res => {
// console.log('经验分享:', res)
ElMessage.success('审核成功')
getPostMessage()
}).catch(err => {
console.log('err', err)
})
}
// 问题审核不通过
const handleNoPass = (e) => {
axios.put(`/Exchange/PostMessage/Check?id=${e.id}&status=3`).then(res => {
// console.log('经验分享:', res)
ElMessage.success('审核成功')
getPostMessage()
}).catch(err => {
console.log('err', err)
})
}
// 回复审核通过
const handleReplyPass = (e) => {
axios.put(`/Exchange/Reply/Check?id=${e.id}&status=2`).then(res => {
// console.log('经验分享:', res)
ElMessage.success('审核成功')
getReply()
}).catch(err => {
console.log('err', err)
})
}
// 回复审核不通过
const handleReplyNoPass = (e) => {
axios.put(`/Exchange/Reply/Check?id=${e.id}&status=3`).then(res => {
// console.log('经验分享:', res)
ElMessage.success('审核成功')
getReply()
}).catch(err => {
console.log('err', err)
})
}
return {
...toRefs(state),
formatTime,
handleChangeTab,
handlePass,
handleNoPass,
handleReplyPass,
handleReplyNoPass
}
}
}
</script>
<style lang="scss" scoped>
.control {
display: flex;
align-items: center;
justify-content: space-between;
.control_name {
font-size: 23px;
font-weight: bold;
}
.el-input {
width: 300px;
}
}
.btn_box {
padding: 20px 0;
span {
cursor: pointer;
padding: 10px;
margin-right: 50px;
font-size: 16px;
}
.active {
color: #3a84ff;
}
}
.experience {
background: #fff;
padding: 0 20px;
padding-bottom: 40px;
.time {
color: #999;
}
.title {
font-size: 23px;
color: #333;
}
.content {
font-size: 16px;
color: #999;
margin-top: 16px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.reply {
color: #3a84ff;
font-size: 16px;
text-align: right;
}
.del {
color: rgb(249, 62, 62);
}
}
</style>