filter by language
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-09-21 19:33:00 +08:00
parent 43da7407d0
commit b3091db7b2
3 changed files with 23 additions and 23 deletions

19
src/components.d.ts vendored
View File

@@ -9,51 +9,32 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
NAlert: typeof import('naive-ui')['NAlert'] NAlert: typeof import('naive-ui')['NAlert']
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton'] NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard'] NCard: typeof import('naive-ui')['NCard']
NCode: typeof import('naive-ui')['NCode'] NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable'] NDataTable: typeof import('naive-ui')['NDataTable']
NDescriptions: typeof import('naive-ui')['NDescriptions']
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
NDropdown: typeof import('naive-ui')['NDropdown'] NDropdown: typeof import('naive-ui')['NDropdown']
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
NEmpty: typeof import('naive-ui')['NEmpty']
NFlex: typeof import('naive-ui')['NFlex'] NFlex: typeof import('naive-ui')['NFlex']
NForm: typeof import('naive-ui')['NForm'] NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem'] NFormItem: typeof import('naive-ui')['NFormItem']
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
NGi: typeof import('naive-ui')['NGi']
NGradientText: typeof import('naive-ui')['NGradientText'] NGradientText: typeof import('naive-ui')['NGradientText']
NGrid: typeof import('naive-ui')['NGrid']
NH1: typeof import('naive-ui')['NH1'] NH1: typeof import('naive-ui')['NH1']
NH2: typeof import('naive-ui')['NH2']
NH4: typeof import('naive-ui')['NH4']
NIcon: typeof import('naive-ui')['NIcon'] NIcon: typeof import('naive-ui')['NIcon']
NInput: typeof import('naive-ui')['NInput'] NInput: typeof import('naive-ui')['NInput']
NLayout: typeof import('naive-ui')['NLayout'] NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent'] NLayoutContent: typeof import('naive-ui')['NLayoutContent']
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu'] NMenu: typeof import('naive-ui')['NMenu']
NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal'] NModal: typeof import('naive-ui')['NModal']
NNumberAnimation: typeof import('naive-ui')['NNumberAnimation']
NPagination: typeof import('naive-ui')['NPagination'] NPagination: typeof import('naive-ui')['NPagination']
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NPopover: typeof import('naive-ui')['NPopover']
NRate: typeof import('naive-ui')['NRate']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect'] NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace'] NSpace: typeof import('naive-ui')['NSpace']
NSwitch: typeof import('naive-ui')['NSwitch'] NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag'] NTag: typeof import('naive-ui')['NTag']
NText: typeof import('naive-ui')['NText'] NText: typeof import('naive-ui')['NText']
NTooltip: typeof import('naive-ui')['NTooltip']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
} }

View File

@@ -2,7 +2,7 @@
import { NButton, NH2, NText } from "naive-ui" import { NButton, NH2, NText } from "naive-ui"
import { adminRejudge, getSubmissions, getTodaySubmissionCount } from "oj/api" import { adminRejudge, getSubmissions, getTodaySubmissionCount } from "oj/api"
import { filterEmptyValue, parseTime } from "utils/functions" import { filterEmptyValue, parseTime } from "utils/functions"
import { Submission } from "utils/types" import { LANGUAGE, Submission } from "utils/types"
import Pagination from "~/shared/components/Pagination.vue" import Pagination from "~/shared/components/Pagination.vue"
import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue" import SubmissionResultTag from "~/shared/components/SubmissionResultTag.vue"
import { isDesktop } from "~/shared/composables/breakpoints" import { isDesktop } from "~/shared/composables/breakpoints"
@@ -21,6 +21,7 @@ interface Query {
page: number page: number
myself: boolean myself: boolean
problem: string problem: string
language: LANGUAGE | ""
} }
const route = useRoute() const route = useRoute()
@@ -38,12 +39,13 @@ const query = reactive<Query>({
username: <string>route.query.username ?? "", username: <string>route.query.username ?? "",
myself: route.query.myself === "1", myself: route.query.myself === "1",
problem: <string>route.query.problem ?? "", problem: <string>route.query.problem ?? "",
language: <LANGUAGE | "">route.query.language ?? "",
}) })
const submissionID = ref("") const submissionID = ref("")
const [statisticPanel, toggleStatisticPanel] = useToggle(false) const [statisticPanel, toggleStatisticPanel] = useToggle(false)
const [codePanel, toggleCodePanel] = useToggle(false) const [codePanel, toggleCodePanel] = useToggle(false)
const options: SelectOption[] = [ const resultOptions: SelectOption[] = [
{ label: "全部", value: "" }, { label: "全部", value: "" },
{ label: "答案正确", value: "0" }, { label: "答案正确", value: "0" },
{ label: "答案错误", value: "-1" }, { label: "答案错误", value: "-1" },
@@ -51,6 +53,12 @@ const options: SelectOption[] = [
{ label: "运行时错误", value: "4" }, { label: "运行时错误", value: "4" },
] ]
const languageOptions: SelectOption[] = [
{ label: "全部", value: "" },
{ label: "Python", value: "Python3" },
{ label: "C语言", value: "C" },
{ label: "C++", value: "C++" },
]
async function listSubmissions() { async function listSubmissions() {
query.result = <string>route.query.result ?? "" query.result = <string>route.query.result ?? ""
query.page = parseInt(<string>route.query.page) || 1 query.page = parseInt(<string>route.query.page) || 1
@@ -58,6 +66,7 @@ async function listSubmissions() {
query.username = <string>route.query.username ?? "" query.username = <string>route.query.username ?? ""
query.myself = route.query.myself === "1" query.myself = route.query.myself === "1"
query.problem = <string>route.query.problem ?? "" query.problem = <string>route.query.problem ?? ""
query.language = <LANGUAGE>route.query.language ?? ""
if (query.page < 1) query.page = 1 if (query.page < 1) query.page = 1
const offset = query.limit * (query.page - 1) const offset = query.limit * (query.page - 1)
@@ -67,6 +76,7 @@ async function listSubmissions() {
offset, offset,
problem_id: <string>route.query.problem ?? "", problem_id: <string>route.query.problem ?? "",
contest_id: <string>route.params.contestID ?? "", contest_id: <string>route.params.contestID ?? "",
language: query.language,
}) })
submissions.value = res.data.results submissions.value = res.data.results
total.value = res.data.total total.value = res.data.total
@@ -105,6 +115,7 @@ function clear() {
query.myself = false query.myself = false
query.result = "" query.result = ""
query.problem = "" query.problem = ""
query.language = ""
} }
async function rejudge(submissionID: string) { async function rejudge(submissionID: string) {
@@ -135,7 +146,7 @@ function showCodePanel(id: string) {
watch(() => query.page, routerPush) watch(() => query.page, routerPush)
watch( watch(
() => [query.limit, query.myself, query.result], () => [query.limit, query.myself, query.result, query.language],
() => { () => {
query.page = 1 query.page = 1
routerPush() routerPush()
@@ -253,7 +264,14 @@ const columns = computed(() => {
<n-select <n-select
class="select" class="select"
v-model:value="query.result" v-model:value="query.result"
:options="options" :options="resultOptions"
/>
</n-form-item>
<n-form-item label="编程语言">
<n-select
class="select"
v-model:value="query.language"
:options="languageOptions"
/> />
</n-form-item> </n-form-item>
<n-form-item v-if="userStore.isAuthed" label="只看自己"> <n-form-item v-if="userStore.isAuthed" label="只看自己">

View File

@@ -229,6 +229,7 @@ export interface SubmissionListPayload {
username?: string username?: string
contest_id?: string contest_id?: string
problem_id?: string problem_id?: string
language?: LANGUAGE
page: number page: number
limit: number limit: number
offset: number offset: number