功能:完善评论测试与优惠券最优选择
This commit is contained in:
@@ -209,6 +209,7 @@ import {
|
||||
HomeOutlined,
|
||||
IdcardOutlined,
|
||||
LogoutOutlined,
|
||||
MessageOutlined,
|
||||
MenuFoldOutlined,
|
||||
MenuOutlined,
|
||||
MenuUnfoldOutlined,
|
||||
@@ -258,6 +259,7 @@ const menuItems: AdminMenuItem[] = [
|
||||
{ key: '/admin/users', icon: UserOutlined, label: '用户管理', permissionCode: 'user:view' },
|
||||
{ key: '/admin/products', icon: ShopOutlined, label: '作品管理', permissionCode: 'product:view' },
|
||||
{ key: '/admin/coupons', icon: GiftOutlined, label: '优惠券管理', permissionCode: 'coupon:view' },
|
||||
{ key: '/admin/comments', icon: MessageOutlined, label: '评论管理', permissionCode: 'comment:view' },
|
||||
{ key: '/admin/shops', icon: HomeOutlined, label: '店铺管理', permissionCode: 'shop:view' },
|
||||
{ key: '/admin/permissions', icon: SafetyCertificateOutlined, label: '权限管理', permissionCode: 'permission:view' },
|
||||
{ key: '/admin/tags', icon: TagOutlined, label: '标签管理', permissionCode: 'tag:view' },
|
||||
@@ -313,6 +315,7 @@ const activeMobileTab = computed(() => {
|
||||
route.path.startsWith('/admin/users') ||
|
||||
route.path.startsWith('/admin/products') ||
|
||||
route.path.startsWith('/admin/coupons') ||
|
||||
route.path.startsWith('/admin/comments') ||
|
||||
route.path.startsWith('/admin/shops') ||
|
||||
route.path.startsWith('/admin/permissions') ||
|
||||
route.path.startsWith('/admin/tags') ||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="comments-page">
|
||||
<header class="page-head">
|
||||
<div>
|
||||
<h2>评论管理</h2>
|
||||
<p>查看作品评论与回复,删除不合规内容。</p>
|
||||
</div>
|
||||
<a-input-search v-model:value="keyword" class="search" allow-clear placeholder="搜索评论内容" @search="loadComments" />
|
||||
</header>
|
||||
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="comments"
|
||||
:loading="loading"
|
||||
:pagination="{ pageSize: 10 }"
|
||||
row-key="id"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'commentContent'">
|
||||
<div class="comment-cell">
|
||||
<strong>{{ record.commentContent }}</strong>
|
||||
<span v-if="record.parentCommentContent">回复:{{ record.parentCommentContent }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<a-popconfirm title="确认删除这条评论?" ok-text="删除" cancel-text="取消" @confirm="deleteComment(record.id)">
|
||||
<a-button danger type="link">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { adminCommentApi, type AdminCommentVO } from '@/api/admin'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
const loading = ref(false)
|
||||
const keyword = ref('')
|
||||
const comments = ref<AdminCommentVO[]>([])
|
||||
|
||||
const columns = [
|
||||
{ title: '评论内容', dataIndex: 'commentContent', key: 'commentContent' },
|
||||
{ title: '用户', dataIndex: 'userNickname', key: 'userNickname', width: 140 },
|
||||
{ title: '作品', dataIndex: 'productTitle', key: 'productTitle', width: 180 },
|
||||
{ title: '门店', dataIndex: 'shopName', key: 'shopName', width: 160 },
|
||||
{ title: '时间', dataIndex: 'createTime', key: 'createTime', width: 180 },
|
||||
{ title: '操作', key: 'action', width: 100 }
|
||||
]
|
||||
|
||||
const loadComments = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
comments.value = await adminCommentApi.listComments({ keyword: keyword.value || undefined })
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '评论加载失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const deleteComment = async (id: IdType) => {
|
||||
await adminCommentApi.deleteComment(id)
|
||||
message.success('评论已删除')
|
||||
await loadComments()
|
||||
}
|
||||
|
||||
onMounted(loadComments)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.comments-page {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.page-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.page-head h2 {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
color: #20232a;
|
||||
}
|
||||
|
||||
.page-head p {
|
||||
margin: 6px 0 0;
|
||||
color: #687385;
|
||||
}
|
||||
|
||||
.search {
|
||||
width: min(360px, 100%);
|
||||
}
|
||||
|
||||
.comment-cell {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.comment-cell strong {
|
||||
color: #20232a;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.comment-cell span {
|
||||
color: #7b8494;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user