fix click textarea.

This commit is contained in:
2023-03-30 09:46:39 +08:00
parent c97b2c4879
commit 301fc1be6d
6 changed files with 63 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ import { deleteContestProblem, deleteProblem } from "~/admin/api"
interface Props {
problemID: number
problemDisplayID: string
}
const props = defineProps<Props>()
const emit = defineEmits(["deleted"])
@@ -37,13 +38,20 @@ function goEdit() {
const name = route.name!.toString().replace("list", "edit")
router.push({ name, params: { problemID: props.problemID } })
}
function goCheck() {
const data = router.resolve("/problem/" + props.problemDisplayID)
window.open(data.href, "_blank")
}
</script>
<template>
<n-space align="center">
<n-button size="small" secondary type="primary" @click="goEdit">
编辑
</n-button>
<n-button size="small" secondary type="info">查看</n-button>
<n-button size="small" secondary type="info" @click="goCheck">
查看
</n-button>
<n-popconfirm @positive-click="handleDeleteProblem">
<template #trigger>
<n-button secondary size="small" type="error">删除</n-button>

View File

@@ -7,7 +7,7 @@ import { unique } from "~/utils/functions"
import { BlankProblem, LANGUAGE, Tag } from "~/utils/types"
import { getProblemTagList } from "~/shared/api"
import { LANGUAGE_SHOW_VALUE, CODE_TEMPLATES } from "~/utils/constants"
import download from "~/utils/download"
import {
createContestProblem,
createProblem,
@@ -192,8 +192,9 @@ async function handleUploadTestcases({ file }: UploadCustomRequestOptions) {
}
}
// TODO: 还没有完成
function downloadTestcases() {}
function downloadTestcases() {
download("test_case?problem_id=" + problem.id)
}
// 题目是否有漏写的
function detectProblemCompletion() {
@@ -265,7 +266,6 @@ async function submit() {
if (notComplete) return
getTemplate()
problem.tags = [...newTags.value, ...fromExistingTags.value]
console.log(problem)
const api = {
"admin problem create": createProblem,
"admin problem edit": editProblem,
@@ -299,7 +299,7 @@ async function submit() {
}
} catch (err: any) {
if (err.data === "Display ID already exists") {
message.error("显示编号重复了,请换一个编号")
message.error("显示编号重复了,请换一个显示编号")
} else {
message.error(err.data)
}
@@ -307,15 +307,14 @@ async function submit() {
}
onMounted(() => {
listTags()
getProblemDetail()
if (
route.name === "admin problem create" ||
route.name === "admin contest problem create"
) {
toggleReady(true)
}
listTags()
getProblemDetail()
})
watch([fromExistingTags, newTags], (tags) => {
@@ -443,7 +442,13 @@ watch([fromExistingTags, newTags], (tags) => {
{{ problem.test_case_score.length }}
条测试用例
</div>
<n-button tertiary type="info" size="small" @click="downloadTestcases">
<n-button
v-if="problem.id"
tertiary
type="info"
size="small"
@click="downloadTestcases"
>
下载
</n-button>
</n-space>

View File

@@ -48,6 +48,7 @@ const columns: DataTableColumn<AdminProblemFiltered>[] = [
render: (row) =>
h(Actions, {
problemID: row.id,
problemDisplayID: row._id,
onDeleted: listProblems,
}),
},