const assert = require("assert"); const fs = require("fs"); const path = require("path"); const pagePath = path.join(__dirname, "..", "src", "views", "teacherEnd", "class", "index.vue"); const apiPath = path.join(__dirname, "..", "src", "api", "teacher.js"); const page = fs.readFileSync(pagePath, "utf8"); const api = fs.readFileSync(apiPath, "utf8"); assert.match(page, /getClassesList\(\{\s*\.\.\.paramsquery\.value,\s*operatorId: currentUserId\.value,?\s*\}\)/, "班级查询必须提交当前操作教师,以便后端限制为本人教学班"); assert.match(api, /export function importTeacherRosterMembers\(teachingClassId, data\)/, "前端 API 层必须提供教师教学班成员导入接口"); assert.match(api, /url: `\/api\/user\/teaching-classes\/\$\{teachingClassId\}\/students\/import`/, "教师教学班成员导入必须使用专用端点"); assert.match(page, /if \(isTeacherRosterMode\.value\) \{[\s\S]*importTeacherRosterMembers/, "教学班专属模式必须走教师名单导入端点"); assert.match(page, /\["学生姓名", "学号"\]/, "教学班专属模式模板必须只包含姓名和学号"); console.log("teacher owned class roster static checks passed");