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