You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
2.1 KiB
JavaScript
32 lines
2.1 KiB
JavaScript
const assert = require("assert");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const pagePath = path.join(__dirname, "..", "src", "views", "teacherEnd", "student", "index.vue");
|
|
const apiPath = path.join(__dirname, "..", "src", "api", "teacher.js");
|
|
const page = fs.readFileSync(pagePath, "utf8");
|
|
const api = fs.readFileSync(apiPath, "utf8");
|
|
|
|
assert(
|
|
page.includes('const isTeacherRosterMode = computed(() => userStore.schoolProductConfig?.studentRosterOwner === "TEACHER")'),
|
|
"教师端学生页必须根据学校配置识别教师维护名单模式"
|
|
);
|
|
assert(page.includes(':rules="studentFormRules"'), "教师维护名单模式不能继续校验院系、专业、班级");
|
|
assert(page.includes('v-if="isTeacherRosterMode" label="所属教学班:" prop="teachingClassId"'), "教师维护名单模式新增和编辑学生时必须选择教学班");
|
|
assert(page.includes('teachingClassId: [{ required: true, message: "请选择所属教学班", trigger: "change" }]'), "教师维护名单模式必须校验教学班必选");
|
|
assert(page.includes('teachingClassOptions'), "教师维护名单模式必须只提供可维护的教学班选项");
|
|
assert(
|
|
/if \(!isTeacherRosterMode\.value && row\.schoolMajorId\) \{\s*indexApi\.getFacultyAndMajorName/.test(page),
|
|
"教师维护名单模式不能请求必填 schoolMajorId 的组织结构接口"
|
|
);
|
|
assert(page.includes("indexApi.addTeacherRosterStudent(formInline.value)"), "教师维护名单模式新增学生必须使用无组织字段的名单接口");
|
|
assert(page.includes("indexApi.updateTeacherRosterStudent(formInline.value)"), "教师维护名单模式编辑学生必须使用无班级归属的名单接口");
|
|
assert(
|
|
page.includes("row.teachingClassId || currentTeachingClassId()"),
|
|
"教师维护名单模式再次编辑学生时必须回显该学生当前所属教学班"
|
|
);
|
|
assert(api.includes('url: "/api/user/teacher-roster/students"'), "教师名单新增接口必须在前端 API 层声明");
|
|
assert(api.includes('teachingClassId: data.teachingClassId'), "教师名单接口必须提交已选择的教学班");
|
|
|
|
console.log("teacher student roster mode static checks passed");
|