Last active
August 19, 2023 04:36
-
-
Save niltok/b70ea2116768f713007be1368ca0ba7c to your computer and use it in GitHub Desktop.
QUST 自动教评脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 使用方法:在教评页面把侧栏教学班显示从每页15改成每页5000,打开控制台粘贴本段代码,喝杯咖啡,等所有教师评完后点击提交 */ | |
(async () => { | |
let wait = 1000; /* 点击侧栏后的等待时间,单位毫秒,根据网络状况选取 */ | |
let delay = t => new Promise((res, rej) => setTimeout(res, t)); | |
document.querySelectorAll("#tempGrid > tbody > .ui-widget-content")[0].click(); | |
await delay(wait); | |
let list = document.querySelectorAll("#tempGrid > tbody > .ui-widget-content"); | |
for (let i = 1; ; i++) { | |
await delay(wait); | |
//try { | |
document.querySelectorAll(".input-xspj-1 > label > input").forEach(e => e.click()); | |
document.querySelectorAll(".input-xspj > input").forEach(e => e.value = 0); | |
document.querySelectorAll(".input-xspj textarea").forEach(e => e.value = "无"); | |
var dataMap = buildRequestMap.call(this) || {}; | |
dataMap["tjzt"] = "0"; | |
await (new Promise((res, rej) => jQuery.ajax({ | |
url : _path+"/xspjgl/xspj_bcXspj.html", | |
type : "post", | |
dataType: "json", | |
data:dataMap, | |
async: false, | |
beforeSend: function(){ | |
}, | |
success: function(responseText){ | |
if($.type(responseText) == "string"){ | |
if(responseText.indexOf("成功") > -1){ | |
$.success(responseText,function() { | |
// 刷新评价情况 | |
refTab(); | |
}); | |
}else if(responseText.indexOf("失败") > -1){ | |
$.error(responseText,function() { | |
}); | |
} else{ | |
$.alert(responseText,function() { | |
}); | |
} | |
} | |
res(); | |
}, | |
error:function(){rej(); | |
} | |
}))); | |
await delay(wait); | |
document.querySelector("#btn_ok").click(); | |
await delay(wait); | |
list = document.querySelectorAll("#tempGrid > tbody > .ui-widget-content"); | |
if (i == list.length) break; | |
//} catch (e) {} | |
await delay(wait); | |
list[i].click(); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment