feat(plan): 支持学案生成时指定单词数
- 在 AddLessonPlanReqVO 中新增 wordSize 字段 - 修改 LessonPlansService 接口及实现,支持 wordSize 参数 - 优化学案生成逻辑,按指定单词数切分词汇列表 - 更新前端 LessonPlanDialog,添加单词数输入框 - 修改生成学案接口及调用,传递 wordSize 参数 - 增加查询学生词汇掌握详情接口及实现 - 添加学生词汇统计展示组件及页面集成 - 调整词汇相关 Mapper,修正记忆强度条件范围 - 更新权限配置,允许访问学生单词详情接口
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import axios from "@/axios";
|
||||
|
||||
export function generateLessonPlan(studentId, unitId) {
|
||||
export function generateLessonPlan(studentId, unitId, wordSize = 0) {
|
||||
return axios.post('/plan/generate', {
|
||||
studentId: studentId,
|
||||
unitId: unitId
|
||||
unitId: unitId,
|
||||
wordSize: wordSize
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -4,4 +4,10 @@ export function getWordsListByIds(ids) {
|
||||
return axios.post('/vocabulary/list', {
|
||||
ids: ids
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function getWordStudentDetail(studentId) {
|
||||
return axios.post('/vocabulary/student/detail', {
|
||||
id: studentId
|
||||
})
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单词数">
|
||||
<el-input v-model="wordSize" type="number" placeholder="请输入单词数" style="width: 300px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="text-sm text-gray-500">
|
||||
学生ID:{{ studentId }}
|
||||
@@ -45,6 +48,7 @@ const visible = computed({
|
||||
|
||||
const loading = ref(false)
|
||||
const unitId = ref(null)
|
||||
const wordSize = ref(0)
|
||||
const unitOptions = ref([])
|
||||
|
||||
async function fetchUnits() {
|
||||
@@ -63,7 +67,7 @@ async function fetchUnits() {
|
||||
|
||||
async function handleGenerate() {
|
||||
if (!unitId.value || !props.studentId) return
|
||||
const res = await generateLessonPlan(Number(props.studentId), Number(unitId.value))
|
||||
const res = await generateLessonPlan(Number(props.studentId), Number(unitId.value), Number(wordSize.value))
|
||||
const d = res?.data
|
||||
if (d.success) {
|
||||
ElMessage.success('生成学案任务已提交,请等待十分钟')
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
</el-header>
|
||||
|
||||
<el-main class="p-4">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-1 gap-6"
|
||||
v-loading="loading">
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6" v-loading="loading">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="text-lg font-semibold mb-4">学生详情</div>
|
||||
<template v-if="detail">
|
||||
@@ -24,6 +23,20 @@
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="text-lg font-semibold mb-4">学生词汇统计</div>
|
||||
<template v-if="wordStat">
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="已掌握">{{ wordStat.masteredWordCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="未掌握">{{ wordStat.unmasteredWordCount }}</el-descriptions-item>
|
||||
<el-descriptions-item label="待复习">{{ wordStat.pendingReviewWordCount }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-empty description="暂无统计" />
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="text-md font-semibold mb-3">学生考试记录</div>
|
||||
<ExamHistoryChart :data="history" />
|
||||
@@ -63,6 +76,7 @@ import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { getStudentDetail, getStudentStudyAnalyze } 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'
|
||||
@@ -74,6 +88,7 @@ const route = useRoute()
|
||||
const history = ref([])
|
||||
const analyzeLoading = ref(false)
|
||||
const analysisText = ref('')
|
||||
const wordStat = ref(null)
|
||||
const md = new MarkdownIt({
|
||||
html: false,
|
||||
linkify: true,
|
||||
@@ -122,8 +137,17 @@ async function fetchStudyAnalyze() {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchWordStat() {
|
||||
const id = route.params.id
|
||||
if (!id) return
|
||||
const res = await getWordStudentDetail(Number(id))
|
||||
const d = res.data
|
||||
wordStat.value = d?.data || null
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchDetail()
|
||||
fetchExamHistory()
|
||||
fetchWordStat()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user