From 97baf85611059174ca66cd91bcd7ed7cb2951610 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 7 Oct 2025 01:32:58 +0800 Subject: [PATCH] update --- src/oj/ai/analysis.vue | 7 +- src/oj/ai/components/AI.vue | 2 +- src/oj/ai/components/DifficultyChart.vue | 4 +- src/oj/ai/components/DurationChart.vue | 3 +- src/oj/ai/components/Heatmap.vue | 51 +++++--- src/oj/contest/list.vue | 70 +++++----- src/oj/problem/list.vue | 90 +++++++------ src/oj/store/ai.ts | 6 +- src/oj/submission/list.vue | 159 ++++++++++++----------- 9 files changed, 207 insertions(+), 185 deletions(-) diff --git a/src/oj/ai/analysis.vue b/src/oj/ai/analysis.vue index 8cd5c44..e20348d 100644 --- a/src/oj/ai/analysis.vue +++ b/src/oj/ai/analysis.vue @@ -35,7 +35,12 @@ - + diff --git a/src/oj/ai/components/AI.vue b/src/oj/ai/components/AI.vue index 7f069ed..5034705 100644 --- a/src/oj/ai/components/AI.vue +++ b/src/oj/ai/components/AI.vue @@ -66,4 +66,4 @@ watch( :deep(.md-editor-preview h1) { margin-top: 0; } - \ No newline at end of file + diff --git a/src/oj/ai/components/DifficultyChart.vue b/src/oj/ai/components/DifficultyChart.vue index 5da3bf2..7a5dfea 100644 --- a/src/oj/ai/components/DifficultyChart.vue +++ b/src/oj/ai/components/DifficultyChart.vue @@ -31,7 +31,9 @@ ChartJS.register( const aiStore = useAIStore() const show = computed(() => { - return Object.values(aiStore.detailsData.difficulty).reduce((a, b) => a + b, 0) > 0 + return ( + Object.values(aiStore.detailsData.difficulty).reduce((a, b) => a + b, 0) > 0 + ) }) const data = computed(() => { diff --git a/src/oj/ai/components/DurationChart.vue b/src/oj/ai/components/DurationChart.vue index 3dde9f2..b73334d 100644 --- a/src/oj/ai/components/DurationChart.vue +++ b/src/oj/ai/components/DurationChart.vue @@ -138,11 +138,10 @@ const options = computed>(() => { }, } }) - \ No newline at end of file + diff --git a/src/oj/ai/components/Heatmap.vue b/src/oj/ai/components/Heatmap.vue index c6e5508..40d6527 100644 --- a/src/oj/ai/components/Heatmap.vue +++ b/src/oj/ai/components/Heatmap.vue @@ -14,7 +14,12 @@ - + {{ day }} @@ -39,7 +44,11 @@
-
+
@@ -72,13 +81,18 @@ const LEGEND_HEIGHT = 20 const COLORS = ["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"] const WEEK_DAYS = ["", "一", "", "三", "", "五", ""] -const getColor = (count: number) => - count === 0 ? COLORS[0] : - count <= 2 ? COLORS[1] : - count <= 4 ? COLORS[2] : - count <= 7 ? COLORS[3] : COLORS[4] +const getColor = (count: number) => + count === 0 + ? COLORS[0] + : count <= 2 + ? COLORS[1] + : count <= 4 + ? COLORS[2] + : count <= 7 + ? COLORS[3] + : COLORS[4] -const cells = computed(() => +const cells = computed(() => aiStore.heatmapData.map((item, i) => ({ date: new Date(item.timestamp), count: item.value, @@ -87,17 +101,17 @@ const cells = computed(() => day: i % 7, x: Math.floor(i / 7) * CELL_TOTAL, y: (i % 7) * CELL_TOTAL, - })) + })), ) const monthLabels = computed(() => { const labels: { text: string; x: number }[] = [] let lastMonth = -1 - + cells.value.forEach((cell, i) => { const month = cell.date.getMonth() const isWeekStart = cell.date.getDay() === 0 || i === 0 - + if (month !== lastMonth && (isWeekStart || cell.date.getDay() <= 3)) { labels.push({ text: `${month + 1}月`, @@ -106,17 +120,16 @@ const monthLabels = computed(() => { lastMonth = month } }) - + return labels }) -const svgWidth = computed(() => - DAY_WIDTH + Math.ceil(cells.value.length / 7) * CELL_TOTAL + RIGHT_PADDING +const svgWidth = computed( + () => + DAY_WIDTH + Math.ceil(cells.value.length / 7) * CELL_TOTAL + RIGHT_PADDING, ) -const svgHeight = computed(() => - MONTH_HEIGHT + 7 * CELL_TOTAL + LEGEND_HEIGHT -) +const svgHeight = computed(() => MONTH_HEIGHT + 7 * CELL_TOTAL + LEGEND_HEIGHT) interface Cell { date: Date @@ -141,13 +154,13 @@ const tooltipStyle = computed(() => ({ top: `${tooltip.value?.y}px`, })) -const getTooltipText = (count: number) => +const getTooltipText = (count: number) => count === 0 ? "没有提交记录" : `提交了 ${count} 次` const showTooltip = (e: MouseEvent, cell: Cell) => { const rect = (e.target as HTMLElement).getBoundingClientRect() const containerRect = containerRef.value?.getBoundingClientRect() - + if (containerRect) { tooltip.value = { x: rect.left - containerRect.left + rect.width / 2, diff --git a/src/oj/contest/list.vue b/src/oj/contest/list.vue index af7338b..284ce59 100644 --- a/src/oj/contest/list.vue +++ b/src/oj/contest/list.vue @@ -130,42 +130,40 @@ function rowProps(row: Contest) {