forked from HackSwjtu/Postime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
91 lines (86 loc) · 2.69 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
function go(){
var ps = $("input[name='problem_id']");
console.log(ps.length);
// The old code is $ ps != null
// Have you learned JavaScript ?
if (ps !== null && ps.length > 0) {
var f = true;
var ids = "", ans = "";
for (var i = 0; i < ps.length; ++ i) {
var id = $(ps[i]).val();
var answer = getInputVal(id);
if (answer === "" || answer === null || answer.length < 1) {
alert("教务君说需要填写完整的信息,否则无法提交");
$("[name='problem" + id + "']").focus();
f = false;
break;
} else {
ids += ("," + id);
ans += ("," + answer);
}
}
if (f === true) {
$.post("AssessAction?SetAction=answer",
{
id: ids,
answer: ans,
assess_id: $("input[name='assess_id']").val(),
templateFlag: "0"
},
function() {
if (data.flag) {
alert("教务君说提交成功了!");
window.location.href = "http://jiaowu.swjtu.edu.cn:80/servlet/AssessAction?SetAction=studentList";
} else {
alert(data.error);
}
});
alert("test");
} else {
alert("教务君说无需提交,静待些时日再来吧");
}
}
}
function badit() {
var ind = 4;
var radios = $(':radio');
var ps = $("input[name='problem_id']");
var firstVal = radios[ind].value;
var dg_ans = '', dg_ids = '';
for (var i = 1; i <= 18; ++ i) {
index = Number(ind) + (i - 1) * 5;
console.log(radios[index]);
if (i == 17) {
dg_ans += ',老师真垃圾';
continue;
} else if (i == 18) {
dg_ans += ',课程好无聊,什么都得改改';
continue;
} else {
num = (Number(firstVal) + (i - 1) * 5);
dg_ans += ',' + num;
}
}
for (i = 0; i < ps.length; ++ i) {
code = ps[i].value;
dg_ids += ',' + code;
}
alert(dg_ids);
alert(dg_ans);
console.log(dg_ids);
console.log(dg_ans);
$.post("AssessAction?SetAction=answer",
{
id: dg_ids,
answer: dg_ans,
assess_id: $("input[name='assess_id']").val(),
templateFlag: "0"
},
function() {
if (data.flag) {
alert("教务君说提交成功了!");
} else {
alert(data.error);
}
});
}