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