naive-ui.

This commit is contained in:
2023-01-17 10:42:50 +08:00
parent 5d0f34c144
commit 01760b8eaa
29 changed files with 4864 additions and 2263 deletions

View File

@@ -1,3 +1,5 @@
import { SUBMISSION_RESULT } from "./types"
export enum SubmissionStatus {
compile_error = -2,
wrong_answer = -1,
@@ -12,66 +14,59 @@ export enum SubmissionStatus {
submitting = 9,
}
export const JUDGE_STATUS = {
export const JUDGE_STATUS: {
[key in SUBMISSION_RESULT]: {
name: string
type: "error" | "success" | "warning" | "info"
}
} = {
"-2": {
name: "编译失败",
type: "danger",
alertType: "error",
type: "warning",
},
"-1": {
name: "答案错误",
type: "danger",
alertType: "error",
type: "error",
},
"0": {
name: "答案正确",
type: "success",
alertType: "success",
},
"1": {
name: "运行超时",
type: "danger",
alertType: "error",
type: "error",
},
"2": {
name: "运行超时",
type: "danger",
alertType: "error",
type: "error",
},
"3": {
name: "内存超限",
type: "danger",
alertType: "error",
type: "error",
},
"4": {
name: "运行时错误",
type: "danger",
alertType: "error",
type: "warning",
},
"5": {
name: "系统错误",
type: "danger",
alertType: "error",
type: "error",
},
"6": {
name: "等待评分",
type: "warning",
alertType: "warning",
},
"7": {
name: "正在评分",
type: "warning",
alertType: "warning",
},
"8": {
name: "部分正确",
type: "warning",
alertType: "warning",
},
"9": {
name: "正在提交",
type: "info",
alertType: "info",
},
}

View File

@@ -38,14 +38,14 @@ export function parseTime(utc: Date, format = "YYYY年M月D日") {
return time.value
}
export function submissionMemoryFormat(memory: string) {
export function submissionMemoryFormat(memory: number | string | undefined) {
if (memory === undefined) return "--"
// 1048576 = 1024 * 1024
let t = parseInt(memory) / 1048576
let t = parseInt(memory + "") / 1048576
return String(t.toFixed(0)) + "MB"
}
export function submissionTimeFormat(time: number) {
export function submissionTimeFormat(time: number | string | undefined) {
if (time === undefined) return "--"
return time + "ms"
}

View File

@@ -93,8 +93,10 @@ export interface Submission {
language: string
shared: boolean
statistic_info: {
score: number
err_info: string
score?: number
err_info?: string
time_cost?: number
memory_cost?: number
}
ip: string
// TODO: 这里不知道是什么
@@ -105,7 +107,7 @@ export interface Submission {
export interface SubmissionListPayload {
myself?: "1" | "0"
result?: SUBMISSION_RESULT
result?: string
username?: string
contest_id?: string
problem_id?: string