From 710f4b5eb9384cd0a0aa800a4deff6a20aacf32f Mon Sep 17 00:00:00 2001 From: xuyue <517252939@qq.com> Date: Wed, 1 Nov 2023 19:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A6=96=E9=A1=B5=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 +- package.json | 3 +- src/admin/api.ts | 4 +- src/admin/contest/list.vue | 2 +- src/admin/problem/components/AddButton.vue | 2 +- src/admin/problem/components/Modal.vue | 4 +- src/admin/problem/detail.vue | 6 +- src/admin/problem/list.vue | 6 +- src/admin/setting/config.vue | 10 +- src/components.d.ts | 1 + src/learn/index.vue | 4 +- src/oj/api.ts | 4 +- src/oj/contest/detail.vue | 2 +- src/oj/contest/list.vue | 6 +- src/oj/contest/pages/rank.vue | 12 +- src/oj/problem/components/Editor.vue | 4 +- src/oj/problem/components/ProblemContent.vue | 11 +- .../problem/components/ProblemSubmission.vue | 200 +++++++++--------- src/oj/problem/components/Submit.vue | 14 +- src/oj/problem/components/TestCat.vue | 94 ++++---- src/oj/problem/list.vue | 42 ++-- src/oj/rank/list.vue | 4 +- src/oj/store/contest.ts | 4 +- src/oj/submission/list.vue | 14 +- src/shared/CodeEditor.vue | 2 +- src/shared/ContestType.vue | 2 +- src/shared/Header.vue | 5 +- src/shared/composables/chart.ts | 2 +- src/shared/layout/admin.vue | 12 +- src/shared/store/user.ts | 6 +- src/shared/themes/createTheme.ts | 2 +- src/shared/themes/oneDark.ts | 2 +- src/utils/download.ts | 2 +- src/utils/functions.ts | 8 +- src/utils/http.ts | 2 +- 35 files changed, 261 insertions(+), 241 deletions(-) diff --git a/package-lock.json b/package-lock.json index c165b01..df9b467 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "oj-next", - "version": "0.0.1", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "oj-next", - "version": "0.0.1", + "version": "1.0.0", "dependencies": { "@codemirror/lang-cpp": "^6.0.2", "@codemirror/lang-python": "^6.1.3", diff --git a/package.json b/package.json index 684888f..86fb2a7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "oj-next", - "private": true, - "version": "0.0.1", + "version": "1.0.0", "type": "module", "scripts": { "start": "vite", diff --git a/src/admin/api.ts b/src/admin/api.ts index 06b78a4..5a2a25a 100644 --- a/src/admin/api.ts +++ b/src/admin/api.ts @@ -19,7 +19,7 @@ export async function getProblemList( limit = 10, keyword: string, contestID?: string, - ruleType?: "ACM" | "OI" + ruleType?: "ACM" | "OI", ) { const endpoint = !!contestID ? "admin/contest/problem" : "admin/problem" const res = await http.get(endpoint, { @@ -143,7 +143,7 @@ export function getContest(id: string) { export function addProblemForContest( contestID: string, problemID: number, - displayID: string + displayID: string, ) { return http.post("admin/contest/add_problem_from_public", { contest_id: contestID, diff --git a/src/admin/contest/list.vue b/src/admin/contest/list.vue index a704b0e..f6157b9 100644 --- a/src/admin/contest/list.vue +++ b/src/admin/contest/list.vue @@ -40,7 +40,7 @@ const columns: DataTableColumn[] = [ h( NTag, { type: CONTEST_STATUS[row.status]["type"], size: "small" }, - () => CONTEST_STATUS[row.status]["name"] + () => CONTEST_STATUS[row.status]["name"], ), }, { diff --git a/src/admin/problem/components/AddButton.vue b/src/admin/problem/components/AddButton.vue index f156cc1..54d877b 100644 --- a/src/admin/problem/components/AddButton.vue +++ b/src/admin/problem/components/AddButton.vue @@ -18,7 +18,7 @@ async function addProblem() { await addProblemForContest( props.contestID, props.problemID, - displayID.value + displayID.value, ) emit("added") } catch (err: any) { diff --git a/src/admin/problem/components/Modal.vue b/src/admin/problem/components/Modal.vue index 16e6f2c..7bb6736 100644 --- a/src/admin/problem/components/Modal.vue +++ b/src/admin/problem/components/Modal.vue @@ -47,7 +47,7 @@ async function getList() { query.limit, query.keyword, "", - "ACM" + "ACM", ) total.value = res.total problems.value = res.results @@ -56,7 +56,7 @@ watch( () => props.show, (value) => { if (value) getList() - } + }, ) watch(query, getList, { deep: true }) diff --git a/src/admin/problem/detail.vue b/src/admin/problem/detail.vue index 2a32548..b29e909 100644 --- a/src/admin/problem/detail.vue +++ b/src/admin/problem/detail.vue @@ -33,7 +33,7 @@ const title = computed( "admin problem edit": "编辑题目", "admin contest problem create": "新建比赛题目", "admin contest problem edit": "编辑比赛题目", - }[route.name]) + })[route.name], ) const problem = reactive({ _id: "", @@ -91,7 +91,7 @@ const languageOptions = [ ] const tagOptions = computed(() => - existingTags.value.map((tag) => ({ label: tag.name, value: tag.name })) + existingTags.value.map((tag) => ({ label: tag.name, value: tag.name })), ) async function getProblemDetail() { @@ -233,7 +233,7 @@ function detectProblemCompletion() { // 样例是空的 else if ( problem.samples.some( - (sample) => sample.output === "" || sample.input === "" + (sample) => sample.output === "" || sample.input === "", ) ) { message.error("空样例没有删干净") diff --git a/src/admin/problem/list.vue b/src/admin/problem/list.vue index 9183172..dbe7df8 100644 --- a/src/admin/problem/list.vue +++ b/src/admin/problem/list.vue @@ -20,10 +20,10 @@ const title = computed( ({ "admin problem list": "题目列表", "admin contest problem list": "比赛题目列表", - }[route.name]) + })[route.name], ) const isContestProblemList = computed( - () => route.name === "admin contest problem list" + () => route.name === "admin contest problem list", ) const [show, toggleShow] = useToggle() @@ -77,7 +77,7 @@ async function listProblems() { offset, query.limit, query.keyword, - props.contestID + props.contestID, ) total.value = res.total problems.value = res.results diff --git a/src/admin/setting/config.vue b/src/admin/setting/config.vue index b738dad..bb0dcb3 100644 --- a/src/admin/setting/config.vue +++ b/src/admin/setting/config.vue @@ -28,7 +28,7 @@ const testcaseColumns: DataTableColumn[] = [ h( NButton, { size: "small", onClick: () => deleteTestcase(row.id) }, - () => "删除" + () => "删除", ), }, ] @@ -48,7 +48,7 @@ const serverColumns: DataTableColumn[] = [ h( NTag, { type: statusMap[row.status].color, size: "small" }, - () => statusMap[row.status].label + () => statusMap[row.status].label, ), }, { @@ -63,7 +63,7 @@ const serverColumns: DataTableColumn[] = [ disabled: row.status === "normal", onClick: () => delJudgeServer(row.hostname), }, - () => "删除" + () => "删除", ), }, { title: "主机", key: "hostname", width: 130 }, @@ -94,7 +94,7 @@ const testcases = ref([]) const token = ref("") const servers = ref([]) const abnormalServers = computed(() => - servers.value.filter((item) => item.status === "abnormal") + servers.value.filter((item) => item.status === "abnormal"), ) const websiteConfig = reactive({ @@ -144,7 +144,7 @@ async function delJudgeServer(hostname: string) { async function deleteAbnormalServers() { const dels = abnormalServers.value.map((item) => - deleteJudgeServer(item.hostname) + deleteJudgeServer(item.hostname), ) await Promise.all(dels) message.success("删除成功") diff --git a/src/components.d.ts b/src/components.d.ts index 55d2248..ccb4b07 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -24,6 +24,7 @@ declare module 'vue' { NCheckbox: typeof import('naive-ui')['NCheckbox'] NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup'] NCode: typeof import('naive-ui')['NCode'] + NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NDataTable: typeof import('naive-ui')['NDataTable'] NDatePicker: typeof import('naive-ui')['NDatePicker'] diff --git a/src/learn/index.vue b/src/learn/index.vue index 532a7d8..5deff03 100644 --- a/src/learn/index.vue +++ b/src/learn/index.vue @@ -10,7 +10,7 @@ const router = useRouter() const learnStore = useLearnStore() const Mds = Array.from({ length: learnStore.total }, (_, i) => i + 1).map((v) => - defineAsyncComponent(() => import(`./step-${v}/index.md`)) + defineAsyncComponent(() => import(`./step-${v}/index.md`)), ) watch( @@ -24,7 +24,7 @@ watch( router.replace("/learn/step-1") } }, - { immediate: true } + { immediate: true }, ) diff --git a/src/oj/api.ts b/src/oj/api.ts index 0ba53f8..5480635 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -36,7 +36,7 @@ export function getWebsiteConfig() { export async function getProblemList( offset = 0, limit = 10, - searchParams: any = {} + searchParams: any = {}, ) { let params: any = { paging: true, @@ -129,7 +129,7 @@ export async function getContestProblems(contestID: string) { export function getContestRank( contestID: string, - query: { limit: number; offset: number; force_refresh: "1" | "0" } + query: { limit: number; offset: number; force_refresh: "1" | "0" }, ) { return http.get("contest_rank", { params: { diff --git a/src/oj/contest/detail.vue b/src/oj/contest/detail.vue index da79f58..05cf2ac 100644 --- a/src/oj/contest/detail.vue +++ b/src/oj/contest/detail.vue @@ -24,7 +24,7 @@ const passwordFormVisible = computed( () => contestStore.isPrivate && !contestStore.access && - !contestStore.isContestAdmin + !contestStore.isContestAdmin, ) diff --git a/src/oj/contest/list.vue b/src/oj/contest/list.vue index 2523041..b7b1ae6 100644 --- a/src/oj/contest/list.vue +++ b/src/oj/contest/list.vue @@ -37,7 +37,7 @@ const columns: DataTableColumn[] = [ h( NTag, { type: CONTEST_STATUS[row.status]["type"] }, - () => CONTEST_STATUS[row.status]["name"] + () => CONTEST_STATUS[row.status]["name"], ), }, { @@ -95,13 +95,13 @@ watch( () => { query.page = 1 routerPush() - } + }, ) watch( () => route.name === "contests" && route.query, (newVal) => { if (newVal) listContests() - } + }, ) function rowProps(row: Contest) { diff --git a/src/oj/contest/pages/rank.vue b/src/oj/contest/pages/rank.vue index 5e03420..b52d544 100644 --- a/src/oj/contest/pages/rank.vue +++ b/src/oj/contest/pages/rank.vue @@ -33,7 +33,7 @@ const { resume, pause } = useIntervalFn( 10000, { immediate: false, - } + }, ) const query = reactive({ @@ -64,7 +64,7 @@ const columns = ref[]>([ type: "info", onClick: () => router.push("/user?name=" + row.user.username), }, - () => row.user.username + () => row.user.username, ), }, { @@ -119,7 +119,7 @@ async function addColumns() { window.open(data.href, "_blank") }, }, - () => problem.title + () => problem.title, ), render: (row) => { if (row.submission_info[problem.id]) { @@ -134,7 +134,7 @@ async function addColumns() { h( NIcon, { size: 16, style: "transform: translate(-2px, 3px)" }, - () => h(GoldMedal) + () => h(GoldMedal), ), secondsToDuration(status.ac_time), ] @@ -143,7 +143,7 @@ async function addColumns() { errorNumber = h( "p", { style: "margin: 0" }, - `(-${status.error_number})` + `(-${status.error_number})`, ) } return h("div", [acTime, errorNumber]) @@ -182,7 +182,7 @@ watch( () => { query.page = 1 listRanks() - } + }, ) watch(autoRefresh, (checked) => (checked ? resume() : pause())) diff --git a/src/oj/problem/components/Editor.vue b/src/oj/problem/components/Editor.vue index 9ac3540..caff344 100644 --- a/src/oj/problem/components/Editor.vue +++ b/src/oj/problem/components/Editor.vue @@ -13,7 +13,7 @@ const contestID = !!route.params.contestID ? route.params.contestID : null const storageKey = computed( () => - `problem_${problem.value!._id}_contest_${contestID}_lang_${code.language}` + `problem_${problem.value!._id}_contest_${contestID}_lang_${code.language}`, ) onMounted(() => { @@ -26,7 +26,7 @@ onMounted(() => { }) const editorHeight = computed(() => - isDesktop.value ? "calc(100vh - 133px)" : "calc(100vh - 172px)" + isDesktop.value ? "calc(100vh - 133px)" : "calc(100vh - 172px)", ) function changeCode(v: string) { diff --git a/src/oj/problem/components/ProblemContent.vue b/src/oj/problem/components/ProblemContent.vue index d68d33a..1ac7ae3 100644 --- a/src/oj/problem/components/ProblemContent.vue +++ b/src/oj/problem/components/ProblemContent.vue @@ -23,7 +23,7 @@ const samples = ref( msg: "", status: "not_test", loading: false, - })) + })), ) async function test(sample: Sample, index: number) { @@ -202,7 +202,8 @@ function type(status: ProblemStatus) { border: 1px solid rgb(239, 239, 245); word-break: break-word; box-sizing: border-box; - transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), + transition: + background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1); } @@ -219,13 +220,15 @@ function type(status: ProblemStatus) { width: 100%; border-spacing: 0; border: 1px solid rgba(239, 239, 245, 1); - transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), + transition: + background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .problemContent > .content > table th { background-color: rgba(250, 250, 252, 1); - transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), + transition: + background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1); } diff --git a/src/oj/problem/components/ProblemSubmission.vue b/src/oj/problem/components/ProblemSubmission.vue index 5ce69f9..bc62ad0 100644 --- a/src/oj/problem/components/ProblemSubmission.vue +++ b/src/oj/problem/components/ProblemSubmission.vue @@ -1,100 +1,100 @@ - - + + diff --git a/src/oj/problem/components/Submit.vue b/src/oj/problem/components/Submit.vue index 6ef917b..378ac4c 100644 --- a/src/oj/problem/components/Submit.vue +++ b/src/oj/problem/components/Submit.vue @@ -39,17 +39,21 @@ const { start: fetchSubmission } = useTimeoutFn( } }, 2000, - { immediate: false } + { immediate: false }, ) const judging = computed( () => - !!(submission.value && submission.value.result === SubmissionStatus.judging) + !!( + submission.value && submission.value.result === SubmissionStatus.judging + ), ) const pending = computed( () => - !!(submission.value && submission.value.result === SubmissionStatus.pending) + !!( + submission.value && submission.value.result === SubmissionStatus.pending + ), ) const submitting = computed( @@ -57,7 +61,7 @@ const submitting = computed( !!( submission.value && submission.value.result === SubmissionStatus.submitting - ) + ), ) const submitDisabled = computed(() => { @@ -186,7 +190,7 @@ watch( size: party.variation.skew(2, 0.3), }) } - } + }, ) diff --git a/src/oj/problem/components/TestCat.vue b/src/oj/problem/components/TestCat.vue index 230e716..f2d6026 100644 --- a/src/oj/problem/components/TestCat.vue +++ b/src/oj/problem/components/TestCat.vue @@ -1,47 +1,47 @@ - - - + + + diff --git a/src/oj/problem/list.vue b/src/oj/problem/list.vue index 34b8d4a..29dd138 100644 --- a/src/oj/problem/list.vue +++ b/src/oj/problem/list.vue @@ -7,6 +7,7 @@ import Pagination from "~/shared/Pagination.vue" import { NSpace, NTag } from "naive-ui" import ProblemStatus from "./components/ProblemStatus.vue" import { getProblemTagList } from "~/shared/api" +import { isDesktop } from "~/shared/composables/breakpoints" interface Tag { id: number @@ -36,6 +37,7 @@ const userStore = useUserStore() const problems = ref([]) const total = ref(0) const tags = ref([]) +const [showTag, toggleShowTag] = useToggle(isDesktop.value) const query = reactive({ keyword: route.query.keyword ?? "", @@ -112,14 +114,14 @@ watch( () => { query.page = 1 routerPush() - } + }, ) watch( () => route.path === "/" && route.query, (newVal) => { if (newVal) listProblems() - } + }, ) // TODO: 这里会在登录时候执行两次,有BUG @@ -130,7 +132,7 @@ onMounted(() => { listTags() }) -const columns: DataTableColumn[] = [ +const baseColumns: DataTableColumn[] = [ { title: "状态", key: "status", @@ -157,6 +159,12 @@ const columns: DataTableColumn[] = [ { title: "通过率", key: "rate", width: 100 }, ] +const columns = computed(() => + userStore.isAuthed + ? baseColumns + : baseColumns.filter((c: any) => c.key !== "status"), +) + function rowProps(row: ProblemFiltered) { return { style: "cursor: pointer", @@ -191,20 +199,22 @@ function rowProps(row: ProblemFiltered) { + 标签 - -
标签
- - {{ tag.name }} - -
+ + + + {{ tag.name }} + + + [] = [ type: "info", onClick: () => router.push("/user?name=" + row.user.username), }, - () => row.user.username + () => row.user.username, ), }, { title: "自我介绍", key: "mood", minWidth: 200 }, @@ -67,7 +67,7 @@ watch( () => { query.page = 1 listRanks() - } + }, ) onMounted(listRanks) diff --git a/src/oj/store/contest.ts b/src/oj/store/contest.ts index 3c266df..dfe4726 100644 --- a/src/oj/store/contest.ts +++ b/src/oj/store/contest.ts @@ -48,11 +48,11 @@ export const useContestStore = defineStore("contest", () => { () => userStore.isSuperAdmin || (userStore.isAuthed && - contest.value?.created_by.id === userStore.user!.id) + contest.value?.created_by.id === userStore.user!.id), ) const isPrivate = computed( - () => contest.value!.contest_type === ContestType.private + () => contest.value!.contest_type === ContestType.private, ) async function init(contestID: string) { diff --git a/src/oj/submission/list.vue b/src/oj/submission/list.vue index c40a5a4..aadf9f2 100644 --- a/src/oj/submission/list.vue +++ b/src/oj/submission/list.vue @@ -102,7 +102,7 @@ watch( () => { query.page = 1 routerPush() - } + }, ) watch( @@ -111,7 +111,7 @@ watch( route.query, (newVal) => { if (newVal) listSubmissions() - } + }, ) const columns = computed(() => { @@ -123,7 +123,7 @@ const columns = computed(() => { render: (row) => parseTime( row.create_time, - isDesktop ? "YYYY-MM-DD HH:mm:ss" : "M-D hh:mm" + isDesktop ? "YYYY-MM-DD HH:mm:ss" : "M-D hh:mm", ), }, { @@ -139,7 +139,7 @@ const columns = computed(() => { type: "info", onClick: () => router.push("/submission/" + row.id), }, - () => row.id.slice(0, 12) + () => row.id.slice(0, 12), ) } else { return row.id.slice(0, 12) @@ -175,7 +175,7 @@ const columns = computed(() => { } }, }, - () => row.problem + () => row.problem, ), }, { @@ -208,7 +208,7 @@ const columns = computed(() => { type: "info", onClick: () => router.push("/user?name=" + row.username), }, - () => row.username + () => row.username, ), }, ] @@ -225,7 +225,7 @@ const columns = computed(() => { type: "primary", onClick: () => rejudge(row.id), }, - () => "重新判题" + () => "重新判题", ), }) } diff --git a/src/shared/CodeEditor.vue b/src/shared/CodeEditor.vue index 3f03f9d..a960e08 100644 --- a/src/shared/CodeEditor.vue +++ b/src/shared/CodeEditor.vue @@ -39,7 +39,7 @@ watch( () => props.modelValue, (v) => { code.value = v - } + }, ) const emit = defineEmits(["update:modelValue"]) diff --git a/src/shared/ContestType.vue b/src/shared/ContestType.vue index 58cecb4..59e5545 100644 --- a/src/shared/ContestType.vue +++ b/src/shared/ContestType.vue @@ -10,7 +10,7 @@ interface Props { const props = defineProps() const isPrivate = computed( - () => props.contest.contest_type === ContestType.private + () => props.contest.contest_type === ContestType.private, ) diff --git a/src/shared/Header.vue b/src/shared/Header.vue index 9ccfb91..6afc909 100644 --- a/src/shared/Header.vue +++ b/src/shared/Header.vue @@ -6,7 +6,10 @@ import { isDark, toggleDark } from "~/shared/composables/dark" import { toggleLogin, toggleSignup } from "~/shared/composables/modal" import { RouterLink } from "vue-router" import { isDesktop, isMobile } from "~/shared/composables/breakpoints" -import { screenSwitchLabel, switchScreenMode } from "~/shared/composables/switchScreen" +import { + screenSwitchLabel, + switchScreenMode, +} from "~/shared/composables/switchScreen" import { code } from "~/shared/composables/learn" import { useLearnStore } from "~/learn/store" diff --git a/src/shared/composables/chart.ts b/src/shared/composables/chart.ts index d4801e3..cb5d61b 100644 --- a/src/shared/composables/chart.ts +++ b/src/shared/composables/chart.ts @@ -22,7 +22,7 @@ export function loadChart() { Colors, Title, Tooltip, - Legend + Legend, ) isLoaded.value = true } diff --git a/src/shared/layout/admin.vue b/src/shared/layout/admin.vue index 4a02412..372538d 100644 --- a/src/shared/layout/admin.vue +++ b/src/shared/layout/admin.vue @@ -26,7 +26,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/problem/list" }, - { default: () => "题目列表" } + { default: () => "题目列表" }, ), key: "admin problem list", }, @@ -35,7 +35,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/problem/create" }, - { default: () => "新建题目" } + { default: () => "新建题目" }, ), key: "admin problem create", }, @@ -50,7 +50,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/user/generate" }, - { default: () => "批量生成" } + { default: () => "批量生成" }, ), key: "admin user generate", }, @@ -60,7 +60,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/contest/list" }, - { default: () => "比赛列表" } + { default: () => "比赛列表" }, ), key: "admin contest list", }, @@ -69,7 +69,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/contest/create" }, - { default: () => "新建比赛" } + { default: () => "新建比赛" }, ), key: "admin contest create", }, @@ -84,7 +84,7 @@ const options: MenuOption[] = [ h( RouterLink, { to: "/admin/announcement" }, - { default: () => "公告配置" } + { default: () => "公告配置" }, ), key: "admin announcement", }, diff --git a/src/shared/store/user.ts b/src/shared/store/user.ts index e1e4967..64df701 100644 --- a/src/shared/store/user.ts +++ b/src/shared/store/user.ts @@ -11,13 +11,13 @@ export const useUserStore = defineStore("user", () => { const isAdminRole = computed( () => user.value?.admin_type === USER_TYPE.ADMIN || - user.value?.admin_type === USER_TYPE.SUPER_ADMIN + user.value?.admin_type === USER_TYPE.SUPER_ADMIN, ) const isSuperAdmin = computed( - () => user.value?.admin_type === USER_TYPE.SUPER_ADMIN + () => user.value?.admin_type === USER_TYPE.SUPER_ADMIN, ) const hasProblemPermission = computed( - () => user.value?.problem_permission !== PROBLEM_PERMISSION.NONE + () => user.value?.problem_permission !== PROBLEM_PERMISSION.NONE, ) async function getMyProfile() { diff --git a/src/shared/themes/createTheme.ts b/src/shared/themes/createTheme.ts index 8df8e94..343943f 100644 --- a/src/shared/themes/createTheme.ts +++ b/src/shared/themes/createTheme.ts @@ -100,7 +100,7 @@ export const createTheme = ({ }, { dark: variant === "dark", - } + }, ) const highlightStyle = HighlightStyle.define(styles) diff --git a/src/shared/themes/oneDark.ts b/src/shared/themes/oneDark.ts index 716eeac..a2ebfda 100644 --- a/src/shared/themes/oneDark.ts +++ b/src/shared/themes/oneDark.ts @@ -92,7 +92,7 @@ const oneDarkTheme = EditorView.theme( }, }, }, - { dark: true } + { dark: true }, ) /// The highlighting style for code in the One Dark theme. diff --git a/src/utils/download.ts b/src/utils/download.ts index 73cfd92..327e17a 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -12,7 +12,7 @@ async function download(url: string) { const headers = res.headers const link = document.createElement("a") link.href = window.URL.createObjectURL( - new window.Blob([res.data], { type: headers["content-type"] }) + new window.Blob([res.data], { type: headers["content-type"] }), ) link.download = (headers["content-disposition"] || "").split("filename=")[1] document.body.appendChild(link) diff --git a/src/utils/functions.ts b/src/utils/functions.ts index d3878a6..8d33bb8 100644 --- a/src/utils/functions.ts +++ b/src/utils/functions.ts @@ -18,7 +18,7 @@ export function filterEmptyValue(object: any) { } export function getTagColor( - tag: "Low" | "Mid" | "High" | "简单" | "中等" | "困难" + tag: "Low" | "Mid" | "High" | "简单" | "中等" | "困难", ) { return <"success" | "info" | "error">{ Low: "success", @@ -39,7 +39,7 @@ export function parseTime(utc: Date | string, format = "YYYY年M月D日") { export function duration( start: Date | string, end: Date | string, - showSeconds = false + showSeconds = false, ): string { const duration = intervalToDuration({ start: getTime(parseISO(start.toString())), @@ -141,8 +141,8 @@ export function decode(bytes?: string) { const latin = atob(bytes ?? "") return new TextDecoder("utf-8").decode( Uint8Array.from({ length: latin.length }, (_, index) => - latin.charCodeAt(index) - ) + latin.charCodeAt(index), + ), ) } diff --git a/src/utils/http.ts b/src/utils/http.ts index e38824c..336a833 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -19,7 +19,7 @@ http.interceptors.response.use( }, (err) => { return Promise.reject(err) - } + }, ) export default http