fix base64 encode/edcode.
This commit is contained in:
3
src/components.d.ts
vendored
3
src/components.d.ts
vendored
@@ -13,12 +13,10 @@ declare module '@vue/runtime-core' {
|
|||||||
IEpLock: typeof import('~icons/ep/lock')['default']
|
IEpLock: typeof import('~icons/ep/lock')['default']
|
||||||
IEpMenu: typeof import('~icons/ep/menu')['default']
|
IEpMenu: typeof import('~icons/ep/menu')['default']
|
||||||
IEpMoon: typeof import('~icons/ep/moon')['default']
|
IEpMoon: typeof import('~icons/ep/moon')['default']
|
||||||
IEpMore: typeof import('~icons/ep/more')['default']
|
|
||||||
IEpMoreFilled: typeof import('~icons/ep/more-filled')['default']
|
IEpMoreFilled: typeof import('~icons/ep/more-filled')['default']
|
||||||
IEpSunny: typeof import('~icons/ep/sunny')['default']
|
IEpSunny: typeof import('~icons/ep/sunny')['default']
|
||||||
NAlert: typeof import('naive-ui')['NAlert']
|
NAlert: typeof import('naive-ui')['NAlert']
|
||||||
NButton: typeof import('naive-ui')['NButton']
|
NButton: typeof import('naive-ui')['NButton']
|
||||||
NButtonGroup: typeof import('naive-ui')['NButtonGroup']
|
|
||||||
NCard: typeof import('naive-ui')['NCard']
|
NCard: typeof import('naive-ui')['NCard']
|
||||||
NCode: typeof import('naive-ui')['NCode']
|
NCode: typeof import('naive-ui')['NCode']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||||
@@ -39,7 +37,6 @@ declare module '@vue/runtime-core' {
|
|||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
NModal: typeof import('naive-ui')['NModal']
|
NModal: typeof import('naive-ui')['NModal']
|
||||||
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
|
||||||
NPagination: typeof import('naive-ui')['NPagination']
|
NPagination: typeof import('naive-ui')['NPagination']
|
||||||
NPopover: typeof import('naive-ui')['NPopover']
|
NPopover: typeof import('naive-ui')['NPopover']
|
||||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
|
|||||||
@@ -88,7 +88,11 @@ function getCurrentType(name: string): "primary" | "default" {
|
|||||||
<n-button :type="getCurrentType('rank')" @click="goto('rank')">
|
<n-button :type="getCurrentType('rank')" @click="goto('rank')">
|
||||||
比赛排名
|
比赛排名
|
||||||
</n-button>
|
</n-button>
|
||||||
<n-button :type="getCurrentType('helper')" @click="goto('helper')">
|
<n-button
|
||||||
|
v-if="contestStore.isContestAdmin"
|
||||||
|
:type="getCurrentType('helper')"
|
||||||
|
@click="goto('helper')"
|
||||||
|
>
|
||||||
管理员助手
|
管理员助手
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ onMounted(async () => {
|
|||||||
minimap: {
|
minimap: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
lineNumbersMinChars: 3,
|
lineNumbersMinChars: 2,
|
||||||
automaticLayout: true, // 自适应布局
|
automaticLayout: true, // 自适应布局
|
||||||
tabSize: 4,
|
tabSize: 4,
|
||||||
fontSize: isMobile.value ? 20 : 24, // 字体大小
|
fontSize: isMobile.value ? 20 : 24, // 字体大小
|
||||||
|
|||||||
@@ -4,17 +4,17 @@ import { Code } from "./types"
|
|||||||
|
|
||||||
const http = axios.create({ baseURL: "https://judge0api.hyyz.izhai.net" })
|
const http = axios.create({ baseURL: "https://judge0api.hyyz.izhai.net" })
|
||||||
|
|
||||||
function encode(str: string) {
|
function encode(string?: string) {
|
||||||
return btoa(unescape(encodeURIComponent(str ?? "")))
|
return btoa(String.fromCharCode(...new TextEncoder().encode(string ?? "")))
|
||||||
}
|
}
|
||||||
|
|
||||||
function decode(bytes: string) {
|
function decode(bytes?: string) {
|
||||||
let escaped = escape(atob(bytes ?? ""))
|
const latin = atob(bytes ?? "")
|
||||||
try {
|
return new TextDecoder("utf-8").decode(
|
||||||
return decodeURIComponent(escaped)
|
Uint8Array.from({ length: latin.length }, (_, index) =>
|
||||||
} catch (e) {
|
latin.charCodeAt(index)
|
||||||
return unescape(escaped)
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createTestSubmission(code: Code, input: string) {
|
export async function createTestSubmission(code: Code, input: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user