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' {
export interface GlobalComponents {
NAlert: typeof import('naive-ui')['NAlert']
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDataTable: typeof import('naive-ui')['NDataTable']
NDescriptions: typeof import('naive-ui')['NDescriptions']
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
NDropdown: typeof import('naive-ui')['NDropdown']
NDynamicTags: typeof import('naive-ui')['NDynamicTags']
NEmpty: typeof import('naive-ui')['NEmpty']
NFlex: typeof import('naive-ui')['NFlex']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NFormItemGi: typeof import('naive-ui')['NFormItemGi']
NGi: typeof import('naive-ui')['NGi']
NGradientText: typeof import('naive-ui')['NGradientText']
NGrid: typeof import('naive-ui')['NGrid']
NH1: typeof import('naive-ui')['NH1']
NH2: typeof import('naive-ui')['NH2']
NH4: typeof import('naive-ui')['NH4']
NIcon: typeof import('naive-ui')['NIcon']
NInput: typeof import('naive-ui')['NInput']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
NLayoutHeader: typeof import('naive-ui')['NLayoutHeader']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NNumberAnimation: typeof import('naive-ui')['NNumberAnimation']
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']
NSpace: typeof import('naive-ui')['NSpace']
NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag']
NText: typeof import('naive-ui')['NText']
NTooltip: typeof import('naive-ui')['NTooltip']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}

View File

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

View File

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