Add problem number restrictions

This commit is contained in:
cyp0633 2022-09-20 16:58:46 +08:00
parent a42e3bc68b
commit b3d565b08a
Signed by: cyp0633
GPG Key ID: CF90D09FB1FDCE45
1 changed files with 8 additions and 0 deletions

View File

@ -44,6 +44,14 @@ function getProblems() {
alert("请填写完整信息");
return;
}
if (typeof (data.problemNum) != "number") {
alert("题目数量必须为数字");
return;
}
if (data.problemNum < 10 || data.problemNum > 30) {
alert("题目数量必须在 10 与 30 之间");
return;
}
var params = "level=" + data.difficulty + "&num=" + data.problemNum;
var xhr = new XMLHttpRequest();
xhr.open("GET", "/api/paper?" + params, true);