diff --git a/src/oj/submission/components/SubmissionLink.vue b/src/oj/submission/components/SubmissionLink.vue new file mode 100644 index 0000000..66f1dfa --- /dev/null +++ b/src/oj/submission/components/SubmissionLink.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/oj/submission/detail.vue b/src/oj/submission/detail.vue index 6ec31c7..a677039 100644 --- a/src/oj/submission/detail.vue +++ b/src/oj/submission/detail.vue @@ -12,6 +12,7 @@ import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue" const props = defineProps<{ submissionID: string + hideList: boolean }>() const submission = ref() @@ -75,7 +76,7 @@ onMounted(init) {{ copied ? "成功复制" : "复制代码" }} diff --git a/src/oj/submission/list.vue b/src/oj/submission/list.vue index 54cb1c0..55857e3 100644 --- a/src/oj/submission/list.vue +++ b/src/oj/submission/list.vue @@ -15,6 +15,8 @@ import { useUserStore } from "~/shared/store/user" import { LANGUAGE_SHOW_VALUE } from "~/utils/constants" import ButtonWithSearch from "./components/ButtonWithSearch.vue" import StatisticsPanel from "./components/StatisticsPanel.vue" +import SubmissionLink from "./components/SubmissionLink.vue" +import SubmissionDetail from "./detail.vue" interface Query { username: string @@ -40,7 +42,9 @@ const query = reactive({ myself: route.query.myself === "1", problem: route.query.problem ?? "", }) -const [show, toggleStatisticPanel] = useToggle(false) +const submissionID = ref("") +const [statisticPanel, toggleStatisticPanel] = useToggle(false) +const [codePanel, toggleCodePanel] = useToggle(false) const options: SelectOption[] = [ { label: "全部", value: "" }, @@ -115,6 +119,11 @@ function problemClicked(row: Submission) { } } +function showCodePanel(id: string) { + toggleCodePanel(true) + submissionID.value = id +} + watch(() => query.page, routerPush) watch( @@ -159,32 +168,22 @@ const columns = computed(() => { title: "提交编号", key: "id", minWidth: 160, - render: (row) => { - if (row.show_link) { - return h( - NButton, - { - text: true, - type: "info", - onClick: () => router.push("/submission/" + row.id), - }, - () => row.id.slice(0, 12), - ) - } else { - return row.id.slice(0, 12) - } - }, + render: (row) => + h(SubmissionLink, { + submission: row, + onShowCode: () => showCodePanel(row.id), + }), }, { title: "状态", key: "status", - width: 120, + width: 160, render: (row) => h(SubmissionResultTag, { result: row.result }), }, { title: "题目", key: "problem", - width: 120, + width: 160, render: (row) => h( ButtonWithSearch, @@ -216,7 +215,7 @@ const columns = computed(() => { { title: "用户", key: "username", - minWidth: 150, + minWidth: 160, render: (row) => h( ButtonWithSearch, @@ -298,7 +297,7 @@ const columns = computed(() => { /> { > + + + diff --git a/src/shared/icons/Code.vue b/src/shared/icons/Code.vue new file mode 100644 index 0000000..9d01f68 --- /dev/null +++ b/src/shared/icons/Code.vue @@ -0,0 +1,13 @@ + diff --git a/vite.config.ts b/vite.config.ts index 72bf903..09c5bdb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,7 @@ import Components from "unplugin-vue-components/vite" import { NaiveUiResolver } from "unplugin-vue-components/resolvers" const dev = false -const url = dev ? "https://ojtest.hyyz.izhai.net" : "https://oj.xuyue.cc" +const url = dev ? "http://localhost:8080" : "https://oj.xuyue.cc" const proxyConfig = { target: url, changeOrigin: true,