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-flex>
</n-gi> </n-gi>
<n-gi :span="5"> <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-gi>
</n-grid> </n-grid>
</n-spin> </n-spin>

View File

@@ -31,7 +31,9 @@ ChartJS.register(
const aiStore = useAIStore() const aiStore = useAIStore()
const show = computed(() => { 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(() => { const data = computed(() => {

View File

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

View File

@@ -14,7 +14,12 @@
</g> </g>
<g v-for="(day, i) in WEEK_DAYS" :key="i"> <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 }} {{ day }}
</text> </text>
</g> </g>
@@ -39,7 +44,11 @@
<div class="legend"> <div class="legend">
<span></span> <span></span>
<div class="legend-colors"> <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> </div>
<span></span> <span></span>
</div> </div>
@@ -73,10 +82,15 @@ const COLORS = ["#ebedf0", "#c6e48b", "#7bc96f", "#239a3b", "#196127"]
const WEEK_DAYS = ["", "一", "", "三", "", "五", ""] const WEEK_DAYS = ["", "一", "", "三", "", "五", ""]
const getColor = (count: number) => const getColor = (count: number) =>
count === 0 ? COLORS[0] : count === 0
count <= 2 ? COLORS[1] : ? COLORS[0]
count <= 4 ? COLORS[2] : : count <= 2
count <= 7 ? COLORS[3] : COLORS[4] ? COLORS[1]
: count <= 4
? COLORS[2]
: count <= 7
? COLORS[3]
: COLORS[4]
const cells = computed(() => const cells = computed(() =>
aiStore.heatmapData.map((item, i) => ({ aiStore.heatmapData.map((item, i) => ({
@@ -87,7 +101,7 @@ const cells = computed(() =>
day: i % 7, day: i % 7,
x: Math.floor(i / 7) * CELL_TOTAL, x: Math.floor(i / 7) * CELL_TOTAL,
y: (i % 7) * CELL_TOTAL, y: (i % 7) * CELL_TOTAL,
})) })),
) )
const monthLabels = computed(() => { const monthLabels = computed(() => {
@@ -110,13 +124,12 @@ const monthLabels = computed(() => {
return labels return labels
}) })
const svgWidth = computed(() => const svgWidth = computed(
DAY_WIDTH + Math.ceil(cells.value.length / 7) * CELL_TOTAL + RIGHT_PADDING () =>
DAY_WIDTH + Math.ceil(cells.value.length / 7) * CELL_TOTAL + RIGHT_PADDING,
) )
const svgHeight = computed(() => const svgHeight = computed(() => MONTH_HEIGHT + 7 * CELL_TOTAL + LEGEND_HEIGHT)
MONTH_HEIGHT + 7 * CELL_TOTAL + LEGEND_HEIGHT
)
interface Cell { interface Cell {
date: Date date: Date

View File

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

View File

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

View File

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

View File

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