feat: audit

This commit is contained in:
zzc
2026-06-15 15:37:27 +08:00
parent 2d84ee213c
commit 4fb04c2be8
4 changed files with 211 additions and 5 deletions

View File

@@ -47,3 +47,14 @@ export function toggleEnable(id, isEnabled) {
data: { isEnabled },
})
}
/**
* 评分项审核列表
*/
export function getPendingList(data) {
return request({
url: 'management/api/rating/topicItem/pending/list',
method: 'get',
params: data,
})
}

View File

@@ -118,10 +118,30 @@ export const asyncRoutes = [
],
},
{
path: 'topic-review',
name: 'RatingTopicReviewIndex',
component: () => import('@/views/rating/topicReview/index'),
meta: { title: '话题审核' },
path: '审核',
component: EmptyLayout,
alwaysShow: true,
redirect: 'noRedirect',
name: 'AuditIndex',
meta: {
title: '审核',
icon: 'clover',
permissions: ['admin'],
},
children: [
{
path: 'topic-review',
name: 'RatingTopicReviewIndex',
component: () => import('@/views/rating/topicReview/index'),
meta: { title: '话题审核' },
},
{
path: 'item-review',
name: 'RatingTopicItemReviewIndex',
component: () => import('@/views/rating/topicItemReview/index'),
meta: { title: '评分项审核' },
},
],
},
],
},

View File

@@ -0,0 +1,171 @@
<template>
<div class="rating-topic-item-review-container">
<el-table v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText">
<el-table-column align="left" label="评分项" min-width="260">
<template #default="{ row }">
<div class="item-info-cell">
<el-image v-if="row.avatarUrl" class="item-avatar" :src="getThumbUrl(row.avatarUrl)" />
<div v-else class="item-avatar-placeholder"><i class="el-icon-picture-outline" /></div>
<div class="item-details">
<div class="item-name">{{ row.name || '-' }}</div>
<div class="item-sub" :title="row.topic && row.topic.title ? row.topic.title : row.topicId">
<span class="sub-label">所属话题</span>
<span class="sub-value">{{ row.topic && row.topic.title ? row.topic.title : row.topicId || '-' }}</span>
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="状态" width="100">
<template #default="{ row }">
<el-tag v-if="row.status === 1" type="warning">审核中</el-tag>
<el-tag v-else-if="row.status === 2" type="success">已通过</el-tag>
<el-tag v-else-if="row.status === 3" type="danger">已拒绝</el-tag>
<el-tag v-else-if="row.status === 4" type="info">禁用</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" prop="createdAt" width="160">
<template #default="{ row }">
{{ formatTime(row.createdAt) }}
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="180">
<template #default="{ row }">
<el-button size="mini" type="success" @click="handleReview(row, 2)">通过</el-button>
<el-button size="mini" type="danger" @click="handleReview(row, 3)">拒绝</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
:current-page="queryForm.pageNo"
:layout="layout"
:page-size="queryForm.pageSize"
:total="total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
<review-edit ref="edit" @fetch-data="fetchData" />
</div>
</template>
<script>
import { getPendingList } from '@/api/rating/topicItem'
import { formatTime } from '@/utils'
import { getThumbUrl } from '@/utils/blessing'
import ReviewEdit from '@/views/rating/topicReview/components/ReviewEdit'
export default {
name: 'RatingTopicItemReviewIndex',
components: { ReviewEdit },
data() {
return {
list: [],
listLoading: true,
layout: 'total, sizes, prev, pager, next, jumper',
total: 0,
elementLoadingText: '正在加载...',
queryForm: {
pageNo: 1,
pageSize: 10,
},
}
},
created() {
this.fetchData()
},
methods: {
formatTime,
getThumbUrl,
handleSizeChange(val) {
this.queryForm.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.queryForm.pageNo = val
this.fetchData()
},
async fetchData() {
this.listLoading = true
try {
const { data } = await getPendingList(this.queryForm)
this.list = data.list || []
this.total = data.totalCount || 0
} catch (error) {
console.error(error)
} finally {
this.listLoading = false
}
},
handleReview(row, status) {
this.$refs['edit'].showEdit(row, status, 'topicItem')
},
},
}
</script>
<style scoped>
.rating-topic-item-review-container {
padding: 20px;
}
.item-info-cell {
display: flex;
align-items: center;
}
.item-avatar,
.item-avatar-placeholder {
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 12px;
flex-shrink: 0;
}
.item-avatar-placeholder {
background-color: #f0f2f5;
display: flex;
align-items: center;
justify-content: center;
color: #909399;
font-size: 18px;
}
.item-details {
display: flex;
flex-direction: column;
overflow: hidden;
}
.item-name {
font-weight: bold;
color: #303133;
margin-bottom: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item-sub {
font-size: 12px;
color: #909399;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sub-label {
margin-right: 4px;
}
.sub-value {
color: #606266;
}
</style>

View File

@@ -62,7 +62,11 @@
async save() {
this.saving = true
try {
const { msg } = await reviewTopic(this.form)
const payload = { ...this.form }
if (payload.itemId && !payload.itemmId) {
payload.itemmId = payload.itemId
}
const { msg } = await reviewTopic(payload)
this.$baseMessage(msg || '操作成功', 'success')
this.$emit('fetch-data')
this.close()