add result panel.
This commit is contained in:
@@ -1,72 +1,65 @@
|
||||
export enum SubmissionStatus {
|
||||
compile_error = -2,
|
||||
wrong_answer = -1,
|
||||
accepted = 0,
|
||||
time_limit_exceeded = 1 | 2,
|
||||
memory_limit_exceeded = 3,
|
||||
runtime_error = 4,
|
||||
system_error = 5,
|
||||
pending = 6,
|
||||
judging = 7,
|
||||
partial_accepted = 8,
|
||||
submitting = 9,
|
||||
}
|
||||
|
||||
export const JUDGE_STATUS = {
|
||||
"-2": {
|
||||
name: "Compile Error",
|
||||
short: "CE",
|
||||
color: "yellow",
|
||||
type: "warning",
|
||||
name: "编译失败",
|
||||
type: "error",
|
||||
},
|
||||
"-1": {
|
||||
name: "Wrong Answer",
|
||||
short: "WA",
|
||||
color: "red",
|
||||
name: "答案错误",
|
||||
type: "error",
|
||||
},
|
||||
"0": {
|
||||
name: "Accepted",
|
||||
short: "AC",
|
||||
color: "green",
|
||||
name: "答案正确",
|
||||
type: "success",
|
||||
},
|
||||
"1": {
|
||||
name: "Time Limit Exceeded",
|
||||
short: "TLE",
|
||||
color: "red",
|
||||
name: "运行超时",
|
||||
type: "error",
|
||||
},
|
||||
"2": {
|
||||
name: "Time Limit Exceeded",
|
||||
short: "TLE",
|
||||
color: "red",
|
||||
name: "运行超时",
|
||||
type: "error",
|
||||
},
|
||||
"3": {
|
||||
name: "Memory Limit Exceeded",
|
||||
short: "MLE",
|
||||
color: "red",
|
||||
name: "内存超限",
|
||||
type: "error",
|
||||
},
|
||||
"4": {
|
||||
name: "Runtime Error",
|
||||
short: "RE",
|
||||
color: "red",
|
||||
name: "运行时错误",
|
||||
type: "error",
|
||||
},
|
||||
"5": {
|
||||
name: "System Error",
|
||||
short: "SE",
|
||||
color: "red",
|
||||
name: "系统错误",
|
||||
type: "error",
|
||||
},
|
||||
"6": {
|
||||
name: "Pending",
|
||||
color: "yellow",
|
||||
name: "等待评分",
|
||||
type: "warning",
|
||||
},
|
||||
"7": {
|
||||
name: "Judging",
|
||||
color: "blue",
|
||||
name: "正在评分",
|
||||
type: "info",
|
||||
},
|
||||
"8": {
|
||||
name: "Partial Accepted",
|
||||
short: "PAC",
|
||||
color: "blue",
|
||||
type: "info",
|
||||
name: "部分正确",
|
||||
type: "warning",
|
||||
},
|
||||
"9": {
|
||||
name: "Submitting",
|
||||
color: "yellow",
|
||||
type: "warning",
|
||||
name: "正在提交",
|
||||
type: "info",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -38,3 +38,15 @@ export function parseTime(utc: Date, format = "YYYY年M月D日") {
|
||||
const time = useDateFormat(utc, format, { locales: "zh-CN" })
|
||||
return time.value
|
||||
}
|
||||
|
||||
export function submissionMemoryFormat(memory: string) {
|
||||
if (memory === undefined) return "--"
|
||||
// 1048576 = 1024 * 1024
|
||||
let t = parseInt(memory) / 1048576
|
||||
return String(t.toFixed(0)) + "MB"
|
||||
}
|
||||
|
||||
export function submissionTimeFormat(time: number) {
|
||||
if (time === undefined) return "--"
|
||||
return time + "ms"
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ const http = axios.create({
|
||||
xsrfCookieName: "csrftoken",
|
||||
})
|
||||
|
||||
// TODO
|
||||
http.interceptors.response.use(
|
||||
(res) => {
|
||||
if (res.data.error) {
|
||||
// 若后端返回为登录,则为session失效,应退出当前登录用户
|
||||
// // TODO: 若后端返回为登录,则为session失效,应退出当前登录用户
|
||||
if (res.data.data.startsWith("Please login")) {
|
||||
}
|
||||
return Promise.reject(res.data)
|
||||
|
||||
@@ -7,6 +7,8 @@ export type LANGUAGE =
|
||||
| "JavaScript"
|
||||
| "Golang"
|
||||
|
||||
export type SUBMISSION_RESULT = -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
|
||||
|
||||
export interface Problem {
|
||||
_id: string
|
||||
id: number
|
||||
@@ -56,3 +58,40 @@ export interface SubmitCodePayload {
|
||||
code: string
|
||||
contest_id?: number
|
||||
}
|
||||
|
||||
interface Info {
|
||||
err: string | null
|
||||
data: {
|
||||
error: number
|
||||
memory: number
|
||||
output: null
|
||||
result: SUBMISSION_RESULT
|
||||
signal: number
|
||||
cpu_time: number
|
||||
exit_code: number
|
||||
real_time: number
|
||||
test_case: string
|
||||
output_md5: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export interface Submission {
|
||||
id: string
|
||||
create_time: Date
|
||||
user_id: number
|
||||
username: string
|
||||
code: string
|
||||
result: SUBMISSION_RESULT
|
||||
info: Info
|
||||
language: string
|
||||
shared: boolean
|
||||
statistic_info: {
|
||||
score: number
|
||||
err_info: string
|
||||
}
|
||||
ip: string
|
||||
// TODO: 这里不知道是什么
|
||||
contest: null
|
||||
problem: number
|
||||
can_unshare: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user