update contest visible.
This commit is contained in:
@@ -130,7 +130,7 @@ export function createContest(contest: BlankContest) {
|
||||
return http.post("admin/contest", contest)
|
||||
}
|
||||
|
||||
export function editContest(contest: BlankContest) {
|
||||
export function editContest(contest: Contest | BlankContest) {
|
||||
return http.put("admin/contest", contest)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { NSwitch, NTag } from "naive-ui"
|
||||
import Pagination from "~/shared/components/Pagination.vue"
|
||||
import { Contest } from "~/utils/types"
|
||||
import { getContestList } from "../api"
|
||||
import { getContestList, editContest } from "../api"
|
||||
import ContestType from "~/shared/components/ContestType.vue"
|
||||
import ContestTitle from "~/shared/components/ContestTitle.vue"
|
||||
import { CONTEST_STATUS } from "~/utils/constants"
|
||||
@@ -16,7 +16,10 @@ const query = reactive({
|
||||
keyword: "",
|
||||
})
|
||||
|
||||
function toggleVisible(id: number) {}
|
||||
function toggleVisible(contest: Contest) {
|
||||
contest.visible = !contest.visible
|
||||
editContest(contest)
|
||||
}
|
||||
|
||||
const columns: DataTableColumn<Contest>[] = [
|
||||
{ title: "ID", key: "id", width: 60 },
|
||||
@@ -52,7 +55,7 @@ const columns: DataTableColumn<Contest>[] = [
|
||||
value: row.visible,
|
||||
size: "small",
|
||||
rubberBand: false,
|
||||
onUpdateValue: () => toggleVisible(row.id),
|
||||
onUpdateValue: () => toggleVisible(row),
|
||||
}),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getTime, intervalToDuration, parseISO } from "date-fns"
|
||||
import { STORAGE_KEY } from "./constants"
|
||||
import { User } from "./types"
|
||||
|
||||
export function getACRate(acCount: number, totalCount: number) {
|
||||
|
||||
@@ -266,21 +266,14 @@ export interface Rank {
|
||||
submission_number: number
|
||||
}
|
||||
|
||||
export interface Contest {
|
||||
export interface Contest extends BlankContest {
|
||||
id: number
|
||||
created_by: SampleUser
|
||||
status: ContestStatus
|
||||
contest_type: ContestType
|
||||
title: string
|
||||
description: string
|
||||
real_time_rank: boolean
|
||||
rule_type: "ACM"
|
||||
start_time: string
|
||||
end_time: string
|
||||
create_time: string
|
||||
now: string
|
||||
last_update_time: string
|
||||
visible: boolean
|
||||
}
|
||||
|
||||
export interface BlankContest {
|
||||
|
||||
@@ -6,8 +6,8 @@ import AutoImport from "unplugin-auto-import/vite"
|
||||
import Components from "unplugin-vue-components/vite"
|
||||
import { NaiveUiResolver } from "unplugin-vue-components/resolvers"
|
||||
|
||||
const isTest = false
|
||||
const url = isTest ? "https://ojtest.hyyz.izhai.net" : "https://oj.xuyue.cc"
|
||||
const dev = false
|
||||
const url = dev ? "https://ojtest.hyyz.izhai.net" : "https://oj.xuyue.cc"
|
||||
const proxyConfig = {
|
||||
target: url,
|
||||
changeOrigin: true,
|
||||
|
||||
Reference in New Issue
Block a user