fix
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

This commit is contained in:
2026-06-05 10:39:35 -06:00
parent 9920bc4aed
commit 45a0638b7e
2 changed files with 28 additions and 14 deletions

View File

@@ -405,7 +405,9 @@ const flowchartColumns = computed(() => {
<n-select
class="select"
v-model:value="query.result"
:options="query.language === 'Flowchart' ? gradeOptions : resultOptions"
:options="
query.language === 'Flowchart' ? gradeOptions : resultOptions
"
/>
</n-form-item>
</n-form>

View File

@@ -437,31 +437,43 @@ const criteriaBarChartData = computed(() => {
{
label: "平均得分",
data: labels.map((k) => data.criteria_averages[k]?.avg ?? 0),
backgroundColor: "rgba(32, 128, 240, 0.6)",
borderColor: "rgba(32, 128, 240, 1)",
backgroundColor: labels.map(
(_, i) => GRADE_COLORS[["S", "A", "B", "C"][i]].bg,
),
borderColor: labels.map(
(_, i) => GRADE_COLORS[["S", "A", "B", "C"][i]].border,
),
borderWidth: 2,
},
{
label: "满分",
data: labels.map((k) => data.criteria_averages[k]?.max ?? 0),
backgroundColor: "rgba(200, 200, 200, 0.3)",
borderColor: "rgba(150, 150, 150, 0.8)",
borderWidth: 1,
},
],
}
})
const barOptions = {
const barYMax = computed(() => {
const maxes = CRITERIA_ORDER.map((k) => data.criteria_averages[k]?.max ?? 0)
return Math.max(...maxes, 10)
})
const barOptions = computed(() => ({
responsive: true,
maintainAspectRatio: false,
scales: {
y: { beginAtZero: true },
y: { beginAtZero: true, max: barYMax.value },
},
plugins: {
legend: { position: "bottom" as const },
legend: { display: false },
tooltip: {
callbacks: {
label(context: any) {
const key = context.label
const item = data.criteria_averages[key]
if (!item) return ""
return `${item.avg} / ${item.max}`
},
},
},
},
}
}))
const WORD_COLORS = [
"#2080f0",