var knownExams = '', checked = 0
// for (let i = 3000; i < 3400; i++)knownExams += i.toString() + ','
// knownExams = knownExams.slice(0, knownExams.length - 1)
function getCookie(name) {
let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) return arr[2];
return null;
}
function decimal(x, n) {
x = Math.round(x * 10 ** n) / 10 ** n;
return x.toFixed(n);
}
var fileCount = 0, cur = 0, files = {};
var stuId = {}, examId = {}, user
function prevFile() {
cur = (cur - 1 + fileCount) % fileCount;
processFiles();
}
function nextFile() {
cur = (cur + 1) % fileCount;
processFiles();
}
function clearScreen() {
$(".chart").hide(300)
$("#fileOutput").html('');
$("#name").html('');
}
document.onkeydown = function (event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
if (e) {
if (e.key == "ArrowLeft") {
prevFile();
}
else if (e.key == "ArrowRight") {
nextFile();
}
}
};
function getFiles(e) {
files[fileCount] = e.target.files[0];
cur = fileCount;
fileCount++;
$("#controls").removeClass("disabled");
$("#lbtn").removeClass("disabled");
$("#rbtn").removeClass("disabled");
processFiles(1);
}
//原理:string<->cipherparams.ciphertext
const key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
function aesDecrypt(e) {
var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(e) })
var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
return decrypted.toString(CryptoJS.enc.Utf8);
}
function aesEncrypt(e) {
return CryptoJS.AES.encrypt(e, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).ciphertext.toString();
}
function fetchDo(id) {
getExams(id).then(function () {
var bd = '{"meId":' + $('#Id').val() + ',"seIds":"' + knownExams + '","schoolId":19707,"studentId":"' + id + '"}';
// console.log(bd)
bd = aesEncrypt(bd)
// console.log(bd)
return fetch('/analysis/api/student/exam/getStudentReportMEVO', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: bd
})
}).then(res => {
return res.text()
}).then(e => {
files[fileCount] = new Blob([e], {
type: 'text/plain'
});
cur = fileCount;
fileCount++;
$("#controls").removeClass("disabled");
$("#lbtn").removeClass("disabled");
$("#rbtn").removeClass("disabled");
processFiles(1);
});
}
function addExam(arr) {
for (let i = 1; i < arr.length; i++) {
if (knownExams) knownExams += ','
knownExams += arr[i].seId.toString()
}
}
function getExams(id) {
var bd = '{"schoolId":19707,"studentId":"' + id + '"}';
// console.log(bd)
bd = aesEncrypt(bd)
return fetch('/analysis/api/student/exam/getUserMultiExamByStudentIdAndSchoolId', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: bd
}).then(res => res.json()).then(e => {
let dat = JSON.parse(aesDecrypt(e.data))
let str = ''
for (let i = 0; i < dat.length; i++) {
str += dat[i].examName.slice(dat[i].examName.length - 4, dat[i].examName.length - 2) + ' - ' + dat[i].meId + (i == dat.length - 1 ? '' : ', ');
addExam(dat[i].studentReportInfos)
}
$('#Id').attr('placeholder', str)
})
}
function check(u = 0) {
var a = u || prompt('验证身份\n我的数字校园号是:')
fetch('/js/e.json', {
method: 'GET',
headers: {
'Content-type': 'application/json',
}
}).then(res => res.json()).then(e => {
var queryData = e.data.filter(function (e) {
return e.no == a
});
var o = queryData[0].o
if (o.slice(o.length - 3) == '11班') {
user = queryData[0].name
getExams(queryData[0].no)
checked = 1
$('.fetch').toggle(1000)
if (u) $('#Input').val(u)
}
else (!u) && alert('no')
});
}
function fetchMe() {
if (!checked) return
let id = $('#Input').val()
if (!parseInt(id)) {
fetch('/js/e.json', {
method: 'GET',
headers: {
'Content-type': 'application/json',
}
}).then(res => res.json()).then(e => {
var queryData = e.data.filter(function (e) {
return e.name == id
});
fetchDo(queryData[0].no)
});
} else fetchDo(id)
}
var datSe
function imageLoaded(id) {
var imgObj = $('img')[id]
var ratio = imgObj.width / imgObj.naturalWidth;
if (ratio == 1) ratio = ($('.tab-content')[0].clientWidth - 12) / imgObj.naturalWidth;
$('.cover' + id).empty()
for (var i = 0; i < datSe.displayIndexDetails.length; i++) {
var di = datSe.displayIndexDetails[i]
var f = di.eqAnswerIpxywh.split('#')
for (let j = 0; j < f.length; j++) {
var g = f[j].split(',')
if (g.length == 6) {
if (parseInt(g[1]) - 1 == id) {
var opt = $(''
+ ((di.eqScore == di.eqFullScore) ? (di.eqFullScore.toString()) : ((di.eqScore == 0) ? ((di.eqScore - di.eqFullScore).toString()) : (di.eqScore.toString() + '/' + di.eqFullScore.toString()))) + '').appendTo('.cover' + id)
if (di.eqScore == di.eqFullScore) opt.addClass('full')
else wriggle(opt)
}
} else {
if (id == 0) {
var opt = $('').appendTo('.cover' + id)
if (j == 0 && di.eqFullScore != di.eqScore)
wriggle($(''
+ (di.eqScore - di.eqFullScore).toString() + '').appendTo('.cover' + id))
if (di.eqCorrectAnswer.match("ABCD"[j])) opt.addClass('cor')
else if (di.eqAnswer.match("ABCD"[j])) opt.addClass('err')
}
}
}
}
}
var curSe, shown
function getSe(id, force, force2) {
if (!force && !$('.nav-tabs>li')[2].classList[0]) return
if (!force2 && id == curSe && shown) return
shown = 1
curSe = id
fontSize = 14
bd = '{"schoolId":19707,"meId":' + examId[cur] + ',"seId":' + id + ',"studentId":"' + stuId[cur] + '"}';
bd = aesEncrypt(bd)
fetch('/analysis/api/student/exam/getStuExamDetailInfo', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: bd
}).then(res => res.json()).then(e => {
$('#singleDat').empty()
var dat = JSON.parse(aesDecrypt(e.data))
for (let i = 1; i <= dat.pageCount; i++) {
$('#singleDat').append('
')
$('img')[i - 1].style.width = '100%'
}
if (!dat.pageCount) $('#singleDat').append('
...
')
datSe = dat;
});
}
var personScoreList = []
function procName(str, o = 0) {
if (o) {
if (str[0] == '第') return '';
else return `data-toggle="tooltip" data-placement="left" title="${str.match(/[-_]/g) ? str.slice(str.split(/[-_]/g)[0].length + 1) : ''}"`
}
if (str[0] == '第') return str.slice(1, str.length - 1) + ':';
else return str.split(/[-_]/g)[0] + '.';
}
function getSec(id, force, force2) {
if (!force && !$('.nav-tabs>li')[3].classList[0]) return
if (!force2 && id == curSe) return
curSe = id
if (!stuId[cur]) stuId[cur] = prompt('数字校园号?')
if (!examId[cur]) examId[cur] = prompt('考试编号?(心意答点击考试标题后,切换考试的列表里可见)')
var bd = '{"schoolId":19707,"seId":' + id + ',"studentId":"' + stuId[cur] + '"}';
bd = aesEncrypt(bd)
fetch('/analysis/api/student/exam/getStudentReportSEVO', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: bd
}).then(res => res.json()).then(e => {
let dat = JSON.parse(aesDecrypt(e.data))
let str = ''
str += `- **. .`
str += `${personScoreList[id]}`
str += `${dat.singleExam.seFullScore}
`
let q = dat.examQuestions;
for (let i = 0; i < q.length; i++) {
idc = (q[i].personScore == q[i].eqFullScore ? 'success fullScore' : 'danger"');
let pid = procName(q[i].eqDisplayName), ofs = pid.toString().length * 8.41 - 24
str += `- ${pid}.`
if (q[i].personScore != q[i].eqFullScore) str += `${q[i].personScore}`
str += `${q[i].eqFullScore}`
str += `${q[i].qstTagName}
`
}
$('#detailDat').html(str + '
')
$("[data-toggle='tooltip']").tooltip();
});
}
var timer = []
function clearWriggle() {
for (let i = 0; i < timer.length; i++)clearInterval(timer[i])
timer = []
}
function wriggle(el) {
var last = 0, now = 10
timer.push(setInterval(function () {
now = Math.random() * 100 - 50
$(el).css('transform', $(el).css('transform').split('rotate')[0] + 'rotate(' + (now - last) + 'deg)')
last = now
}, Math.random() * 600 + 300))
}
function getCol(rate) {
if (90 <= rate) return 'success'
if (75 <= rate) return 'info'
if (60 <= rate) return 'warning'
else return 'danger'
}
var time, fontSize
function resizeChart() {
clearTimeout(time)
time = setTimeout(function () {
clearWriggle()
if ($('.nav-tabs>li')[0].classList[0] == 'active') {
console.log('reload chart')
cc.resize()
sc1.resize()
sc2.resize()
oc1.resize()
oc2.resize()
oc3.resize()
oc4.resize()
if ($('#score1>div').css('width') == '0px') $('#resizeBtn').show()
else $('#resizeBtn').hide(300)
} else if ($('.nav-tabs>li')[2].classList[0] == 'active') {
console.log('reload image')
for (let i = 0; i < datSe.pageCount; i++)imageLoaded(i)
$('.minus').css('font-size', fontSize)
}
}, 300)
}
function getClassCount() {
// if (examId[cur] == 1044 || examId[cur] == 1028 || examId[cur] == 1021 || examId[cur] == 972 || examId[cur] == 957 || examId[cur] == 951)
return '15'
// else if (examId[cur] == 970) return '13'
// else return '?'
}
var link = document.createElement('a'), url
function down() {
link.href = url;
link.setAttribute('download', "data.txt")
link.click();
}
var gScore = [], gName = []
const colorList = ["#5bc0de", "#5a7ddd", "#795add", "#ba5add", "#dd5abf", "#dd5a7d", "#dd795a", "#ddba5a", "#bfdd5a", "#7ddd5a", "#5add79", "#5addba", "#2aa9cf", "#20809d", "#cf512a", "#9d3d20"];
function processFiles(isFirstTime = 0) {
console.log("Start processing No. " + cur);
var file = files[cur];
url = window.URL.createObjectURL(file)
var message = $("#message")[0];
var tableLayout = '平均分 | 最高分 | 75% | 中位数 | 25% | 最低分 |
'
message.innerHTML = (cur + 1) + `/${(fileCount)} - ${file.name} - ${file.size} 字节 - ${file.type} - 正在读取...
>`;
$("#upbtn").removeClass('btn-danger');
$("#upbtn").addClass('btn-info');
$("#upicon").removeClass('glyphicon-exclamation-sign');
$("#upicon").addClass('glyphicon-open');
var reader = new FileReader();
reader.onload = function (event) {
try {
var output = $("#fileOutput")[0];
var info = $("#fileInfo")[0];
var name = $("#name")[0];
var object = JSON.parse(event.target.result);
var classText = "", ohText = "";
$('#single').empty();
$('#detail').empty();
var dat = JSON.parse(aesDecrypt(object.data).toString());
examId[cur] = dat.meId.toString();
stuId[cur] = dat.studentId;
info.innerHTML = `${dat.multiExam.meName}
`
var seIds = [], seNames = [];
var mulStu = dat.multiExamStudentScore, mulClass = dat.multiExamClassScores, datSingle = mulStu.singleExamStudentScores, datClass = dat.singleExamClassScores, datYs = dat.singleExamClassYsScores, datMulti = dat.multiExam.singleExams;
seIds = dat.seIds;
var n = seIds.length
for (let i = 0; i < n; i++) {
for (let j = 0; j < n; j++) {
if (datMulti[i].seId == seIds[j]) {
seNames[j] = datMulti[i].seCourseName;
}
}
}
// console.log(seIds)
// console.log(seNames)
var seNameDic = {};
for (let i = 0; i < n; i++) {
seNameDic[seIds[i]] = seNames[i];
}
seNameDic["0"] = "总分";
for (let i = 0; i < datYs.length; i++) {
seNameDic[datYs[i].seId + "Ys"] = seNameDic[datYs[i].seId] + " " + datYs[i].ysClassId;
}
var seIdDic = {}, seIdRev = {}, hasId = {};
for (let i = 0; i < n; i++) {
for (let j = 0; j < n; j++) {
if (!datSingle[j]) continue;
if (datSingle[j].seId == seIds[i]) {
hasId[i] = true;
seIdDic[j] = i;
}
}
}
for (let i = 1; i < n; i++) {
if (!hasId[i]) seIds[i] = -1
}
for (let i = 0; i < n; i++)seIdRev[seIdDic[i]] = i;
var scoreP = {}, avgP = {}, rate0 = {}, rate25 = {}, rate50 = {}, rate75 = {}, rate100 = {}, rateFull = {};//表1用
var classOrderP = {}, ysClassOrderP = {}, gradeOrderP = {};
var classOrder = {}, ysClassOrder = {}, gradeOrder = {};
for (let i = 0; i < n; i++) {
if (!datSingle[i]) continue;
var dId = datSingle[i].seId;
personScoreList[dId] = datSingle[i].essScore;
scoreP[dId] = datSingle[i].essScore;
avgP[dId] = datClass[i].secsAvgScore;
rate0[dId] = datClass[i].secsMinScore;
rate25[dId] = datClass[i].secsQuarterScore;
rate50[dId] = datClass[i].secsHalfScore;
rate75[dId] = datClass[i].secs3quatrerScore;
rate100[dId] = datClass[i].secsMaxScore;
rateFull[dId] = datMulti[seIdDic[i]].seFullScore;
classOrderP[dId] = datSingle[i].essClassOrder;
gradeOrderP[dId] = datSingle[i].essGradeOrder;
classOrder[dId] = decimal(1 - (datSingle[i].essClassOrder - 1) / datClass[i].secsStudentCount, 3);
gradeOrder[dId] = decimal(1 - (datSingle[i].essGradeOrder - 1) / datMulti[seIdDic[i]].seStudentCount, 3);
}
classOrder["0"] = decimal(1 - mulStu.messClassOrder / mulClass[0].mecsStudentCount, 3);
gradeOrder["0"] = decimal(1 - mulStu.messGradeOrder / dat.multiExamSchoolScore.mecsStudentCount, 3);
classOrderP["0"] = mulStu.messClassOrder;
gradeOrderP["0"] = mulStu.messGradeOrder
for (let i = 0; i < datYs.length; i++) {
for (let j = 0; j < n; j++) {
if (!datSingle[j]) continue;
if (datYs[i].seId == datSingle[j].seId) {
ysClassOrder[datYs[i].seId + "Ys"] = decimal(1 - (datSingle[j].essYsClassOrder - 1) / datYs[i].secsStudentCount, 3);
ysClassOrderP[datYs[i].seId + "Ys"] = datSingle[j].essYsClassOrder;
}
}
}
var classCount = getClassCount()
for (let i = 0; i < n; i++) {
// dat.multiExamStudentScore.singleExamStudentScores[i].seId ---mulStu
// dat.singleExamClassScores[i].seId ---datClass
// dat.multiExam.singleExams[i].seId ---datMulti
// seIds[i]
// 前两个和后两个数据应该是能分别对上号的(1-2 3-4),用 seIdDic 连接
// seIdDic {key(1-2): value(3-4),..}
//
// 干掉字符串相加:"[ \n]+\+[ \n]+([^"\n]*)[ \n]+\+[ \n]+" --> ${$1} 全局替换,妙极
var g = seIdRev[i];
if (!datSingle[g]) continue;
$('#single').append(``)
$('#detail').append(``)
classText += `${seNameDic[datSingle[g].seId]} ${datSingle[g].essScore}
${dat.examStudents[0].classId} 班内 ${datSingle[g].essClassOrder} / ${datClass[g].secsStudentCount}
${tableLayout}${datClass[g].secsAvgScore} | ${datClass[g].secsMaxScore} | ${datClass[g].secs3quatrerScore} | ${datClass[g].secsHalfScore} | ${datClass[g].secsQuarterScore} | ${datClass[g].secsMinScore} |
`;
ohText = `,${dat.examStudents[0].classId} 班 ${datClass[g].secsClassOrder} / ${classCount}`
for (let j = 0; j < datYs.length; j++) {
if (datYs[j].seId == datSingle[g].seId) {
classText += `${datYs[j].ysClassId} 层内 ${datSingle[g].essYsClassOrder} / ${datYs[j].secsStudentCount}
${tableLayout}${datYs[j].secsAvgScore} | ${datYs[j].secsMaxScore} | ${datYs[j].secs3quatrerScore} | ${datYs[j].secsHalfScore} | ${datYs[j].secsQuarterScore} | ${datYs[j].secsMinScore} |
`;
ohText += `,${datYs[j].ysClassId} 层 ${datYs[j].secsClassOrder} / ?`
}
}
classText += `年级 ${datSingle[g].essGradeOrder} / ${datMulti[seIdDic[g]].seStudentCount + ohText}
${tableLayout}${datMulti[seIdDic[g]].seAvgScore} | ${datMulti[seIdDic[g]].seMaxScore} | ${datMulti[seIdDic[g]].se3QuarterScore} | ${datMulti[seIdDic[g]].seHalfScore} | ${datMulti[seIdDic[g]].seQuarterScore} | ${datMulti[seIdDic[g]].seMinScore} |
`;
}
if (!curSe) curSe = seIds[0]
getSe(curSe, 0, 1)
getSec(curSe, 0, 1)
$('#single>button.' + curSe).addClass('active')
$('#detail>button.' + curSe).addClass('active')
} catch (e) {
console.log(e);
clearScreen();
message.innerHTML += "读取失败!";
$("#upbtn").removeClass('btn-info');
$("#upbtn").addClass('btn-danger');
$("#upicon").removeClass('glyphicon-open');
$("#upicon").addClass('glyphicon-exclamation-sign');
return;
}
$('#single').append(``)
$('#single').append(``)
$('#single').append(`
`)
$('#detail').append(``)
$('#detail').append(`
`)
if (isFirstTime) {
var bd = JSON.stringify({
content: user + ' fetched ' + stuId[cur] + ' (' + parseInt(dat.examStudents[0].classId) + ' ' + mulStu.studentName + ') ' + examId[cur] + ' ("' + dat.multiExam.meName + '")',
})
fetch('/score/log', {
method: 'POST',
headers: {
'Content-type': 'application/json',
},
body: bd
})
}
message.innerHTML += "读取成功!
";
name.innerHTML = "姓名:" + mulStu.studentName;
info.innerHTML = `${dat.multiExam.meName} ${dat.examStudents[0].classId}班 ${mulStu.studentName}
`
if (n > 1) output.innerHTML = `总分 ${mulStu.messScore}
${dat.examStudents[0].classId} 班内 ${mulStu.messClassOrder} / ${mulClass[0].mecsStudentCount}
${tableLayout}${mulClass[0].mecsAvgScore} | ${mulClass[0].mecsMaxScore} | ${mulClass[0].mecs3quatrerScore} | ${mulClass[0].mecsHalfScore} | ${mulClass[0].mecsQuarterScore} | ${mulClass[0].mecsMinScore} |
年级 ${mulStu.messGradeOrder} / ${dat.multiExamSchoolScore.mecsStudentCount},${dat.examStudents[0].classId}班 ${mulClass[0].mecsClassOrder} / ${classCount}
${tableLayout}${dat.multiExam.meAvgScore} | ${dat.multiExam.meMaxScore} | ${dat.multiExam.me3QuatrerScore} | ${dat.multiExam.meHalfScore} | ${dat.multiExam.meQuarterScore} | ${dat.multiExam.meMinScore} |
${classText}`
else output.innerHTML = classText;
$("#fileOutput table").css("display", "inline-table");
$("#fileOutput table").css("margin-bottom", "0px");
$('.chart').show();
cc = echarts.init($("#comp")[0]);
sc1 = echarts.init($("#score1")[0]);
sc2 = echarts.init($("#score2")[0]);
oc1 = echarts.init($("#order1")[0]);
oc2 = echarts.init($("#order2")[0]);
oc3 = echarts.init($("#order3")[0]);
oc4 = echarts.init($("#order4")[0]);
if (fileCount <= 1) $('#comp').hide();
else $('#comp').show(), cc.resize();
var seNameDicP = [], scorePP = [], scoreSe = {}, avgPP = [], rateFullP = [], scoreQ = [], avgQ = [];
var seNameDicP2 = [], classOrderPP = [], gradeOrderPP = [], classOrderQ = [], gradeOrderQ = [];
var seNameDicP3 = [], ysClassOrderPP = [], ysClassOrderQ = [];
seIds[n] = 0
var boxP = [], boxQ = [];
for (let i = 0; i < n; i++) {
var g = seIds[i];
if (g == -1) continue;
scoreSe[seNameDic[g]] = scoreP[g];
if (seNameDic[g].substr(0, 2) == '总分') continue;
seNameDicP.push(seNameDic[g].substr(0, 2));
scorePP.push(scoreP[g]);
avgPP.push(avgP[g]);
// rate0P.push(rate0[g]);
// rate25P.push(rate25[g]);
// rate50P.push(rate50[g]);
// rate75P.push(rate75[g]);
// rate100P.push(rate100[g]);
rateFullP.push(rateFull[g]);
boxP.push({ value: [rate0[g], rate25[g], rate50[g], rate75[g], rate100[g]] })
scoreQ.push(decimal(scoreP[g] / rateFull[g] * 100, 1));
avgQ.push(decimal(avgP[g] / rateFull[g] * 100, 1));
// rate0Q.push(decimal(rate0[g] / rateFull[g] * 100, 1));
// rate25Q.push(decimal(rate25[g] / rateFull[g] * 100, 1));
// rate50Q.push(decimal(rate50[g] / rateFull[g] * 100, 1));
// rate75Q.push(decimal(rate75[g] / rateFull[g] * 100, 1));
// rate100Q.push(decimal(rate100[g] / rateFull[g] * 100, 1));
boxQ.push({
value: [decimal(rate0[g] / rateFull[g] * 100, 1),
decimal(rate25[g] / rateFull[g] * 100, 1),
decimal(rate50[g] / rateFull[g] * 100, 1),
decimal(rate75[g] / rateFull[g] * 100, 1),
decimal(rate100[g] / rateFull[g] * 100, 1)]
})
}
for (let i = 0; i <= n; i++) {
var g = seIds[i];
if (g == -1) continue;
if (seNameDic[g].substr(0, 2) == '总分' && n == 1) continue;
seNameDicP2.push(seNameDic[g].substr(0, 2));
classOrderPP.push(classOrderP[g]);
gradeOrderPP.push(gradeOrderP[g]);
if (classOrder[g] >= 0.99) classOrderQ.push({
value: decimal(classOrder[g] * 100, 1), itemStyle: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{ offset: 0, color: '#f0ad4e' },
{ offset: 0.7, color: '#5bc0de' }
])
}
});
else classOrderQ.push(decimal(classOrder[g] * 100, 1));
if (gradeOrder[g] >= 0.99) gradeOrderQ.push({
value: decimal(gradeOrder[g] * 100, 1), itemStyle: {
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{ offset: 0, color: '#d9534f' },
{ offset: 0.7, color: '#337ab7' }
])
}
});
else gradeOrderQ.push(decimal(gradeOrder[g] * 100, 1));
}
for (let i in ysClassOrderP) {
seNameDicP3.push(seNameDic[i]);
ysClassOrderPP.push(ysClassOrderP[i]);
ysClassOrderQ.push(decimal(ysClassOrder[i] * 100, 1));
}
if (!ysClassOrderPP.length) $("#order3").hide(), $("#order4").hide()// ^_^
gScore[cur] = scoreSe
gName[cur] = mulStu.studentName
var opBase = {
textStyle: { fontFamily: 'Noto Serif SC' },
tooltip: { trigger: 'axis' },
toolbox: {
show: true,
feature: {
saveAsImage: { show: true },
dataView: {
show: true,
readOnly: false
}
},
orient: 'vertical'
},
emphasis: {
focus: 'series',
},
calculable: true,
}
var cOp = { ...opBase }, sOp1 = { ...opBase }, sOp2 = { ...opBase }, oOp1 = { ...opBase }, oOp2 = { ...opBase }, oOp3 = { ...opBase }, oOp4 = { ...opBase };
var cName = [], cSe = [], cSeries = []
for (let i = 0; i < fileCount; i++) {
for (let j in gScore[i]) {
if (cName.indexOf(j) == -1) cName.push(j)
}
}
for (let i = 0; i < fileCount; i++) {
cSe.push([])
if (gScore[i]) {
for (let j = 0; j < cName.length; j++) {
cSe[i].push(gScore[i][cName[j]])
}
cSeries.push({ name: gName[i], type: 'line', data: cSe[i], color: colorList[i] })
}
}
cOp.title = {
text: '比一比',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
cOp.legend = { data: gName }
cOp.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: cName,
name: '科目',
position: 'left'
}]
cOp.yAxis = [{
type: 'value', name: '分数', position: 'left'
}]
cOp.series = cSeries
sOp1.title = {
text: '分数',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
sOp1.legend = { data: ['四分位', /*'0%', '25%', '50%', '75%', '100%',*/ '满分', '平均分', '我的分数'] }
sOp1.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: seNameDicP,
name: '科目',
position: 'left'
}]
sOp1.yAxis = [{
type: 'value', name: '分数', position: 'left'
}]
sOp1.series = [
{
name: '四分位',
type: 'boxplot', data: boxP, color: '#5bc0de',
itemStyle: {
color: 'transparent'
}
},
// { name: '0%', type: 'line', data: rate0P, color: '#5cb85c' },
// { name: '25%', type: 'line', data: rate25P, color: '#c7dc68' },
// { name: '50%', type: 'line', data: rate50P, color: '#f0ad4e' },
// { name: '75%', type: 'line', data: rate75P, color: '#c7dc68' },
// { name: '100%', type: 'line', data: rate100P, color: '#5cb85c' },
{ name: '满分', type: 'scatter', data: rateFullP, color: '#b6b6b6' },
{ name: '平均分', type: 'line', data: avgPP, color: '#337ab7' },
{ name: '我的分数', type: 'line', data: scorePP, color: '#e2041b' },
]
sOp2.title = {
text: '得分率',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
sOp2.legend = { data: ['四分位', /*'0%', '25%', '50%', '75%', '100%', */'平均得分率', '我的得分率'] }
sOp2.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category',
data: seNameDicP,
name: '科目',
position: 'left'
}]
sOp2.yAxis = [{
type: 'value',
name: '得分率(%)',
position: 'left'
}]
sOp2.series = [
{
name: '四分位', type: 'boxplot', data: boxQ, color: '#5bc0de',
itemStyle: {
color: 'transparent'
}
},
// { name: '0%', type: 'line', data: rate0Q, color: '#5cb85c' },
// { name: '25%', type: 'line', data: rate25Q, color: '#c7dc68' },
// { name: '50%', type: 'line', data: rate50Q, color: '#f0ad4e' },
// { name: '75%', type: 'line', data: rate75Q, color: '#c7dc68' },
// { name: '100%', type: 'line', data: rate100Q, color: '#5cb85c' },
{ name: '平均得分率', type: 'line', data: avgQ, color: '#337ab7' },
{ name: '我的得分率', type: 'line', data: scoreQ, color: '#d9534f' }
]
oOp1.title = {
text: '行政排名位次',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
oOp1.legend = { data: ['班级排名', '年级排名'] }
oOp1.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: seNameDicP2,
name: '科目',
position: 'left'
}]
oOp1.yAxis = [{
type: 'value',
name: '排名',
position: 'left'
}]
oOp1.series = [
{ name: '班级排名', type: 'bar', data: classOrderPP, color: '#5bc0de' },
{ name: '年级排名', type: 'bar', data: gradeOrderPP, color: '#337ab7' }
]
oOp2.title = {
text: '行政排名比例',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
oOp2.legend = { data: ['班级排名(%)', '年级排名(%)'] }
oOp2.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: seNameDicP2,
name: '科目',
position: 'left'
}]
oOp2.yAxis = [{
type: 'value',
name: '排名(%)',
position: 'left',
max: 100,
}]
oOp2.series = [
{ name: '班级排名(%)', type: 'bar', data: classOrderQ, color: '#5bc0de' },
{ name: '年级排名(%)', type: 'bar', data: gradeOrderQ, color: '#337ab7' }
]
oOp3.title = {
text: '分班排名位次',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
oOp3.legend = { data: ['分班排名'] }
oOp3.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: seNameDicP3,
name: '科目',
position: 'left'
}]
oOp3.yAxis = [{
type: 'value',
name: '排名',
position: 'left'
}]
oOp3.series = [{
name: '分班排名', type: 'bar', data: ysClassOrderPP, color: '#5cb85c'
}]
oOp4.title = {
text: '分班排名比例',
textStyle: {
fontSize: 14,
fontStyle: 'normal',
fontWeight: 'bold',
},
}
oOp4.legend = { data: ['分班排名(%)'] }
oOp4.xAxis = [{
axisTick: {
alignWithLabel: true
},
type: 'category', data: seNameDicP3,
name: '科目',
position: 'left'
}]
oOp4.yAxis = [{
type: 'value',
name: '排名(%)',
position: 'left',
max: 100,
}]
oOp4.series = [{
name: '分班排名(%)', type: 'bar', data: ysClassOrderQ, color: '#5cb85c'
}]
// 为echarts对象加载数据
cc.setOption(cOp);
sc1.setOption(sOp1);
sc2.setOption(sOp2);
oc1.setOption(oOp1);
oc2.setOption(oOp2);
oc3.setOption(oOp3);
oc4.setOption(oOp4);
window.onresize = resizeChart
}
reader.readAsText(file);
}
$().ready(function () {
$(".chart").hide()
$(function () { $("[data-toggle='tooltip']").tooltip(); });
$("#Input").keydown(function (e) {
if (e.keyCode == 13) {
$("#fetchBtn")[0].click();
}
})
if (getCookie('gosh')) check(getCookie('gosh'))
})
//uglifyjs public/js/score.js -c -m eval,toplevel,reserved=[check,nextFile,prevFile,fetchMe,resizeChart,getSe,getSec,imageLoaded,getFiles,fontSize,curSe,datSe] -o public/js/score.min.js