feat(学生): 添加学生课程管理功能
- 新增我的课程页面及路由 - 实现课程列表和详情查看功能 - 更新导航链接指向新页面 - 添加成绩详情模态框 - 完善相关后端接口和服务
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
const Score = require('../models/Score');
|
||||
const Student = require('../models/Student');
|
||||
|
||||
const Course = require('../models/Course');
|
||||
|
||||
class StudentService {
|
||||
static async getStudentCourses(userId) {
|
||||
const student = await Student.findById(userId);
|
||||
if (!student) {
|
||||
throw new Error('学生信息不存在');
|
||||
}
|
||||
|
||||
const courses = await Course.findByStudentId(userId);
|
||||
return courses;
|
||||
}
|
||||
|
||||
static async getCourseDetails(courseId) {
|
||||
const course = await Course.findDetailsById(courseId);
|
||||
if (!course) {
|
||||
throw new Error('课程不存在');
|
||||
}
|
||||
return course;
|
||||
}
|
||||
|
||||
static async getStudentGrades(userId) {
|
||||
// 先通过 userId 获取 studentId
|
||||
// 假设 users.id = students.id,或者通过 user_id 关联
|
||||
|
||||
Reference in New Issue
Block a user