feat: preserve testcase generator state across modal open/close
This commit is contained in:
@@ -140,7 +140,6 @@ const languageOptions = [
|
|||||||
{ label: LANGUAGE_SHOW_VALUE["C++"], value: "C++" },
|
{ label: LANGUAGE_SHOW_VALUE["C++"], value: "C++" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
async function getProblemDetail() {
|
async function getProblemDetail() {
|
||||||
if (!props.problemID) {
|
if (!props.problemID) {
|
||||||
toggleReady(true)
|
toggleReady(true)
|
||||||
@@ -419,7 +418,10 @@ async function generateMermaid() {
|
|||||||
|
|
||||||
const showGeneratorModal = ref(false)
|
const showGeneratorModal = ref(false)
|
||||||
|
|
||||||
function handleTestcasesGenerated(testCaseId: string, testCaseScore: Testcase[]) {
|
function handleTestcasesGenerated(
|
||||||
|
testCaseId: string,
|
||||||
|
testCaseScore: Testcase[],
|
||||||
|
) {
|
||||||
problem.value.test_case_id = testCaseId
|
problem.value.test_case_id = testCaseId
|
||||||
problem.value.test_case_score = testCaseScore
|
problem.value.test_case_score = testCaseScore
|
||||||
showGeneratorModal.value = false
|
showGeneratorModal.value = false
|
||||||
@@ -646,16 +648,20 @@ watch(
|
|||||||
<h2 class="title">测试用例区域</h2>
|
<h2 class="title">测试用例区域</h2>
|
||||||
|
|
||||||
<n-flex align="center" style="margin-bottom: 12px">
|
<n-flex align="center" style="margin-bottom: 12px">
|
||||||
|
<div>
|
||||||
<n-button type="success" @click="showGeneratorModal = true">
|
<n-button type="success" @click="showGeneratorModal = true">
|
||||||
生成测试用例
|
(新)直接生成
|
||||||
</n-button>
|
</n-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<n-upload
|
<n-upload
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
accept=".zip"
|
accept=".zip"
|
||||||
:custom-request="handleUploadTestcases"
|
:custom-request="handleUploadTestcases"
|
||||||
>
|
>
|
||||||
<n-button type="info">上传测试用例</n-button>
|
<n-button type="info">(老)手动上传</n-button>
|
||||||
</n-upload>
|
</n-upload>
|
||||||
|
</div>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
|
|
||||||
<n-modal
|
<n-modal
|
||||||
@@ -666,7 +672,6 @@ watch(
|
|||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
>
|
>
|
||||||
<TestcaseGenerator
|
<TestcaseGenerator
|
||||||
v-if="showGeneratorModal"
|
|
||||||
:answers="problem.answers"
|
:answers="problem.answers"
|
||||||
@uploaded="handleTestcasesGenerated"
|
@uploaded="handleTestcasesGenerated"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user