jlu自动评教

之前有在用@双草酸酯大佬的评教脚本,发现评教系统又改版了之后稍微修了下选择器,目前可正常使用(同学信息部分搬的大佬代码,仅在chrome上通过测试)

食用方法:

1
ntms.widget._AutoLabel.prototype._static.setInterval(0);function clk(i){if(i<10){$('input[name="p0'+i+'"][value="A"]').click()}else{if(i==10){$('input[name="p10"][value="A"]').click()}else{if(i==11){$('input[name="sat11"][value="A"]').click()}else{if(i==12){$('input[name="p12"][value="C"]').click()}}}}}for(var i=1;i<=12;i++){clk(i)}function xhrWrapper(payload,cb){dojo.xhrPost({url:"/ntms/service/res.do",handleAs:"json-comment-optional",headers:[],contentType:"application/json",load:function(data){cb(data)},sync:true,postData:dojo.toJson(payload),})}function setUID(result){uid=result.userId;var payload={"tag":"student_sch_dept","branch":"default","params":{"schId":result.defRes.school,"deptId":result.defRes.department,"egrade":null,"adcId":result.defRes.adcId}};xhrWrapper(payload,searchName)}function searchName(result){result.value.forEach(function(i){nameList.push(i.name)});console.log(nameList);var pattern1=$("#puzzle_1").innerHTML;var pattern2=$("#puzzle_2").innerHTML;var pattern="^"+pattern1+"(.)"+pattern2+"$";var regex=new RegExp(pattern);nameList.forEach(function(i){var res=regex.exec(i);if(res!=null){console.log(res);document.getElementById("dijit_form_TextBox_0").value=res[1]}})}var nameList=[];var uid;dojo.xhrPost({url:"/ntms/action/getCurrentUserInfo.do",handleAs:"json-comment-optional",load:function(data){setUID(data)},sync:true});

把上面这块代码复制,打开评教页面,F12打开开发者工具切换到console/终端,粘贴代码回车运行即可

注:下图选项默认选择“线下课堂教学选项”,需要修改的同学可以运行完毕后手动选择,或者可以按照注释说明在未压缩代码中修改(

未压缩版代码

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
ntms.widget._AutoLabel.prototype._static.setInterval(0);

function clk(i){
if (i < 10){
$('input[name="p0' + i + '"][value="A"]').click();
}
else if (i == 10){
$('input[name="p10"][value="A"]').click();
}
else if (i == 11){
$('input[name="sat11"][value="A"]').click();
}
else if(i == 12){
$('input[name="p12"][value="C"]').click(); //需要修改教学方式可以把本行的value="C"修改成 "A"或 "B"
}
}

for(var i = 1; i <= 12; i++){
clk(i);
}


function xhrWrapper(payload, cb){
dojo.xhrPost({
url: "/ntms/service/res.do",
handleAs: "json-comment-optional",
headers: [],
contentType: "application/json",
load: function(data){cb(data)},
sync: true,
postData: dojo.toJson(payload),
});
}
function setUID(result){
uid = result.userId
var payload = {
"tag":"student_sch_dept",
"branch":"default",
"params":{
"schId": result.defRes.school,
"deptId": result.defRes.department,
"egrade": null,
"adcId": result.defRes.adcId
}
};
xhrWrapper(payload, searchName);
}
function searchName(result){
result.value.forEach(function (i){
nameList.push(i.name)
})
console.log(nameList);
var pattern1 = $("#puzzle_1").innerHTML;
var pattern2 = $("#puzzle_2").innerHTML;
var pattern = "^" + pattern1 + "(.)" + pattern2 + "$";
var regex = new RegExp(pattern);
nameList.forEach(function (i){
var res = regex.exec(i)
if(res != null){
console.log(res);
document.getElementById("dijit_form_TextBox_0").value = res[1];
}
})
}
var nameList = [];
var uid;
dojo.xhrPost({
url: "/ntms/action/getCurrentUserInfo.do",
handleAs: "json-comment-optional",
load: function(data){setUID(data)},
sync: true
});
2019-2021 Nishikinor undefined