This commit is contained in:
2024-07-03 00:22:33 +08:00
parent 73eb288d3c
commit 8a4177cdfc
2 changed files with 22 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<n-space justify="space-between" class="titleWrapper"> <n-space justify="space-between" class="titleWrapper">
<h2 class="title">评论列表</h2> <h2 class="title">评论列表只列出有内容的</h2>
<n-input <n-input
v-model:value="query.problem" v-model:value="query.problem"
clearable clearable
@@ -36,20 +36,35 @@ const columns: DataTableColumn<Comment>[] = [
key: "problem", key: "problem",
width: 100, width: 100,
render: (row) => render: (row) =>
h(NButton, { text: true, type: "info" }, () => row.problem), h(
NButton,
{
text: true,
type: "info",
onClick: () => window.open("/problem/" + row.problem, "_blank"),
},
() => row.problem,
),
}, },
{ {
title: "提交", title: "提交",
key: "submission", key: "submission",
width: 200, width: 200,
render: (row) => render: (row) =>
h(NButton, { text: true, type: "info" }, () => h(
row.submission.slice(0, 12), NButton,
{
text: true,
type: "info",
onClick: () => window.open("/submission/" + row.submission, "_blank"),
},
() => row.submission.slice(0, 12),
), ),
}, },
{ title: "描述评分", key: "description_rating", width: 100 }, { title: "描述评分", key: "description_rating", width: 100 },
{ title: "难度评分", key: "difficulty_rating", width: 100 }, { title: "难度评分", key: "difficulty_rating", width: 100 },
{ title: "综合评分", key: "comprehensive_rating", width: 100 }, { title: "综合评分", key: "comprehensive_rating", width: 100 },
{ title: "用户", key: "user.username", width: 150 },
{ {
title: "时间", title: "时间",
key: "create_time", key: "create_time",
@@ -61,7 +76,8 @@ const columns: DataTableColumn<Comment>[] = [
title: "选项", title: "选项",
key: "action", key: "action",
width: 100, width: 100,
render: (row) => h(CommentActions, { commentID: row.id, onDeleted: listComments }), render: (row) =>
h(CommentActions, { commentID: row.id, onDeleted: listComments }),
}, },
] ]

View File

@@ -370,4 +370,5 @@ export interface Comment {
difficulty_rating: 1 | 2 | 3 | 4 | 5 difficulty_rating: 1 | 2 | 3 | 4 | 5
comprehensive_rating: 1 | 2 | 3 | 4 | 5 comprehensive_rating: 1 | 2 | 3 | 4 | 5
create_time: Date create_time: Date
user: SampleUser
} }