Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
530e1a3d5d
commit
195069450f
480 files changed
+15507
-24650
No files matched your search
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { useThemeVars } from "naive-ui"
|
||||
import { useSubmissionStore } from "oj/store/submission"
|
||||
import { SubmissionStatus } from "utils/constants"
|
||||
import TrialErrorNote from "./TrialErrorNote.vue"
|
||||
import WrongAnswerExplain from "./WrongAnswerExplain.vue"
|
||||
import ResultHeader from "./ResultHeader.vue"
|
||||
import { useThemeVars } from 'naive-ui'
|
||||
import { useSubmissionStore } from 'oj/store/submission'
|
||||
import { SubmissionStatus } from 'utils/constants'
|
||||
import TrialErrorNote from './TrialErrorNote.vue'
|
||||
import WrongAnswerExplain from './WrongAnswerExplain.vue'
|
||||
import ResultHeader from './ResultHeader.vue'
|
||||
|
||||
/**
|
||||
* 「结果」页签里「运行例子」那一段:每个例子对没对上,点一个看细节。
|
||||
@@ -16,9 +16,7 @@ const theme = useThemeVars()
|
||||
const route = useRoute()
|
||||
const inContest = computed(() => !!route.params.contestID)
|
||||
|
||||
const failedCount = computed(
|
||||
() => sampleRuns.value.filter((run) => run.result !== SubmissionStatus.accepted).length,
|
||||
)
|
||||
const failedCount = computed(() => sampleRuns.value.filter((run) => run.result !== SubmissionStatus.accepted).length)
|
||||
|
||||
/**
|
||||
* 一个例子都没跑起来:编译 / 语法没过,或者试跑服务本身没跑成(排队满了、判题机连不上)。
|
||||
@@ -29,11 +27,8 @@ const header = computed(() => {
|
||||
const first = runs[0]
|
||||
if (first && runs.every((run) => run.result === SubmissionStatus.compile_error)) {
|
||||
return {
|
||||
kind: "warning" as const,
|
||||
title:
|
||||
samplesCode.value?.language === "Python"
|
||||
? "试跑:代码有语法错误,一个例子都没跑"
|
||||
: "试跑:编译没通过,一个例子都没跑",
|
||||
kind: 'warning' as const,
|
||||
title: samplesCode.value?.language === 'Python' ? '试跑:代码有语法错误,一个例子都没跑' : '试跑:编译没通过,一个例子都没跑',
|
||||
chips: false,
|
||||
}
|
||||
}
|
||||
@@ -41,14 +36,14 @@ const header = computed(() => {
|
||||
// 输出太多是程序自己的问题(多半死循环),其余带 note 的都是没跑成
|
||||
const ran = first.result === SubmissionStatus.runtime_error
|
||||
return {
|
||||
kind: ran ? ("error" as const) : ("warning" as const),
|
||||
title: ran ? "试跑:程序一直在输出,停不下来" : "试跑没跑成",
|
||||
kind: ran ? ('error' as const) : ('warning' as const),
|
||||
title: ran ? '试跑:程序一直在输出,停不下来' : '试跑没跑成',
|
||||
chips: false,
|
||||
}
|
||||
}
|
||||
return {
|
||||
kind: failedCount.value ? ("error" as const) : ("success" as const),
|
||||
title: failedCount.value ? `试跑:${failedCount.value} 个例子没对上` : "试跑:例子都对上了",
|
||||
kind: failedCount.value ? ('error' as const) : ('success' as const),
|
||||
title: failedCount.value ? `试跑:${failedCount.value} 个例子没对上` : '试跑:例子都对上了',
|
||||
chips: true,
|
||||
}
|
||||
})
|
||||
@@ -68,11 +63,7 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
<span>正在用例子试跑……</span>
|
||||
</n-flex>
|
||||
|
||||
<n-empty
|
||||
v-else-if="!sampleRuns.length"
|
||||
class="state"
|
||||
description="还没运行过。点工具栏的「运行例子」,用题目里的例子试跑一遍,不算提交"
|
||||
/>
|
||||
<n-empty v-else-if="!sampleRuns.length" class="state" description="还没运行过。点工具栏的「运行例子」,用题目里的例子试跑一遍,不算提交" />
|
||||
|
||||
<n-flex v-else vertical :size="12">
|
||||
<!-- 设计稿「运行例子:例子 2 没对上(不算提交)」:标题、「不算提交」、各例子的芯片在一行 -->
|
||||
@@ -84,10 +75,7 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
:key="run.index"
|
||||
type="button"
|
||||
class="run"
|
||||
:class="[
|
||||
run.result === SubmissionStatus.accepted ? 'ok' : 'bad',
|
||||
{ active: selected === run.index },
|
||||
]"
|
||||
:class="[run.result === SubmissionStatus.accepted ? 'ok' : 'bad', { active: selected === run.index }]"
|
||||
:aria-pressed="selected === run.index"
|
||||
@click="selected = run.index"
|
||||
>
|
||||
@@ -105,17 +93,7 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
>
|
||||
<path d="M5 12l5 5 9-10" />
|
||||
</svg>
|
||||
<svg
|
||||
v-else
|
||||
width="11"
|
||||
height="11"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="3"
|
||||
stroke-linecap="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<svg v-else width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" aria-hidden="true">
|
||||
<path d="M6 6l12 12M18 6L6 18" />
|
||||
</svg>
|
||||
例子 {{ run.index + 1 }}
|
||||
@@ -202,13 +180,13 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
.run.ok {
|
||||
border: 1px solid rgba(24, 160, 88, 0.35);
|
||||
background-color: rgba(24, 160, 88, 0.1);
|
||||
color: v-bind("theme.successColorPressed");
|
||||
color: v-bind('theme.successColorPressed');
|
||||
}
|
||||
|
||||
.run.bad {
|
||||
border: 1px solid rgba(208, 48, 80, 0.4);
|
||||
background-color: rgba(208, 48, 80, 0.07);
|
||||
color: v-bind("theme.errorColorPressed");
|
||||
color: v-bind('theme.errorColorPressed');
|
||||
}
|
||||
|
||||
.run.active {
|
||||
@@ -217,18 +195,18 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
}
|
||||
|
||||
.run.ok.active {
|
||||
border-color: v-bind("theme.successColor");
|
||||
border-color: v-bind('theme.successColor');
|
||||
}
|
||||
|
||||
.run.bad.active {
|
||||
border-color: v-bind("theme.errorColor");
|
||||
border-color: v-bind('theme.errorColor');
|
||||
}
|
||||
|
||||
.passed-card {
|
||||
padding: 12px 14px;
|
||||
border-radius: 6px;
|
||||
background-color: rgba(128, 128, 128, 0.06);
|
||||
border: 1px solid v-bind("theme.dividerColor");
|
||||
border: 1px solid v-bind('theme.dividerColor');
|
||||
}
|
||||
|
||||
.blocks {
|
||||
@@ -241,8 +219,8 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
min-width: 0;
|
||||
padding: 6px 10px 8px;
|
||||
border-radius: 5px;
|
||||
background-color: v-bind("theme.cardColor");
|
||||
border: 1px solid v-bind("theme.dividerColor");
|
||||
background-color: v-bind('theme.cardColor');
|
||||
border: 1px solid v-bind('theme.dividerColor');
|
||||
}
|
||||
|
||||
.label {
|
||||
@@ -262,6 +240,6 @@ const current = computed(() => sampleRuns.value[selected.value] ?? null)
|
||||
.note {
|
||||
margin: 12px 0 0;
|
||||
font-size: 13px;
|
||||
color: v-bind("theme.textColor3");
|
||||
color: v-bind('theme.textColor3');
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user