add flowchart dead data info
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2025-12-13 17:48:31 +08:00
parent f0f9c74973
commit 1cb96a1073
8 changed files with 389 additions and 19 deletions

View File

@@ -63,9 +63,7 @@ defineProps<Props>()
{{ problemSet.problems_count }}
</n-descriptions-item>
<n-descriptions-item label="创建时间">
{{
parseTime(problemSet.create_time, "YYYY-MM-DD HH:mm:ss")
}}
{{ parseTime(problemSet.create_time, "YYYY-MM-DD HH:mm:ss") }}
</n-descriptions-item>
</n-descriptions>
</n-card>

View File

@@ -31,7 +31,8 @@ const progressColumns = [
title: "进度",
key: "progress_percentage",
width: 100,
render: (row: ProblemSetProgress) => `${row.progress_percentage.toFixed(0)}%`,
render: (row: ProblemSetProgress) =>
`${row.progress_percentage.toFixed(0)}%`,
},
{
title: "是否完成",

View File

@@ -12,7 +12,7 @@ interface Props {
}
interface Emits {
(e: 'join'): void
(e: "join"): void
}
const props = defineProps<Props>()
@@ -40,12 +40,12 @@ function getProgressPercentage() {
}
function handleJoin() {
emit('join')
emit("join")
}
</script>
<template>
<n-card style="margin-bottom: 24px;">
<n-card style="margin-bottom: 24px">
<n-flex justify="space-between" align="center">
<n-flex align="center">
<n-tag type="warning" v-if="problemSet.status === 'archived'">

View File

@@ -11,7 +11,7 @@ interface Props {
}
interface Emits {
(e: 'problem-click', problemId: string): void
(e: "problem-click", problemId: string): void
}
const props = defineProps<Props>()
@@ -20,7 +20,7 @@ const emit = defineEmits<Emits>()
const { isDesktop } = useBreakpoints()
function handleProblemClick(problemId: string) {
emit('problem-click', problemId)
emit("problem-click", problemId)
}
</script>

View File

@@ -48,10 +48,14 @@ async function loadUserProgress() {
// 监听分页参数变化
watch([() => query.page, () => query.limit], loadUserProgress)
// 监听班级过滤变化(防抖)
watchDebounced(classFilter, () => {
query.page = 1 // 重置到第一页
loadUserProgress()
}, { debounce: 500 })
watchDebounced(
classFilter,
() => {
query.page = 1 // 重置到第一页
loadUserProgress()
},
{ debounce: 500 },
)
// 使用后端返回的统计数据
const stats = computed(() => {

View File

@@ -59,6 +59,8 @@ const { query, clearQuery } = usePagination<SubmissionQuery>({
const submissionID = ref("")
const problemDisplayID = ref("")
const [statisticPanel, toggleStatisticPanel] = useToggle(false)
const [flowchartStatisticPanel, toggleFlowchartStatisticPanel] =
useToggle(false)
const [codePanel, toggleCodePanel] = useToggle(false)
const resultOptions: SelectOption[] = [
@@ -370,6 +372,13 @@ const flowchartColumns: DataTableColumn<FlowchartSubmissionListItem>[] = [
<IconButton
icon="streamline-emojis:bar-chart"
tip="数据统计"
v-if="query.language === 'Flowchart'"
@click="toggleFlowchartStatisticPanel(true)"
/>
<IconButton
icon="streamline-emojis:bar-chart"
tip="数据统计"
v-else
@click="toggleStatisticPanel(true)"
/>
</n-form-item>
@@ -415,6 +424,28 @@ const flowchartColumns: DataTableColumn<FlowchartSubmissionListItem>[] = [
>
<StatisticsPanel :problem="query.problem" :username="query.username" />
</n-modal>
<n-modal
v-if="query.language === 'Flowchart'"
v-model:show="flowchartStatisticPanel"
preset="card"
:style="{
width: isDesktop ? '90vw' : '100vw',
height: '90vh',
maxWidth: 'none',
}"
:content-style="{
height: 'calc(90vh - 100px)',
padding: '0',
overflow: 'hidden',
}"
title="流程图数据的统计"
>
<iframe
src="/flowchart-data.html"
frameborder="0"
class="flowchart-iframe"
></iframe>
</n-modal>
<n-modal
v-model:show="codePanel"
preset="card"
@@ -446,4 +477,11 @@ const flowchartColumns: DataTableColumn<FlowchartSubmissionListItem>[] = [
.todayCount {
margin: 0;
}
.flowchart-iframe {
width: 100%;
height: 100%;
border: none;
display: block;
}
</style>

View File

@@ -74,19 +74,19 @@ async function init() {
ac.sort()
problems.value = ac
const promises: Promise<{ data: any }>[] = []
if (profile.value.submission_number > 0) {
promises.push(getMetrics(profile.value.user.id))
}
if (route.query.name) {
if (route.query.name) {
promises.push(getUserBadges(<string>route.query.name))
} else {
promises.push(getUserBadges())
}
const results = await Promise.all(promises)
// 处理 metrics 结果
if (profile.value.submission_number > 0) {
const metricsRes = results[0]
@@ -101,7 +101,7 @@ async function init() {
metricsRes.data.latest,
)
}
// 处理 badges 结果
userBadges.value = groupBadgesByIcon(results[1].data)
} finally {