fix testcat button.
This commit is contained in:
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
@@ -13,10 +13,10 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "current"
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm run build
|
- run: CI=false npm run build
|
||||||
|
|
||||||
- uses: easingthemes/ssh-deploy@v2.2.11
|
- uses: easingthemes/ssh-deploy@v2.2.11
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { problem } from "oj/composables/problem"
|
|||||||
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
||||||
import { useUserStore } from "~/shared/store/user"
|
import { useUserStore } from "~/shared/store/user"
|
||||||
import Submit from "./Submit.vue"
|
import Submit from "./Submit.vue"
|
||||||
import TestCat from "./TestCat.vue"
|
import TestCat from "./TestCat2.vue"
|
||||||
import storage from "~/utils/storage"
|
import storage from "~/utils/storage"
|
||||||
import { STORAGE_KEY } from "utils/constants"
|
import { STORAGE_KEY } from "utils/constants"
|
||||||
import { LANGUAGE } from "~/utils/types"
|
import { LANGUAGE } from "~/utils/types"
|
||||||
@@ -72,9 +72,6 @@ function changeLanguage(v: LANGUAGE) {
|
|||||||
:options="options"
|
:options="options"
|
||||||
/>
|
/>
|
||||||
<Submit />
|
<Submit />
|
||||||
<n-button :size="isDesktop ? 'medium' : 'small'" @click="reset">
|
|
||||||
重置
|
|
||||||
</n-button>
|
|
||||||
<n-dropdown
|
<n-dropdown
|
||||||
v-if="isMobile"
|
v-if="isMobile"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@@ -89,8 +86,15 @@ function changeLanguage(v: LANGUAGE) {
|
|||||||
</template>
|
</template>
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-dropdown>
|
</n-dropdown>
|
||||||
<TestCat v-if="isDesktop" />
|
<TestCat
|
||||||
|
v-if="isDesktop"
|
||||||
|
:lang="code.language"
|
||||||
|
:input="problem?.samples[0].input"
|
||||||
|
/>
|
||||||
<n-button v-if="isDesktop" @click="goSubmissions">提交信息</n-button>
|
<n-button v-if="isDesktop" @click="goSubmissions">提交信息</n-button>
|
||||||
|
<n-button :size="isDesktop ? 'medium' : 'small'" @click="reset">
|
||||||
|
重置
|
||||||
|
</n-button>
|
||||||
<n-button
|
<n-button
|
||||||
v-if="isDesktop && userStore.isSuperAdmin"
|
v-if="isDesktop && userStore.isSuperAdmin"
|
||||||
type="warning"
|
type="warning"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function clear() {
|
|||||||
@clickoutside="clear"
|
@clickoutside="clear"
|
||||||
>
|
>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-button>自测</n-button>
|
<n-button>快速测试</n-button>
|
||||||
</template>
|
</template>
|
||||||
<n-space vertical>
|
<n-space vertical>
|
||||||
<n-input type="textarea" v-model:value="input" />
|
<n-input type="textarea" v-model:value="input" />
|
||||||
|
|||||||
29
src/oj/problem/components/TestCat2.vue
Normal file
29
src/oj/problem/components/TestCat2.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { LANGUAGE } from "~/utils/types"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
lang: LANGUAGE
|
||||||
|
input: string
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
lang: "C",
|
||||||
|
input: "",
|
||||||
|
})
|
||||||
|
function gotoTestCat() {
|
||||||
|
const url = "https://code.hyyz.izhai.net/"
|
||||||
|
let id = 50
|
||||||
|
const lang = props.lang
|
||||||
|
if (lang === "Python3") id = 71
|
||||||
|
if (lang === "Java") id = 62
|
||||||
|
const payload = { input: props.input || "", id }
|
||||||
|
try {
|
||||||
|
const encoded = window.btoa(encodeURIComponent(JSON.stringify(payload)))
|
||||||
|
window.open(`${url}?stdin=${encoded}`, "_blank")
|
||||||
|
} catch (e) {
|
||||||
|
window.open(url, "_blank")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<n-button @click="gotoTestCat">自测猫</n-button>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user