From 1184ea7895493678dc2e5a94939192a9c449f1a8 Mon Sep 17 00:00:00 2001 From: lbw <1192299468@qq.com> Date: Sun, 4 Jan 2026 10:17:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(student):=20=E6=B7=BB=E5=8A=A0=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E5=88=86=E6=9E=90=E5=8A=9F=E8=83=BD=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在班级页面列表操作栏增加“学情分析”按钮,点击弹出学情分析对话框 - 新增StudyAnalysis组件,封装学习分析生成与展示逻辑 - 学生详情页替换原有学习分析区域,统一使用StudyAnalysis组件 - 移除学生页原有学习分析相关状态管理和接口调用,简化代码 - 通过定时器模拟加载进度条,提升生成学习分析时的用户体验 --- .../components/student/StudyAnalysis.vue | 79 +++++++++++++++++++ enlish-vue/src/pages/class.vue | 14 +++- enlish-vue/src/pages/student.vue | 68 +--------------- 3 files changed, 95 insertions(+), 66 deletions(-) create mode 100644 enlish-vue/src/layouts/components/student/StudyAnalysis.vue diff --git a/enlish-vue/src/layouts/components/student/StudyAnalysis.vue b/enlish-vue/src/layouts/components/student/StudyAnalysis.vue new file mode 100644 index 0000000..26e5736 --- /dev/null +++ b/enlish-vue/src/layouts/components/student/StudyAnalysis.vue @@ -0,0 +1,79 @@ + + + diff --git a/enlish-vue/src/pages/class.vue b/enlish-vue/src/pages/class.vue index dfa7800..11d1880 100644 --- a/enlish-vue/src/pages/class.vue +++ b/enlish-vue/src/pages/class.vue @@ -73,8 +73,10 @@ - + @@ -105,6 +107,9 @@ v-model="showPlanListDialog" :student-id="planStudentId" /> + + +
@@ -139,6 +144,7 @@ import AddGradeDialog from '@/layouts/components/AddGradeDialog.vue' import AddStudentDialog from '@/layouts/components/AddStudentDialog.vue' import LessonPlanDialog from '@/layouts/components/LessonPlanDialog.vue' import StudentPlanListDialog from '@/layouts/components/StudentPlanListDialog.vue' +import StudyAnalysis from '@/layouts/components/student/StudyAnalysis.vue' import { getUnitList, deleteUnit } from '@/api/unit' import AddUnitDialog from '@/layouts/components/AddUnitDialog.vue' import { useRouter, onBeforeRouteLeave } from 'vue-router' @@ -180,6 +186,8 @@ const generatingPercents = ref({}) const pollingTimers = {} const showPlanListDialog = ref(false) const planStudentId = ref(null) +const showAnalysisDialog = ref(false) +const analysisStudentId = ref(null) const units = ref([]) const unitPageNo = ref(1) @@ -275,6 +283,10 @@ function onStudentSelectionChange(rows) { function onViewStudent(row) { router.push(`/student/${row.id}`) } +function onShowAnalysis(row) { + analysisStudentId.value = row.id + showAnalysisDialog.value = true +} function onClassRowClick(row) { selectedClassId.value = row.id selectedClassTitle.value = row.title diff --git a/enlish-vue/src/pages/student.vue b/enlish-vue/src/pages/student.vue index 71043fa..87fe949 100644 --- a/enlish-vue/src/pages/student.vue +++ b/enlish-vue/src/pages/student.vue @@ -49,26 +49,7 @@
词汇掌握热力图
-
-
-
学习分析
- - 生成学习分析 - -
- - - -
+ @@ -80,31 +61,19 @@ import Header from '@/layouts/components/Header.vue' import { ref, onMounted, computed } from 'vue' import { useRoute } from 'vue-router' -import { getStudentDetail, getStudentStudyAnalyze } from '@/api/student' +import { getStudentDetail } from '@/api/student' import { getStudentExamHistory } from '@/api/exam' import { getWordStudentDetail } from '@/api/words' import ExamHistoryChart from '@/layouts/components/student/ExamHistoryChart.vue' import PlanHistoryChart from '@/layouts/components/student/PlanHistoryChart.vue' import WordMasteryHeatmap from '@/layouts/components/student/WordMasteryHeatmap.vue' -import MarkdownIt from 'markdown-it' +import StudyAnalysis from '@/layouts/components/student/StudyAnalysis.vue' const loading = ref(false) const detail = ref(null) const route = useRoute() const history = ref([]) -const analyzeLoading = ref(false) -const analyzeProgress = ref(0) -let analyzeTimer = null -const analysisText = ref('') const wordStat = ref(null) -const md = new MarkdownIt({ - html: false, - linkify: true, - breaks: true -}) -const analysisHtml = computed(() => { - return analysisText.value ? md.render(analysisText.value) : '' -}) async function fetchDetail() { const id = route.params.id @@ -129,37 +98,6 @@ async function fetchExamHistory() { }) : [] } -async function fetchStudyAnalyze() { - const id = route.params.id - if (!id) return - analyzeLoading.value = true - analyzeProgress.value = 0 - if (analyzeTimer) { - clearInterval(analyzeTimer) - analyzeTimer = null - } - analyzeTimer = setInterval(() => { - const inc = Math.floor(Math.random() * 8) + 3 - const next = analyzeProgress.value + inc - analyzeProgress.value = next >= 90 ? 90 : next - }, 300) - try { - const res = await getStudentStudyAnalyze({ - studentId: Number(id) - }) - const d = res.data - const raw = typeof d?.data === 'string' ? d.data : '' - analysisText.value = raw.replace(/\\n/g, '\n') - } finally { - analyzeProgress.value = 100 - if (analyzeTimer) { - clearInterval(analyzeTimer) - analyzeTimer = null - } - analyzeLoading.value = false - } -} - async function fetchWordStat() { const id = route.params.id if (!id) return