feat(student): 新增学生详情接口及相关服务层支持
- 优化ClassDOMapper,重命名查询方法为selectClassDOById,并移除多余CRUD方法 - 新增ClassService接口及ClassServiceImpl实现,用于通过ID查询班级信息 - 新增GradeDO及GradeDOMapper,实现根据班级ID查询年级信息 - 新增GradeService接口及GradeServiceImpl实现根据班级ID查询年级数据 - StudentDO增加isDeleted和startTime字段,补充学生实体 - StudentDOMapper新增selectStudentById方法实现单个学生信息查询 - StudentService及其实现类新增getStudentById方法提供学生单条数据查询 - StudentController新增/detail接口,实现学生详情查询,返回学生姓名、班级、年级等信息 - 创建FindStudentDetailReqVO和FindStudentDetailRspVO用于请求和响应数据传输 - enlish-vue端新增getStudentDetail接口调用 后台学生详情接口 - 修改ExamWordsDetailCard组件,展示学生姓名及其班级、年级信息,新增fetchStudent异步方法拉取学生详情数据并显示
This commit is contained in:
7
enlish-vue/src/api/student.js
Normal file
7
enlish-vue/src/api/student.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import axios from "@/axios";
|
||||
|
||||
export function getStudentDetail(id) {
|
||||
return axios.post('/student/detail', {
|
||||
studentId: id
|
||||
})
|
||||
}
|
||||
@@ -8,8 +8,13 @@
|
||||
<div class="text-base font-medium">{{ detail?.id ?? '-' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-gray-500 text-sm">学生ID</div>
|
||||
<div class="text-base font-medium">{{ detail?.studentId ?? '-' }}</div>
|
||||
<div class="text-gray-500 text-sm">学生</div>
|
||||
<div class="text-base font-medium">
|
||||
{{ studentDetail?.name ?? '-' }}
|
||||
</div>
|
||||
<div class="text-gray-500 text-xs mt-1">
|
||||
班级:{{ studentDetail?.className ?? '-' }} 年级:{{ studentDetail?.gradeName ?? '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-gray-500 text-sm">试题ID</div>
|
||||
@@ -76,6 +81,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { getExamWordsDetailResult } from '@/api/exam'
|
||||
import { getStudentDetail } from '@/api/student'
|
||||
import { getWordsListByIds } from '@/api/words'
|
||||
|
||||
const props = defineProps({
|
||||
@@ -94,6 +100,7 @@ const detail = ref(null)
|
||||
const activeNames = ref(['correct', 'wrong'])
|
||||
const correctTitles = ref([])
|
||||
const wrongTitles = ref([])
|
||||
const studentDetail = ref(null)
|
||||
|
||||
async function fetchDetail() {
|
||||
if (!props.id && props.id !== 0) return
|
||||
@@ -103,6 +110,7 @@ async function fetchDetail() {
|
||||
const d = res?.data?.data ?? null
|
||||
detail.value = d
|
||||
await fetchTitles()
|
||||
await fetchStudent()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@@ -133,6 +141,14 @@ async function fetchTitles() {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchStudent() {
|
||||
studentDetail.value = null
|
||||
const sid = detail.value?.studentId
|
||||
if (!sid && sid !== 0) return
|
||||
const res = await getStudentDetail(Number(sid))
|
||||
studentDetail.value = res?.data?.data ?? null
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(v) => {
|
||||
|
||||
Reference in New Issue
Block a user