dykj-college-back-office-ma.../mock/modules/lcz.js
吕才卓 fecbc1d096 stu
2024-04-08 18:13:54 +08:00

40 lines
1.1 KiB
JavaScript

import Mock from "mockjs";
function randomGender() {
return ['男', '女'][Math.floor(Math.random() * 2)];
}
const student = Mock.mock({
"list|100": [
{
id: '@id',
name: '@cname',
gender: randomGender(),
studentId: '@id',
department: function () {
return ['计算机科学系', '数学系', '物理系', '化学系'][this.random(0, 3)];
},
major: function () {
return ['计算机科学与技术', '数学', '物理学', '化学', '生物学', '经济学'][this.random(0, 5)];
},
classes: function () {
return ['一班', '二班', '三班', '四班', '五班'][this.random(0, 4)];
},
status: function () {
return ['休学', '退学', '复学'][this.random(0, 2)];
}
}
]
})
export default [
{
url: '/api/student',
method: 'post',
response: (config) => {
return {
code: 200,
data: student.list
};
}
}
];