diff --git a/package.json b/package.json
index f0d6492..e2752e0 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"@vueuse/core": "^9.10.0",
"@vueuse/integrations": "^9.10.0",
"axios": "^1.2.2",
+ "copy-text-to-clipboard": "^3.0.1",
"element-plus": "^2.2.28",
"normalize.css": "^8.0.1",
"party-js": "^2.2.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ffb0c7e..c3fdf3f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -9,6 +9,7 @@ specifiers:
'@vueuse/core': ^9.10.0
'@vueuse/integrations': ^9.10.0
axios: ^1.2.2
+ copy-text-to-clipboard: ^3.0.1
element-plus: ^2.2.28
monaco-editor: ^0.34.1
normalize.css: ^8.0.1
@@ -31,6 +32,7 @@ dependencies:
'@vueuse/core': 9.10.0_vue@3.2.45
'@vueuse/integrations': 9.10.0_axios@1.2.2+vue@3.2.45
axios: 1.2.2
+ copy-text-to-clipboard: 3.0.1
element-plus: 2.2.28_vue@3.2.45
normalize.css: 8.0.1
party-js: 2.2.0
@@ -722,6 +724,11 @@ packages:
delayed-stream: 1.0.0
dev: false
+ /copy-text-to-clipboard/3.0.1:
+ resolution: {integrity: sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==}
+ engines: {node: '>=12'}
+ dev: false
+
/cross-spawn/7.0.3:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
engines: {node: '>= 8'}
diff --git a/src/oj/api.ts b/src/oj/api.ts
index 1edba1d..d74657a 100644
--- a/src/oj/api.ts
+++ b/src/oj/api.ts
@@ -66,11 +66,27 @@ export function getSubmission(id: string) {
}
export function submissionExists(problemID: number) {
- return http.get("submission_exists", {
- params: { problem_id: problemID },
- })
+ return useAxios(
+ "submission_exists",
+ { params: { problem_id: problemID } },
+ http,
+ { immediate: false }
+ )
}
export function submitCode(data: SubmitCodePayload) {
return http.post("submission", data)
}
+
+export function listSubmissions(params: {
+ myself: "1" | "0"
+ result: string
+ username: string
+ page: number
+ contest_id: string
+ problem_id: string
+ limit: number
+ offset: number
+}) {
+ return useAxios("submissions", { params }, http)
+}
diff --git a/src/oj/problem/components/Editor.vue b/src/oj/problem/components/Editor.vue
index 05062de..be6e63b 100644
--- a/src/oj/problem/components/Editor.vue
+++ b/src/oj/problem/components/Editor.vue
@@ -4,7 +4,6 @@ import { SOURCES } from "utils/constants"
import { Problem } from "utils/types"
import Monaco from "~/shared/Monaco/index.vue"
import { useCodeStore } from "oj/store/code"
-import { submissionExists } from "oj/api"
import SubmitPanel from "./SubmitPanel.vue"
import TestcasePanel from "./TestcasePanel.vue"
@@ -22,7 +21,6 @@ code.value = props.problem.template[code.language] || SOURCES[code.language]
const tab = ref("test")
const submitPanelRef = ref<{ submit: Function }>()
-const [tried] = useToggle()
watch(() => code.language, reset)
@@ -34,15 +32,6 @@ function change(value: string) {
code.value = value
}
-onMounted(() => {
- checkIfTried()
-})
-
-async function checkIfTried() {
- const res = await submissionExists(props.problem.id)
- tried.value = res.data
-}
-
function onTab(pane: TabsPaneContext) {
if (pane.paneName === "submit") {
submitPanelRef && submitPanelRef.value!.submit()
@@ -62,6 +51,9 @@ function onTab(pane: TabsPaneContext) {
重置
+
+ 提交信息
+
-import { Flag, CloseBold, Select } from "@element-plus/icons-vue"
+import { Flag, CloseBold, Select, CopyDocument } from "@element-plus/icons-vue"
+import copy from "copy-text-to-clipboard"
import { useCodeStore } from "oj/store/code"
import { SOURCES } from "utils/constants"
import { Problem } from "utils/types"
import { createTestSubmission } from "utils/judge"
+import { submissionExists } from "oj/api"
interface Props {
problem: Problem
@@ -16,7 +18,12 @@ type Sample = Problem["samples"][number] & {
}
const props = defineProps()
-
+const route = useRoute()
+const contestID = route.params.contestID
+const { data: hasSolved, execute } = submissionExists(props.problem.id)
+if (contestID) {
+ execute()
+}
const samples = ref(
props.problem.samples.map((sample, index) => ({
...sample,
@@ -77,6 +84,16 @@ const type = (status: Sample["status"]) =>
+
+
+
{{ problem.title }}
描述
@@ -107,10 +124,22 @@ const type = (status: Sample["status"]) =>
>
-
+
+
+
+ 输入
+
+
+
{{ sample.input }}
-
+
+
+
+ 输出
+
+
+
{{ sample.output }}
@@ -131,6 +160,7 @@ const type = (status: Sample["status"]) =>
margin: 24px 0 16px 0;
color: var(--el-color-primary);
}
+
.testcaseTitle {
margin-bottom: 24px;
}
diff --git a/src/oj/problem/components/SubmissionList.vue b/src/oj/problem/components/SubmissionList.vue
deleted file mode 100644
index 26e5053..0000000
--- a/src/oj/problem/components/SubmissionList.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
diff --git a/src/oj/problem/detail.vue b/src/oj/problem/detail.vue
index 073946d..dd3b761 100644
--- a/src/oj/problem/detail.vue
+++ b/src/oj/problem/detail.vue
@@ -2,9 +2,9 @@
import Editor from "./components/Editor.vue"
import ProblemContent from "./components/ProblemContent.vue"
import ProblemInfo from "./components/ProblemInfo.vue"
-import SubmissionList from "./components/SubmissionList.vue"
import { getProblem } from "oj/api"
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
+import { TabsPaneContext } from "element-plus"
interface Props {
problemID: string
@@ -16,7 +16,6 @@ const props = withDefaults(defineProps(), {
})
const { data: problem, isFinished } = getProblem(props.problemID)
-
provide("problem", readonly(problem))
@@ -33,11 +32,8 @@ provide("problem", readonly(problem))
-
-
-
-
+
diff --git a/src/oj/status/list.vue b/src/oj/status/list.vue
index 467340b..23948f8 100644
--- a/src/oj/status/list.vue
+++ b/src/oj/status/list.vue
@@ -1,5 +1,18 @@
-
-
-status list
+
+
+
+
+