From 0b28dbeef849a011855fe25e91c5d04abd3c75d6 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 24 Sep 2025 22:14:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20username?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/oj/ai/analysis.vue | 19 ++----------------- src/oj/ai/components/Details.vue | 4 ++-- src/oj/ai/components/WeeklyChart.vue | 4 ++-- src/oj/api.ts | 7 +++---- src/oj/store/ai.ts | 12 +++--------- 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/oj/ai/analysis.vue b/src/oj/ai/analysis.vue index 022747b..adc0043 100644 --- a/src/oj/ai/analysis.vue +++ b/src/oj/ai/analysis.vue @@ -2,21 +2,13 @@ - + + 请选择时间范围,智能分析学习情况 - - - 查询 -
@@ -35,15 +27,12 @@ import { formatISO, sub, type Duration } from "date-fns" import WeeklyChart from "./components/WeeklyChart.vue" import Details from "./components/Details.vue" import AI from "./components/AI.vue" -import { useUserStore } from "~/shared/store/user" import { useAIStore } from "../store/ai" -const userStore = useUserStore() const aiStore = useAIStore() const start = ref("") const end = ref("") -const username = ref("") const options: SelectOption[] = [ { label: "一节课内", value: "hours:1" }, @@ -70,9 +59,5 @@ function updateRange() { start.value = formatISO(sub(current, subOptions.value)) } -function search() { - aiStore.username = username.value -} - watch(() => aiStore.duration, updateRange, { immediate: true }) diff --git a/src/oj/ai/components/Details.vue b/src/oj/ai/components/Details.vue index 783d51b..cf877e1 100644 --- a/src/oj/ai/components/Details.vue +++ b/src/oj/ai/components/Details.vue @@ -129,9 +129,9 @@ const greeting = computed(() => { }) watch( - () => [aiStore.duration, aiStore.username], + () => aiStore.duration, () => { - aiStore.fetchDetailsData(props.start, props.end, aiStore.username) + aiStore.fetchDetailsData(props.start, props.end) }, { immediate: true }, ) diff --git a/src/oj/ai/components/WeeklyChart.vue b/src/oj/ai/components/WeeklyChart.vue index c1ff725..549d654 100644 --- a/src/oj/ai/components/WeeklyChart.vue +++ b/src/oj/ai/components/WeeklyChart.vue @@ -121,9 +121,9 @@ const options = computed>(() => { }) watch( - () => [aiStore.duration, aiStore.username], + () => aiStore.duration, () => { - aiStore.fetchWeeklyData(props.end, aiStore.duration, aiStore.username) + aiStore.fetchWeeklyData(props.end, aiStore.duration) }, { immediate: true }, ) diff --git a/src/oj/api.ts b/src/oj/api.ts index 4e1d385..da1a163 100644 --- a/src/oj/api.ts +++ b/src/oj/api.ts @@ -245,14 +245,13 @@ export function getTutorials() { return http.get("tutorials") } -export function getAIDetailData(start: string, end: string, username?: string) { - return http.get("ai/detail", { params: { start, end, username } }) +export function getAIDetailData(start: string, end: string) { + return http.get("ai/detail", { params: { start, end } }) } export function getAIWeeklyData( end: string, duration: string, - username?: string, ) { - return http.get("ai/weekly", { params: { end, duration, username } }) + return http.get("ai/weekly", { params: { end, duration } }) } diff --git a/src/oj/store/ai.ts b/src/oj/store/ai.ts index 06af53c..03085dd 100644 --- a/src/oj/store/ai.ts +++ b/src/oj/store/ai.ts @@ -5,7 +5,6 @@ import { getCSRFToken } from "~/utils/functions" export const useAIStore = defineStore("ai", () => { const duration = ref("months:6") - const username = ref("") const weeklyData = ref([]) const detailsData = reactive({ start: "", @@ -26,17 +25,14 @@ export const useAIStore = defineStore("ai", () => { const mdContent = ref("") - const theFirstPerson = computed(() => { - return !!username.value ? username.value : "你" - }) + const theFirstPerson = "你" async function fetchDetailsData( start: string, end: string, - username?: string, ) { loading.details = true - const res = await getAIDetailData(start, end, username) + const res = await getAIDetailData(start, end) detailsData.start = res.data.start detailsData.end = res.data.end detailsData.solved = res.data.solved @@ -51,10 +47,9 @@ export const useAIStore = defineStore("ai", () => { async function fetchWeeklyData( end: string, duration: string, - username?: string, ) { loading.weekly = true - const res = await getAIWeeklyData(end, duration, username) + const res = await getAIWeeklyData(end, duration) weeklyData.value = res.data loading.weekly = false } @@ -145,7 +140,6 @@ export const useAIStore = defineStore("ai", () => { weeklyData, detailsData, duration, - username, theFirstPerson, loading, mdContent,