This commit is contained in:
2025-10-07 01:32:58 +08:00
parent ed3cfaacd4
commit 97baf85611
9 changed files with 207 additions and 185 deletions

View File

@@ -35,7 +35,12 @@
</n-flex>
</n-gi>
<n-gi :span="5">
<AI v-if="aiStore.detailsData.solved.length > 0 && aiStore.detailsData.solved.length < 10" />
<AI
v-if="
aiStore.detailsData.solved.length > 0 &&
aiStore.detailsData.solved.length < 10
"
/>
</n-gi>
</n-grid>
</n-spin>

View File

@@ -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(() => {

View File

@@ -138,7 +138,6 @@ const options = computed<ChartOptions<"bar" | "line">>(() => {
},
}
})
</script>
<style scoped>
.chart {

View File

@@ -14,7 +14,12 @@
</g>
<g v-for="(day, i) in WEEK_DAYS" :key="i">
<text :x="0" :y="MONTH_HEIGHT + i * CELL_TOTAL + 8" class="label" font-size="9">
<text
:x="0"
:y="MONTH_HEIGHT + i * CELL_TOTAL + 8"
class="label"
font-size="9"
>
{{ day }}
</text>
</g>
@@ -39,7 +44,11 @@
<div class="legend">
<span></span>
<div class="legend-colors">
<div v-for="(color, i) in COLORS" :key="i" :style="{ backgroundColor: color }" />
<div
v-for="(color, i) in COLORS"
:key="i"
:style="{ backgroundColor: color }"
/>
</div>
<span></span>
</div>
@@ -73,10 +82,15 @@ 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]
count === 0
? COLORS[0]
: count <= 2
? COLORS[1]
: count <= 4
? COLORS[2]
: count <= 7
? COLORS[3]
: COLORS[4]
const cells = computed(() =>
aiStore.heatmapData.map((item, i) => ({
@@ -87,7 +101,7 @@ const cells = computed(() =>
day: i % 7,
x: Math.floor(i / 7) * CELL_TOTAL,
y: (i % 7) * CELL_TOTAL,
}))
})),
)
const monthLabels = computed(() => {
@@ -110,13 +124,12 @@ const monthLabels = computed(() => {
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

View File

@@ -130,7 +130,6 @@ function rowProps(row: Contest) {
</script>
<template>
<n-flex vertical size="large">
<n-card embedded>
<n-space>
<n-form :show-feedback="false" label-placement="left" inline>
<n-form-item label="比赛状态">
@@ -151,21 +150,20 @@ function rowProps(row: Contest) {
<n-form :show-feedback="false" label-placement="left" inline>
<n-form-item>
<n-input
style="width: 200px"
style="width: 180px"
clearable
v-model:value="query.keyword"
placeholder="比赛标题"
/>
</n-form-item>
<n-form-item>
<n-flex>
<n-flex :wrap="false">
<n-button @click="search(query.keyword)">搜索</n-button>
<n-button @click="clear" quaternary>重置</n-button>
</n-flex>
</n-form-item>
</n-form>
</n-space>
</n-card>
<n-data-table
:bordered="false"
:columns="columns"

View File

@@ -195,7 +195,6 @@ function rowProps(row: ProblemFiltered) {
<template>
<n-flex vertical size="large">
<n-card embedded>
<n-flex justify="space-between">
<n-space>
<n-form :show-feedback="false" inline label-placement="left">
@@ -242,7 +241,6 @@ function rowProps(row: ProblemFiltered) {
</n-space>
<Hitokoto v-if="isDesktop" />
</n-flex>
</n-card>
<n-collapse-transition :show="showTag">
<n-flex>
<n-tag

View File

@@ -51,7 +51,11 @@ export const useAIStore = defineStore("ai", () => {
}
// 统一获取分析数据details + duration
async function fetchAnalysisData(start: string, end: string, duration: string) {
async function fetchAnalysisData(
start: string,
end: string,
duration: string,
) {
loading.fetching = true
try {
await Promise.all([

View File

@@ -240,7 +240,6 @@ const columns = computed(() => {
</script>
<template>
<n-flex vertical size="large">
<n-card embedded>
<n-space>
<n-form :show-feedback="false" inline label-placement="left">
<n-form-item v-if="isDesktop && userStore.isAuthed" label="只看自己">
@@ -309,15 +308,19 @@ const columns = computed(() => {
/>
</n-form-item>
</n-form>
<n-form :show-feedback="false" inline label-placement="left">
<n-form-item v-if="todayCount > 0">
<n-form
:show-feedback="false"
inline
label-placement="left"
v-if="todayCount > 0"
>
<n-form-item>
<component :is="isDesktop ? NH2 : NText" class="todayCount">
<n-gradient-text>今日提交数{{ todayCount }}</n-gradient-text>
</component>
</n-form-item>
</n-form>
</n-space>
</n-card>
<n-data-table :bordered="false" :columns="columns" :data="submissions" />
</n-flex>
<Pagination