This commit is contained in:
2024-01-22 17:33:01 +08:00
parent 372a23b7e7
commit 7591b065d3
7 changed files with 87 additions and 28 deletions

View File

@@ -3,17 +3,18 @@ import copyTextToClipboard from "copy-text-to-clipboard"
import {
code,
size,
init,
input,
output,
status,
init,
reset,
clearInput,
showStatus,
} from "../composables/code"
import { showAnalyse, analyse } from "../composables/analyse"
import { showAnalyse, analyzeError, analyse } from "../composables/analyse"
import CodeEditor from "../components/CodeEditor.vue"
import { computed, onMounted } from "vue"
import { useMessage } from "naive-ui"
import { Status } from "../types"
onMounted(init)
@@ -71,9 +72,16 @@ function copy() {
:font-size="size"
>
<template #actions>
<n-popover v-if="showStatus" trigger="click">
<n-tag v-if="status === Status.Accepted" type="success">
运行成功
</n-tag>
<n-tag v-if="showAnalyse" type="warning">运行失败</n-tag>
<n-popover
v-if="showAnalyse && code.language === 'python'"
trigger="click"
>
<template #trigger>
<n-button quaternary type="error" @click="showAnalyse">
<n-button quaternary type="error" @click="analyzeError">
推测原因
</n-button>
</template>

View File

@@ -43,7 +43,7 @@ const languages: SelectOption[] = [
<Play />
</n-icon>
</template>
运行 (F5)
运行
</n-button>
</n-flex>
</n-flex>

24
src/desktop/TestPanel.vue Normal file
View File

@@ -0,0 +1,24 @@
<script lang="ts" setup>
const count = 5
</script>
<template>
<n-flex vertical>
<n-flex>
<n-button>增加5个</n-button>
<n-button>运行看看</n-button>
<n-button type="primary">生成并下载</n-button>
</n-flex>
<n-flex vertical>
<n-flex v-for="it in count" :key="it">
<n-flex vertical>
<span>{{ it }}.in</span>
<n-input type="textarea" />
</n-flex>
<n-flex vertical>
<span>{{ it }}.out</span>
<n-input type="textarea" />
</n-flex>
</n-flex>
</n-flex>
</n-flex>
</template>

View File

@@ -1,8 +1,34 @@
<template>
<Header />
<Content />
<n-modal
v-model:show="show"
preset="card"
style="width: 600px"
:mask-closable="false"
title="测试用例文件生成器"
>
<TestPanel />
</n-modal>
</template>
<script lang="ts" setup>
import Header from "./Header.vue"
import Content from "./Content.vue"
import TestPanel from "./TestPanel.vue"
import { useMagicKeys, whenever } from "@vueuse/core"
import { ref } from "vue"
const { alt_shift_p, ctrl_shift_p, ctrl_shift_z } = useMagicKeys()
const show = ref(false)
whenever(alt_shift_p, () => {
show.value = true
})
whenever(ctrl_shift_p, () => {
show.value = true
})
whenever(ctrl_shift_z, () => {
show.value = true
})
</script>