update
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton, NIcon } from "naive-ui"
|
import { NButton, NIcon, useThemeVars } from "naive-ui"
|
||||||
import Pagination from "~/shared/components/Pagination.vue"
|
import Pagination from "~/shared/components/Pagination.vue"
|
||||||
import AcAndSubmission from "../components/AcAndSubmission.vue"
|
import AcAndSubmission from "../components/AcAndSubmission.vue"
|
||||||
import { getContestProblems, getContestRank } from "oj/api"
|
import { getContestProblems, getContestRank } from "oj/api"
|
||||||
@@ -17,6 +17,7 @@ const props = defineProps<Props>()
|
|||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const theme = useThemeVars()
|
||||||
|
|
||||||
const contestStore = useContestStore()
|
const contestStore = useContestStore()
|
||||||
|
|
||||||
@@ -74,13 +75,13 @@ const columns = ref<DataTableColumn<ContestRank>[]>([
|
|||||||
align: "center",
|
align: "center",
|
||||||
render: (row) => h(AcAndSubmission, { rank: row }),
|
render: (row) => h(AcAndSubmission, { rank: row }),
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: "总时间",
|
// title: "总时间",
|
||||||
key: "total_time",
|
// key: "total_time",
|
||||||
width: 120,
|
// width: 120,
|
||||||
align: "center",
|
// align: "center",
|
||||||
render: (row) => secondsToDuration(row.total_time),
|
// render: (row) => secondsToDuration(row.total_time),
|
||||||
},
|
// },
|
||||||
])
|
])
|
||||||
|
|
||||||
async function listRanks() {
|
async function listRanks() {
|
||||||
@@ -151,17 +152,16 @@ async function addColumns() {
|
|||||||
},
|
},
|
||||||
cellProps: (row) => {
|
cellProps: (row) => {
|
||||||
let backgroundColor = ""
|
let backgroundColor = ""
|
||||||
let color = ""
|
let color = theme.value.textColorBase
|
||||||
if (row.submission_info[problem.id]) {
|
if (row.submission_info[problem.id]) {
|
||||||
const status = row.submission_info[problem.id]
|
const status = row.submission_info[problem.id]
|
||||||
if (status.is_first_ac) {
|
if (status.is_first_ac) {
|
||||||
backgroundColor = "#3c9"
|
backgroundColor = theme.value.primaryColor
|
||||||
color = "#3c763d"
|
|
||||||
} else if (status.is_ac) {
|
} else if (status.is_ac) {
|
||||||
backgroundColor = "#dff0d8"
|
backgroundColor = "#dff0d8"
|
||||||
} else {
|
} else {
|
||||||
backgroundColor = "#f2dede"
|
backgroundColor = theme.value.warningColor
|
||||||
color = "#a94442"
|
color = theme.value.errorColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { style: { backgroundColor, color } }
|
return { style: { backgroundColor, color } }
|
||||||
|
|||||||
@@ -67,11 +67,9 @@ export function duration(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function secondsToDuration(seconds: number): string {
|
export function secondsToDuration(seconds: number): string {
|
||||||
const epoch = new Date(0)
|
|
||||||
const secondsAfterEpoch = new Date(seconds * 1000)
|
|
||||||
const duration = intervalToDuration({
|
const duration = intervalToDuration({
|
||||||
start: epoch,
|
start: 0,
|
||||||
end: secondsAfterEpoch,
|
end: seconds * 1000,
|
||||||
})
|
})
|
||||||
return [duration.hours, duration.minutes, duration.seconds].join(":")
|
return [duration.hours, duration.minutes, duration.seconds].join(":")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user