This commit is contained in:
2025-10-07 00:53:51 +08:00
parent d6820b70af
commit 0b70c478b2
7 changed files with 72 additions and 48 deletions

View File

@@ -1,4 +1,16 @@
@font-face { @font-face {
font-family: "Monaco"; font-family: "Monaco";
src: url(/Monaco.ttf); src: url(/Monaco.ttf);
} }
.md-editor-preview .md-editor-code .md-editor-code-head {
z-index: 100 !important;
}
.md-editor-preview h1 {
font-size: 1.6rem !important;
}
.md-editor-preview h2 {
font-size: 1.4rem !important;
}

View File

@@ -53,19 +53,11 @@ import DurationChart from "./components/DurationChart.vue"
import AI from "./components/AI.vue" import AI from "./components/AI.vue"
import SolvedTable from "./components/SolvedTable.vue" import SolvedTable from "./components/SolvedTable.vue"
import { useAIStore } from "../store/ai" import { useAIStore } from "../store/ai"
import { DURATION_OPTIONS } from "utils/constants"
const aiStore = useAIStore() const aiStore = useAIStore()
const options: SelectOption[] = [ const options = [...DURATION_OPTIONS]
{ label: "一节课内", value: "hours:1" },
{ label: "两节课内", value: "hours:2" },
{ label: "一天内", value: "days:1" },
{ label: "一周内", value: "weeks:1" },
{ label: "一个月内", value: "months:1" },
{ label: "两个月内", value: "months:2" },
{ label: "半年内", value: "months:6" },
{ label: "一年内", value: "years:1" },
]
const subOptions = computed<Duration>(() => { const subOptions = computed<Duration>(() => {
let dur = options.find((it) => it.value === aiStore.duration) ?? options[0] let dur = options.find((it) => it.value === aiStore.duration) ?? options[0]

View File

@@ -1,5 +1,10 @@
<template> <template>
<n-card title="AI 智能分析" size="small"> <n-card size="small">
<template #header>
<div class="cool-title">
<span class="title-text">AI 帮你分析</span>
</div>
</template>
<n-spin :show="aiStore.loading.ai"> <n-spin :show="aiStore.loading.ai">
<div class="container"> <div class="container">
<MdPreview :model-value="aiStore.mdContent" /> <MdPreview :model-value="aiStore.mdContent" />
@@ -24,7 +29,38 @@ watch(
) )
</script> </script>
<style scoped> <style scoped>
.cool-title {
position: relative;
padding: 8px 0;
}
.title-text {
font-size: 16px;
font-weight: 700;
background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
background-size: 200% 200%;
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
letter-spacing: 0.8px;
position: relative;
z-index: 2;
animation: gradient-flow 3s ease infinite;
}
@keyframes gradient-flow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.container { .container {
min-height: 200px; min-height: 200px;
} }
</style> </style>

View File

@@ -23,6 +23,7 @@ import {
import { useAIStore } from "oj/store/ai" import { useAIStore } from "oj/store/ai"
import { parseTime } from "utils/functions" import { parseTime } from "utils/functions"
import type { Grade } from "utils/types" import type { Grade } from "utils/types"
import { DURATION_OPTIONS } from "utils/constants"
// 注册折线图所需的 Chart.js 组件 // 注册折线图所需的 Chart.js 组件
ChartJS.register( ChartJS.register(
@@ -48,18 +49,8 @@ const gradeColors: Record<Grade, string> = {
} }
const title = computed(() => { const title = computed(() => {
const durationMap: Record<string, string> = { const option = DURATION_OPTIONS.find((opt) => opt.value === aiStore.duration)
"hours:1": "一节课内", return option ? `${option.label}的进步曲线` : "进步曲线"
"hours:2": "两节课内",
"days:1": "一天内",
"weeks:1": "一周内",
"months:1": "一个月内",
"months:2": "两个月内",
"months:6": "半年内",
"years:1": "一年内",
}
const label = durationMap[aiStore.duration] || ""
return label ? `${label}做题的进步曲线` : "做题的进步曲线"
}) })
// 判断是否有数据 // 判断是否有数据

View File

@@ -171,17 +171,3 @@ watch(
{ immediate: true }, { immediate: true },
) )
</script> </script>
<style scoped>
:deep(.md-editor-preview .md-editor-code .md-editor-code-head) {
z-index: 100;
}
:deep(.md-editor-preview h1) {
font-size: 1.6em;
}
:deep(.md-editor-preview h2) {
font-size: 1.4em;
}
</style>

View File

@@ -70,6 +70,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { formatISO, sub, type Duration } from "date-fns" import { formatISO, sub, type Duration } from "date-fns"
import { getSubmissionStatistics } from "oj/api" import { getSubmissionStatistics } from "oj/api"
import { DURATION_OPTIONS } from "utils/constants"
interface Props { interface Props {
problem: string problem: string
@@ -82,13 +83,7 @@ const options: SelectOption[] = [
{ label: "10分钟内", value: "minutes:10" }, { label: "10分钟内", value: "minutes:10" },
{ label: "20分钟内", value: "minutes:20" }, { label: "20分钟内", value: "minutes:20" },
{ label: "30分钟内", value: "minutes:30" }, { label: "30分钟内", value: "minutes:30" },
{ label: "本节课内", value: "hours:1" }, ].concat(DURATION_OPTIONS)
{ label: "两小时内", value: "hours:2" },
{ label: "一天内", value: "days:1" },
{ label: "一周内", value: "weeks:1" },
{ label: "一个月内", value: "months:1" },
{ label: "一年内", value: "years:1" },
]
const columns: DataTableColumn[] = [ const columns: DataTableColumn[] = [
{ title: "用户", key: "username" }, { title: "用户", key: "username" },

View File

@@ -232,3 +232,15 @@ export enum ChartType {
Rank, Rank,
Activity, Activity,
} }
// 时间范围配置
export const DURATION_OPTIONS = [
{ label: "本节课内", value: "hours:1" },
{ label: "两节课内", value: "hours:2" },
{ label: "一天内", value: "days:1" },
{ label: "一周内", value: "weeks:1" },
{ label: "一个月内", value: "months:1" },
{ label: "两个月内", value: "months:2" },
{ label: "半年内", value: "months:6" },
{ label: "一年内", value: "years:1" },
] as const