add title.

This commit is contained in:
2023-03-30 19:24:15 +08:00
parent eb652d1c86
commit 451e8d7c70
8 changed files with 78 additions and 34 deletions

View File

@@ -70,7 +70,7 @@ async function submit() {
try {
await api!(contest)
if (route.name === "admin contest create") {
message.success("成功建比赛 💐")
message.success("成功建比赛 💐")
} else {
message.success("修改已保存")
}
@@ -84,9 +84,12 @@ onMounted(getContestDetail)
</script>
<template>
<h2 class="title">
{{ $route.name === "admin contest create" ? "新建比赛" : "编辑比赛" }}
</h2>
<n-form inline>
<n-form-item label="标题">
<n-input class="title" v-model:value="contest.title" />
<n-input class="contestTitle" v-model:value="contest.title" />
</n-form-item>
<n-form-item label="开始">
<n-date-picker v-model:value="startTime" type="datetime" />
@@ -112,6 +115,10 @@ onMounted(getContestDetail)
<style scoped>
.title {
margin-top: 0;
}
.contestTitle {
width: 400px;
}
</style>

View File

@@ -74,11 +74,10 @@ watch(query, listContests, { deep: true })
</script>
<template>
<n-form inline label-placement="left">
<n-form-item>
<n-input v-model:value="query.keyword" placeholder="输入标题关键字" />
</n-form-item>
</n-form>
<n-space justify="space-between" class="titleWrapper">
<h2 class="title">比赛列表</h2>
<n-input v-model:value="query.keyword" placeholder="输入标题关键字" />
</n-space>
<n-data-table :columns="columns" :data="contests" size="small" />
<Pagination
:total="total"
@@ -87,4 +86,12 @@ watch(query, listContests, { deep: true })
/>
</template>
<style scoped></style>
<style scoped>
.titleWrapper {
margin-bottom: 16px;
}
.title {
margin: 0;
}
</style>

View File

@@ -27,6 +27,15 @@ const route = useRoute()
const router = useRouter()
const props = defineProps<Props>()
const title = computed(
() =>
({
"admin problem create": "新建题目",
"admin problem edit": "编辑题目",
"admin contest problem create": "新建比赛题目",
"admin contest problem edit": "编辑比赛题目",
}[<string>route.name])
)
const problem = reactive<BlankProblem>({
_id: "",
title: "",
@@ -321,12 +330,13 @@ watch([fromExistingTags, newTags], (tags) => {
</script>
<template>
<h2 class="title">{{ title }}</h2>
<n-form inline label-placement="left">
<n-form-item label="显示编号">
<n-input class="w-100" v-model:value="problem._id" />
</n-form-item>
<n-form-item label="题目">
<n-input class="titleInput" v-model:value="problem.title" />
<n-input class="problemTitleInput" v-model:value="problem.title" />
</n-form-item>
<n-form-item label="难度">
<n-select
@@ -497,6 +507,10 @@ watch([fromExistingTags, newTags], (tags) => {
</template>
<style scoped>
.title {
margin-top: 0;
}
.box {
margin-bottom: 20px;
}
@@ -505,13 +519,10 @@ watch([fromExistingTags, newTags], (tags) => {
width: 100px;
}
.titleInput {
.problemTitleInput {
width: 300px;
}
.title {
margin-bottom: 12px;
}
.tag {
width: 500px;
}

View File

@@ -83,11 +83,10 @@ watch(query, listProblems, { deep: true })
</script>
<template>
<n-form inline label-placement="left">
<n-form-item>
<n-input v-model:value="query.keyword" placeholder="输入标题关键字" />
</n-form-item>
</n-form>
<n-space class="titleWrapper" justify="space-between">
<h2 class="title">题目列表</h2>
<n-input v-model:value="query.keyword" placeholder="输入标题关键字" />
</n-space>
<n-data-table striped size="small" :columns="columns" :data="problems" />
<Pagination
:total="total"
@@ -96,4 +95,12 @@ watch(query, listProblems, { deep: true })
/>
</template>
<style scoped></style>
<style scoped>
.titleWrapper {
margin-bottom: 16px;
}
.title {
margin: 0;
}
</style>

View File

@@ -28,6 +28,10 @@ const usersToTable = computed(() => {
})
function generateUsers() {
if (!rawInput.value || !rawInput.value.trim()) {
message.info("请填写相关内容")
return
}
// 自动加上 ks 的开头
let myClass = ""
if (prefix.value) {
@@ -37,7 +41,6 @@ function generateUsers() {
myClass = prefix.value
}
}
if (!rawInput.value || !rawInput.value.trim()) return
rawInput.value = rawInput.value.trim()
const inputs = rawInput.value.split("\n")
users.value = inputs.map((u, i) => {
@@ -88,7 +91,6 @@ function handleAll() {
type="textarea"
class="inputArea"
placeholder="每行一个用户名"
autofocus
v-model:value="rawInput"
/>
</n-space>

View File

@@ -120,19 +120,21 @@ watch(query, listUsers, { deep: true })
</script>
<template>
<n-form inline label-placement="left">
<n-form-item>
<n-input placeholder="请输入关键字搜索" v-model:value="query.keyword" />
</n-form-item>
<n-form-item v-if="userIDs.length">
<n-popconfirm @positive-click="onDeleteUsers(userIDs)">
<n-space class="titleWrapper" justify="space-between">
<h2 class="title">用户列表</h2>
<n-space>
<n-popconfirm
v-if="userIDs.length"
@positive-click="onDeleteUsers(userIDs)"
>
<template #trigger>
<n-button type="warning">删除</n-button>
</template>
确定删除选中的用户吗删除后无法恢复
</n-popconfirm>
</n-form-item>
</n-form>
<n-input placeholder="请输入关键字搜索" v-model:value="query.keyword" />
</n-space>
</n-space>
<n-data-table
:data="users"
:columns="columns"
@@ -183,4 +185,12 @@ watch(query, listUsers, { deep: true })
</n-modal>
</template>
<style scoped></style>
<style scoped>
.titleWrapper {
margin-bottom: 16px;
}
.title {
margin: 0;
}
</style>

View File

@@ -44,13 +44,13 @@ onMounted(init)
:column="2"
label-style="width: 50%"
>
<n-descriptions-item label="已解决的题数量">
<n-descriptions-item label="已解决的题数量">
{{ profile.accepted_number }}
</n-descriptions-item>
<n-descriptions-item label="总提交数">
{{ profile.submission_number }}
</n-descriptions-item>
<n-descriptions-item v-if="problems.length" label="已解决的题" :span="2">
<n-descriptions-item v-if="problems.length" label="已解决的题" :span="2">
<n-space>
<n-button
v-for="id in problems"

View File

@@ -36,7 +36,7 @@ const options: MenuOption[] = [
h(
RouterLink,
{ to: "/admin/problem/create" },
{ default: () => "建题目" }
{ default: () => "建题目" }
),
key: "admin problem create",
},
@@ -70,7 +70,7 @@ const options: MenuOption[] = [
h(
RouterLink,
{ to: "/admin/contest/create" },
{ default: () => "建比赛" }
{ default: () => "建比赛" }
),
key: "admin contest create",
},