add breakpoints.

This commit is contained in:
2023-01-07 15:29:47 +08:00
parent b9c6b404d3
commit bb70ae2200
13 changed files with 136 additions and 127 deletions

6
src/utils/breakpoints.ts Normal file
View File

@@ -0,0 +1,6 @@
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
const breakpoints = useBreakpoints(breakpointsTailwind)
export const isMobile = breakpoints.smallerOrEqual("md")
export const isDesktop = breakpoints.greater("md")

View File

@@ -116,7 +116,6 @@ export const PROBLEM_PERMISSION = {
export const STORAGE_KEY = {
AUTHED: "authed",
PROBLEM_CODE: "problemCode",
USER: "user",
}
export const DIFFICULTY = {
@@ -125,24 +124,6 @@ export const DIFFICULTY = {
High: "困难",
}
export function getTagColor(tag: string) {
return {
Low: "success",
Mid: "",
High: "danger",
: "success",
: "",
: "danger",
}[tag]
}
export function buildProblemCodeKey(problemID: string, contestID = "") {
if (contestID) {
return `${STORAGE_KEY.PROBLEM_CODE}_${contestID}_${problemID}`
}
return `${STORAGE_KEY.PROBLEM_CODE}_NaN_${problemID}`
}
const cSource =
'#include<stdio.h>\r\n\r\nint main()\r\n{\r\n printf("黄岩一职");\r\n return 0;\r\n}'
const cppSource =

View File

@@ -1,3 +1,5 @@
import { STORAGE_KEY } from "./constants"
export function getACRate(acCount: number, totalCount: number) {
let rate = totalCount === 0 ? 0.0 : ((acCount / totalCount) * 100).toFixed(2)
return `${rate}%`
@@ -12,3 +14,21 @@ export function filterEmptyValue(object: any) {
})
return query
}
export function buildProblemCodeKey(problemID: string, contestID = "") {
if (contestID) {
return `${STORAGE_KEY.PROBLEM_CODE}_${contestID}_${problemID}`
}
return `${STORAGE_KEY.PROBLEM_CODE}_NaN_${problemID}`
}
export function getTagColor(tag: string) {
return {
Low: "success",
Mid: "",
High: "danger",
: "success",
: "",
: "danger",
}[tag]
}