add auto-imports.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { useToggle } from "@vueuse/core"
|
||||
import { TabsPaneContext } from "element-plus"
|
||||
import { inject, onMounted, Ref, ref } from "vue"
|
||||
import { Problem } from "../../../utils/types"
|
||||
import { submissionExists } from "../../api"
|
||||
import SubmitPanel from "./submit-panel.vue"
|
||||
|
||||
const tab = ref("testcase")
|
||||
const submitPanelRef = ref<{ submit: Function }>()
|
||||
const problem = inject<Ref<Problem>>("problem")
|
||||
const problem = inject("problem") as Problem
|
||||
const id = ref(problem.id)
|
||||
const [tried] = useToggle()
|
||||
|
||||
onMounted(() => {
|
||||
@@ -16,7 +15,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
async function checkIfTried() {
|
||||
const res = await submissionExists(problem!.value.id)
|
||||
const res = await submissionExists(id.value)
|
||||
tried.value = res.data
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import loader, { Monaco } from "@monaco-editor/loader"
|
||||
import { ref, onBeforeUnmount, onMounted, watch, reactive, provide } from "vue"
|
||||
import {
|
||||
LANGUAGE_LABEL,
|
||||
LANGUAGE_VALUE,
|
||||
|
||||
@@ -29,7 +29,10 @@ defineProps<Props>()
|
||||
{{ problem.memory_limit }}MB
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="难度">
|
||||
<el-tag disable-transitions :type="getTagColor(problem.difficulty)">
|
||||
<el-tag
|
||||
disable-transitions
|
||||
:type="(getTagColor(problem.difficulty) as any)"
|
||||
>
|
||||
{{ DIFFICULTY[problem.difficulty] }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useTimeout, useTimeoutFn, useToggle } from "@vueuse/core"
|
||||
import { computed, inject, Ref, ref, watch } from "vue"
|
||||
import party from "party-js"
|
||||
import { useRoute } from "vue-router"
|
||||
import {
|
||||
SOURCES,
|
||||
JUDGE_STATUS,
|
||||
@@ -19,12 +16,16 @@ import {
|
||||
SubmitCodePayload,
|
||||
} from "../../../utils/types"
|
||||
import { getSubmission, submitCode } from "../../api"
|
||||
|
||||
import SubmissionResultTag from "../../components/submission-result-tag.vue"
|
||||
|
||||
const code = inject<{ value: string; language: LANGUAGE }>("code", {
|
||||
value: "",
|
||||
language: "C",
|
||||
})
|
||||
const problem = inject<Ref<Problem>>("problem")
|
||||
const problem = inject("problem") as Problem
|
||||
const template = ref(problem.template)
|
||||
const id = ref(problem.id)
|
||||
|
||||
const route = useRoute()
|
||||
const contestID = <string>route.params.contestID || ""
|
||||
@@ -79,7 +80,7 @@ const submitDisabled = computed(() => {
|
||||
const value = code.value
|
||||
if (
|
||||
value.trim() === "" ||
|
||||
value === problem!.value.template[code.language] ||
|
||||
value === template.value[code.language] ||
|
||||
value === SOURCES[code.language]
|
||||
) {
|
||||
return true
|
||||
@@ -151,7 +152,7 @@ const infoTable = computed(() => {
|
||||
|
||||
async function submit() {
|
||||
const data: SubmitCodePayload = {
|
||||
problem_id: problem!.value.id,
|
||||
problem_id: id.value,
|
||||
language: code.language,
|
||||
code: code.value,
|
||||
}
|
||||
@@ -198,7 +199,7 @@ defineExpose({ submit })
|
||||
<el-alert
|
||||
v-if="submission"
|
||||
:closable="false"
|
||||
:type="JUDGE_STATUS[submission.result]['alertType']"
|
||||
:type="(JUDGE_STATUS[submission.result]['alertType'] as any)"
|
||||
:title="JUDGE_STATUS[submission.result]['name']"
|
||||
>
|
||||
</el-alert>
|
||||
|
||||
@@ -4,7 +4,6 @@ import ProblemContent from "./components/problem-content.vue"
|
||||
import ProblemInfo from "./components/problem-info.vue"
|
||||
import { getProblem } from "../api"
|
||||
import { isDesktop, isMobile } from "../../utils/breakpoints"
|
||||
import { provide, readonly } from "vue"
|
||||
|
||||
interface Props {
|
||||
problemID: string
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, reactive, watch } from "vue"
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { useUserStore } from "../../shared/stores/user"
|
||||
import { filterEmptyValue, getTagColor } from "../../utils/functions"
|
||||
import { isDesktop } from "../../utils/breakpoints"
|
||||
@@ -22,7 +20,7 @@ const total = ref(0)
|
||||
const { data: tags } = getProblemTagList()
|
||||
|
||||
const query = reactive({
|
||||
keyword: route.query.keyword || "",
|
||||
keyword: (route.query.keyword as string) || "",
|
||||
difficulty: route.query.difficulty || "",
|
||||
tag: route.query.tag || "",
|
||||
page: parseInt(<string>route.query.page) || 1,
|
||||
@@ -30,7 +28,7 @@ const query = reactive({
|
||||
})
|
||||
|
||||
async function listProblems() {
|
||||
query.keyword = route.query.keyword || ""
|
||||
query.keyword = (route.query.keyword as string) || ""
|
||||
query.difficulty = route.query.difficulty || ""
|
||||
query.tag = route.query.tag || ""
|
||||
query.page = parseInt(<string>route.query.page) || 1
|
||||
@@ -155,7 +153,10 @@ onMounted(listProblems)
|
||||
<el-table-column prop="title" label="标题" />
|
||||
<el-table-column label="难度" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag disable-transitions :type="getTagColor(scope.row.difficulty)">
|
||||
<el-tag
|
||||
disable-transitions
|
||||
:type="(getTagColor(scope.row.difficulty) as any)"
|
||||
>
|
||||
{{ scope.row.difficulty }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user