score.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. function toggleHide() {
  2. $(".hidable").toggle();
  3. };
  4. var postKnownExams = '3129,3096,3132,3101,3104,3087,3111,3092,3116,3067,3061,3121,3122,3123,3124,3125,3126,3127,3128,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146'
  5. var knownExams = ''
  6. for (let i = 3000; i < 3200; i++)knownExams += i.toString() + ','
  7. knownExams = knownExams.slice(0, knownExams.length - 1)
  8. // AV.init({
  9. // appId: "BmologYYnRqCv0SLHDeDdA17-gzGzoHsz",
  10. // appKey: "w9mVebFMdCmY6Nh9vfcBGaGt",
  11. // serverURL: "https://bmologyy.lc-cn-n1-shared.com/",
  12. // });
  13. console.log("温馨提示:*成绩*一定不会上传到网络,但为了保证使用范围,可能会对其他信息进行记录。")
  14. function decimal(x, n) {
  15. x = Math.round(x * 10 ** n) / 10 ** n;
  16. return x.toFixed(n);
  17. }
  18. var fileCount = 0, cur = 0, files = {};
  19. function prevFile() {
  20. cur = (cur - 1 + fileCount) % fileCount;
  21. processFiles();
  22. }
  23. function nextFile() {
  24. cur = (cur + 1) % fileCount;
  25. processFiles();
  26. }
  27. function clearScreen() {
  28. $(".chart").hide()
  29. $("#fileOutput")[0].innerHTML = "";
  30. // $("#fileInfo")[0].innerHTML = "";
  31. $("#name")[0].innerHTML = "";
  32. }
  33. document.onkeydown = function (event) {
  34. var e = event || window.event || arguments.callee.caller.arguments[0];
  35. if (e) {
  36. if (e.key == "ArrowLeft") {
  37. prevFile();
  38. }
  39. else if (e.key == "ArrowRight") {
  40. nextFile();
  41. }
  42. // else if ('1' <= e.key && e.key <= '9') {
  43. // if (parseInt(e.key) <= fileCount) {
  44. // cur = parseInt(e.key) - 1;
  45. // processFiles();
  46. // }
  47. // }
  48. }
  49. };
  50. function getFiles(event) {
  51. files[fileCount] = event.target.files[0];
  52. cur = fileCount;
  53. fileCount++;
  54. $("#controls").removeClass("disabled");
  55. $("#lbtn").removeClass("disabled");
  56. $("#rbtn").removeClass("disabled");
  57. processFiles(1);
  58. }
  59. const key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
  60. function aesDecrypt(encrypted) {
  61. var encryptedHexStr = CryptoJS.enc.Hex.parse(encrypted);
  62. var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(encrypted) })
  63. var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
  64. var decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
  65. return decryptedStr;
  66. }
  67. function aesEncrypt(encrypted) {
  68. var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(encrypted) })
  69. return CryptoJS.AES.encrypt(encrypted, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).ciphertext.toString();
  70. }
  71. function stringToByte(str) {
  72. var bytes = new Array();
  73. var len, c;
  74. len = str.length;
  75. for (var i = 0; i < len; i++) {
  76. c = str.charCodeAt(i);
  77. if (c >= 0x010000 && c <= 0x10FFFF) {
  78. bytes.push(((c >> 18) & 0x07) | 0xF0);
  79. bytes.push(((c >> 12) & 0x3F) | 0x80);
  80. bytes.push(((c >> 6) & 0x3F) | 0x80);
  81. bytes.push((c & 0x3F) | 0x80);
  82. } else if (c >= 0x000800 && c <= 0x00FFFF) {
  83. bytes.push(((c >> 12) & 0x0F) | 0xE0);
  84. bytes.push(((c >> 6) & 0x3F) | 0x80);
  85. bytes.push((c & 0x3F) | 0x80);
  86. } else if (c >= 0x000080 && c <= 0x0007FF) {
  87. bytes.push(((c >> 6) & 0x1F) | 0xC0);
  88. bytes.push((c & 0x3F) | 0x80);
  89. } else {
  90. bytes.push(c & 0xFF);
  91. }
  92. }
  93. return bytes;
  94. }
  95. $().ready(function () {
  96. $("#Input").keydown(function (e) {
  97. if (e.keyCode == 13) {
  98. $("#fetchBtn")[0].click();
  99. }
  100. });
  101. })
  102. function fetchDo(id) {
  103. var bd = '{"meId":' + $('#Id').val() + ',"seIds":"' + knownExams + '","schoolId":19707,"studentId":"' + id + '"}';
  104. console.log(bd)
  105. bd = aesEncrypt(bd)
  106. console.log(bd)
  107. fetch('http://36.112.23.77/analysis/api/student/exam/getStudentReportMEVO', {
  108. method: 'POST',
  109. headers: {
  110. 'Content-type': 'application/json',
  111. },
  112. body: bd
  113. }).then(res => {
  114. res.text().then(resj => {
  115. files[fileCount] = new Blob([resj], {
  116. type: 'text/plain'
  117. });;
  118. cur = fileCount;
  119. fileCount++;
  120. $("#controls").removeClass("disabled");
  121. $("#lbtn").removeClass("disabled");
  122. $("#rbtn").removeClass("disabled");
  123. processFiles(1);
  124. });
  125. })
  126. }
  127. function fetchMe(id) {
  128. if (!parseInt(id)) {
  129. fetch('/js/e.json', {
  130. method: 'GET',
  131. headers: {
  132. 'Content-type': 'application/json',
  133. }
  134. }).then(res => {
  135. res.json().then(resj => {
  136. var queryData = resj.data.filter(function (e) {
  137. return e.name == id
  138. });
  139. fetchDo(queryData[0].no)
  140. });
  141. })
  142. } else fetchDo(id)
  143. }
  144. function processFiles(isFirstTime = 0) {
  145. console.log("Start processing No. " + cur);
  146. var file = files[cur];
  147. var message = $("#message")[0];
  148. var upBtn = $("#upbtn")[0];
  149. var upIcon = $("#upicon")[0];
  150. var tableLayout = '<table class="table table-responsive" style="table-layout: fixed;">'
  151. message.innerHTML = (cur + 1) + "/" + (fileCount) + " - " + file.name + " - " + file.size + " 字节 - " + file.type + " - 正在读取...<br>>";
  152. upBtn.classList.remove('btn-danger');
  153. upBtn.classList.add('btn-info');
  154. upIcon.classList.remove('glyphicon-exclamation-sign');
  155. upIcon.classList.add('glyphicon-open');
  156. var reader = new FileReader();
  157. var content = "";
  158. reader.onload = function (event) {
  159. try {
  160. var output = $("#fileOutput")[0];
  161. var info = $("#fileInfo")[0];
  162. var name = $("#name")[0];
  163. var object = eval("(" + event.target.result + ")");
  164. var classText = "", gradingText = "";
  165. object.data = eval("(" + aesDecrypt(object.data).toString() + ")");
  166. console.log(object.data)
  167. info.innerHTML = "<h3>" + object.data.multiExam.meName + "</h3>"
  168. console.log(object.data.multiExam.meName)
  169. var seIds = [], seNames = [], iter = 1;
  170. var datSingle = object.data.multiExamStudentScore.singleExamStudentScores, datClass = object.data.singleExamClassScores, datYs = object.data.singleExamClassYsScores, datMulti = object.data.multiExam.singleExams;
  171. seIds = object.data.seIds;
  172. for (var i = 0; i < seIds.length; i++) {
  173. for (var j = 0; j < seIds.length; j++) {
  174. if (datMulti[i].seId == seIds[j]) {
  175. seNames[j] = datMulti[i].seCourseName;
  176. }
  177. }
  178. }
  179. // console.log(seIds)
  180. // console.log(seNames)
  181. var seNameDic = {};
  182. for (var i = 0; i < seIds.length; i++) {
  183. seNameDic[seIds[i]] = seNames[i];
  184. }
  185. seNameDic["0"] = "总分";
  186. for (var i = 0; i < datYs.length; i++) {
  187. seNameDic[datYs[i].seId + "Ys"] = seNameDic[datYs[i].seId] + " " + datYs[i].ysClassId;
  188. }
  189. var seIdDic = {}, seIdRev = {}, hasId = {};
  190. for (var i = 0; i < seIds.length; i++) {
  191. for (var j = 0; j < seIds.length; j++) {
  192. if (!datSingle[j]) continue;
  193. if (datSingle[j].seId == seIds[i]) {
  194. hasId[i] = true;
  195. seIdDic[j] = i;
  196. }
  197. }
  198. }
  199. for (var i = 1; i < seIds.length; i++) {
  200. if (!hasId[i]) seIds[i] = -1
  201. }
  202. for (var i = 0; i < seIds.length; i++)seIdRev[seIdDic[i]] = i;
  203. var scoreP = {}, avgP = {}, rate0 = {}, rate25 = {}, rate50 = {}, rate75 = {}, rate100 = {}, rateFull = {};//表1用
  204. var classOrderP = {}, ysClassOrderP = {}, gradeOrderP = {};
  205. var classOrder = {}, ysClassOrder = {}, gradeOrder = {};
  206. for (var i = 0; i < seIds.length; i++) {
  207. if (!datSingle[i]) continue;
  208. var dId = datSingle[i].seId;
  209. scoreP[dId] = datSingle[i].essScore;
  210. avgP[dId] = datClass[i].secsAvgScore;
  211. rate0[dId] = datClass[i].secsMinScore;
  212. rate25[dId] = datClass[i].secsQuarterScore;
  213. rate50[dId] = datClass[i].secsHalfScore;
  214. rate75[dId] = datClass[i].secs3quatrerScore;
  215. rate100[dId] = datClass[i].secsMaxScore;
  216. rateFull[dId] = datMulti[seIdDic[i]].seFullScore;
  217. // scoreRate[dId] = decimal(datSingle[i].essScore / datMulti[seIdDic[i]].seFullScore, 3);
  218. classOrderP[dId] = datSingle[i].essClassOrder;
  219. gradeOrderP[dId] = datSingle[i].essGradeOrder;
  220. classOrder[dId] = decimal(1 - datSingle[i].essClassOrder / datClass[i].secsStudentCount, 3);
  221. gradeOrder[dId] = decimal(1 - datSingle[i].essGradeOrder / datMulti[seIdDic[i]].seStudentCount, 3);
  222. }
  223. // scoreRate["0"] = decimal(object.data.multiExamStudentScore.messScore / object.data.multiExam.meFullScore, 3);
  224. classOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messClassOrder / object.data.multiExamClassScores[0].mecsStudentCount, 3); + "<br>"
  225. gradeOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messGradeOrder / object.data.multiExamSchoolScore.mecsStudentCount, 3); + "<br>"
  226. classOrderP["0"] = object.data.multiExamStudentScore.messClassOrder;
  227. gradeOrderP["0"] = object.data.multiExamStudentScore.messGradeOrder
  228. for (var i = 0; i < datYs.length; i++) {
  229. for (var j = 0; j < seIds.length; j++) {
  230. if (!datSingle[j]) continue;
  231. if (datYs[i].seId == datSingle[j].seId) {
  232. ysClassOrder[datYs[i].seId + "Ys"] = decimal(1 - datSingle[j].essYsClassOrder / datYs[i].secsStudentCount, 3);
  233. ysClassOrderP[datYs[i].seId + "Ys"] = datSingle[j].essYsClassOrder;
  234. }
  235. }
  236. }
  237. for (var i = 0; i < seIds.length; i++) {
  238. // object.data.multiExamStudentScore.singleExamStudentScores[i].seId ---datSingle
  239. // object.data.singleExamClassScores[i].seId ---datClass
  240. // object.data.multiExam.singleExams[i].seId ---datMulti
  241. // seIds[i]
  242. // 前两个和后两个数据应该是能分别对上号的(1-2 3-4),用 seIdDic 连接
  243. // seIdDic {key(1-2): value(3-4),..}
  244. var g = seIdRev[i];
  245. if (!datSingle[g]) continue;
  246. classText += "<h4>"
  247. + seNameDic[datSingle[g].seId] + "</h4>"
  248. + "<b>单科分数:" + datSingle[g].essScore + "</b><br><br>"
  249. + "单科分数班级排名:" + datSingle[g].essClassOrder + "<br>"
  250. + "单科班级参考人数:" + datClass[g].secsStudentCount + "<br>"
  251. + "单科班级年级排名:" + datClass[g].secsClassOrder + "<br>"
  252. + "单科班级:"
  253. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  254. + "<tr><td>" + datClass[g].secsAvgScore + "</td><td>" + datClass[g].secsMaxScore + "</td><td>" + datClass[g].secs3quatrerScore + "</td><td>" + datClass[g].secsHalfScore + "</td><td>" + datClass[g].secsQuarterScore + "</td><td>" + datClass[g].secsMinScore + "</td></tr></table>";
  255. for (var j = 0; j < datYs.length; j++) {
  256. if (datYs[j].seId == datSingle[g].seId) {
  257. classText += "<br><br>"
  258. + "单科分层班级名称:" + datYs[j].ysClassId + "<br>"
  259. + "单科分数分层班级排名:" + datSingle[g].essYsClassOrder + "<br>"
  260. + "单科分层班级参考人数:" + datYs[j].secsStudentCount + "<br>"
  261. + "单科分层班级年级排名:" + datYs[j].secsClassOrder + "<br>"
  262. + "单科分层班级:"
  263. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  264. + "<tr><td>" + datYs[j].secsAvgScore + "</td><td>" + datYs[j].secsMaxScore + "</td><td>" + datYs[j].secs3quatrerScore + "</td><td>" + datYs[j].secsHalfScore + "</td><td>" + datYs[j].secsQuarterScore + "</td><td>" + datYs[j].secsMinScore + "</td></tr></table>";
  265. }
  266. }
  267. classText += "<br><br>"
  268. + "单科分数年级排名:" + datSingle[g].essGradeOrder + "<br>"
  269. + "单科年级参考人数:" + datMulti[seIdDic[g]].seStudentCount + "<br>"
  270. + "单科年级:"
  271. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  272. + "<tr><td>" + datMulti[seIdDic[g]].seAvgScore + "</td><td>" + datMulti[seIdDic[g]].seMaxScore + "</td><td>" + datMulti[seIdDic[g]].se3QuarterScore + "</td><td>" + datMulti[seIdDic[g]].seHalfScore + "</td><td>" + datMulti[seIdDic[g]].seQuarterScore + "</td><td>" + datMulti[seIdDic[g]].seMinScore + "</td></tr></table><br><br>";
  273. }
  274. } catch (e) {
  275. console.log(e);
  276. clearScreen();
  277. message.innerHTML += "读取失败!";
  278. upBtn.classList.remove('btn-info');
  279. upBtn.classList.add('btn-danger');
  280. upIcon.classList.remove('glyphicon-open');
  281. upIcon.classList.add('glyphicon-exclamation-sign');
  282. return;
  283. }
  284. // sheetOutput("各科得分比例一览表", scoreRate);
  285. // sheetOutput("各科班级排名一览表", classOrder);
  286. // sheetOutput("各科分层班级排名一览表", ysClassOrder);
  287. // sheetOutput("各科年级排名一览表", gradeOrder);
  288. if (isFirstTime) {
  289. // const up = AV.Object.extend('Score');
  290. // const upload = new up();
  291. // upload.set('name', object.data.multiExamStudentScore.studentName);
  292. // upload.set('classId', parseInt(object.data.examStudents[0].classId));
  293. // upload.save().then((upload) => {
  294. // console.log("success" + upload);
  295. // });
  296. var bd = JSON.stringify({
  297. content: object.data.multiExamStudentScore.studentName + ' ' + parseInt(object.data.examStudents[0].classId),
  298. })
  299. fetch('/score/log', {
  300. method: 'POST',
  301. headers: {
  302. 'Content-type': 'application/json',
  303. },
  304. body: bd
  305. })
  306. }
  307. message.innerHTML += "读取成功!"
  308. + " - 注:实验中学 74 桌出品,我仅做搬运修改。<br>";
  309. name.innerHTML = "姓名:" + object.data.multiExamStudentScore.studentName;
  310. info.innerHTML = "<h3>" + object.data.multiExam.meName + "</h3>"
  311. + "行政班级:" + object.data.examStudents[0].classId + "<br>"
  312. + "姓名:" + object.data.multiExamStudentScore.studentName + "<br>";
  313. output.innerHTML = "<br><h4>总分</h4>"
  314. + "<b>全科分数:" + object.data.multiExamStudentScore.messScore + "</b><br><br>"
  315. + "全科分数班级排名:" + object.data.multiExamStudentScore.messClassOrder + "<br>"
  316. + "全科班级参考人数:" + object.data.multiExamClassScores[0].mecsStudentCount + "<br>"
  317. + "全科班级年级排名:" + object.data.multiExamClassScores[0].mecsClassOrder + "<br>"
  318. + "全科班级:"
  319. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  320. + "<tr><td>" + object.data.multiExamClassScores[0].mecsAvgScore + "</td><td>" + object.data.multiExamClassScores[0].mecsMaxScore + "</td><td>" + object.data.multiExamClassScores[0].mecs3quatrerScore + "</td><td>" + object.data.multiExamClassScores[0].mecsHalfScore + "</td><td>" + object.data.multiExamClassScores[0].mecsQuarterScore + "</td><td>" + object.data.multiExamClassScores[0].mecsMinScore + "</td></tr></table>"
  321. + "<br><br>全科分数年级排名:" + object.data.multiExamStudentScore.messGradeOrder + "<br>"
  322. + "全科年级参考人数:" + object.data.multiExamSchoolScore.mecsStudentCount + "<br>"
  323. + "全科年级:"
  324. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  325. + "<tr><td>" + object.data.multiExam.meAvgScore + "</td><td>" + object.data.multiExam.meMaxScore + "</td><td>" + object.data.multiExam.me3QuatrerScore + "</td><td>" + object.data.multiExam.meHalfScore + "</td><td>" + object.data.multiExam.meQuarterScore + "</td><td>" + object.data.multiExam.meMinScore + "</td></tr></table><br><br>"
  326. + classText;
  327. $("#fileOutput table").css("display", "inline-table");
  328. $("#fileOutput table").css("margin-bottom", "0px");
  329. $('.chart').show();
  330. sChart1 = echarts.init($("#score1")[0]);
  331. sChart2 = echarts.init($("#score2")[0]);
  332. oChart1 = echarts.init($("#order1")[0]);
  333. oChart2 = echarts.init($("#order2")[0]);
  334. oChart3 = echarts.init($("#order3")[0]);
  335. oChart4 = echarts.init($("#order4")[0]);
  336. seNameDicP = []; scorePP = []; avgPP = []; rate0P = []; rate25P = []; rate50P = []; rate75P = []; rate100P = []; rateFullP = [];
  337. scoreQ = []; avgQ = []; rate0Q = []; rate25Q = []; rate50Q = []; rate75Q = []; rate100Q = [];
  338. seNameDicP2 = []; classOrderPP = []; gradeOrderPP = []; classOrderQ = []; gradeOrderQ = [];
  339. seNameDicP3 = []; ysClassOrderPP = []; ysClassOrderQ = [];
  340. seIds[seIds.length] = 0
  341. for (var i = 0; i < seIds.length; i++) {
  342. var g = seIds[i];
  343. if (g == -1) continue;
  344. if (seNameDic[g].substr(0, 2) == '总分') continue;
  345. seNameDicP.push(seNameDic[g].substr(0, 2));
  346. scorePP.push(scoreP[g]);
  347. avgPP.push(avgP[g]);
  348. rate0P.push(rate0[g]);
  349. rate25P.push(rate25[g]);
  350. rate50P.push(rate50[g]);
  351. rate75P.push(rate75[g]);
  352. rate100P.push(rate100[g]);
  353. rateFullP.push(rateFull[g]);
  354. scoreQ.push(decimal(scoreP[g] / rateFull[g] * 100, 1));
  355. avgQ.push(decimal(avgP[g] / rateFull[g] * 100, 1));
  356. rate0Q.push(decimal(rate0[g] / rateFull[g] * 100, 1));
  357. rate25Q.push(decimal(rate25[g] / rateFull[g] * 100, 1));
  358. rate50Q.push(decimal(rate50[g] / rateFull[g] * 100, 1));
  359. rate75Q.push(decimal(rate75[g] / rateFull[g] * 100, 1));
  360. rate100Q.push(decimal(rate100[g] / rateFull[g] * 100, 1));
  361. }
  362. for (var i = 0; i < seIds.length; i++) {
  363. var g = seIds[i];
  364. if (g == -1) continue;
  365. seNameDicP2.push(seNameDic[g].substr(0, 2));
  366. classOrderPP.push(classOrderP[g]);
  367. gradeOrderPP.push(gradeOrderP[g]);
  368. classOrderQ.push(decimal(classOrder[g] * 100, 1));
  369. gradeOrderQ.push(decimal(gradeOrder[g] * 100, 1));
  370. }
  371. for (var i in ysClassOrderP) {
  372. seNameDicP3.push(seNameDic[i]);
  373. ysClassOrderPP.push(ysClassOrderP[i]);
  374. ysClassOrderQ.push(decimal(ysClassOrder[i] * 100, 1));
  375. }
  376. var sOp1 = {
  377. textStyle: {
  378. fontFamily: 'Noto Serif SC'
  379. },
  380. title: {
  381. text: '分数',
  382. textStyle: {
  383. fontSize: 14,
  384. fontStyle: 'normal',
  385. fontWeight: 'bold',
  386. },
  387. },
  388. tooltip: {
  389. trigger: 'axis'
  390. },
  391. legend: {
  392. data: ['0%', '25%', '50%', '75%', '100%', '满分', '平均分', '我的分数']
  393. },
  394. toolbox: {
  395. show: true,
  396. feature: {
  397. saveAsImage: {
  398. show: true
  399. },
  400. dataView: {
  401. show: true,
  402. readOnly: false
  403. }
  404. },
  405. padding: 25,
  406. orient: 'vertical'
  407. },
  408. calculable: true,
  409. xAxis: [{
  410. type: 'category', data: seNameDicP,
  411. name: '科目',
  412. position: 'left'
  413. }],
  414. yAxis: [{
  415. type: 'value', name: '分数', position: 'left'
  416. }],
  417. series: [{
  418. name: '0%', type: 'line', data: rate0P, color: '#5cb85c'
  419. }, {
  420. name: '25%', type: 'line', data: rate25P, color: '#c7dc68'
  421. }, {
  422. name: '50%', type: 'line', data: rate50P, color: '#c7dc68'
  423. }, {
  424. name: '75%', type: 'line', data: rate75P, color: '#c7dc68'
  425. }, {
  426. name: '100%', type: 'line', data: rate100P, color: '#5cb85c'
  427. }, {
  428. name: '满分', type: 'line', data: rateFullP, color: '#f0ad4e'
  429. }, {
  430. name: '平均分', type: 'line', data: avgPP, color: '#337ab7'
  431. }, {
  432. name: '我的分数', type: 'line', data: scorePP, color: '#e2041b'
  433. }],
  434. };
  435. var sOp2 = {
  436. textStyle: {
  437. fontFamily: 'Noto Serif SC'
  438. },
  439. title: {
  440. text: '得分率',
  441. textStyle: {
  442. fontSize: 14,
  443. fontStyle: 'normal',
  444. fontWeight: 'bold',
  445. },
  446. },
  447. tooltip: {
  448. trigger: 'axis'
  449. },
  450. legend: {
  451. data: ['0%', '25%', '50%', '75%', '100%', '平均得分率', '我的得分率']
  452. },
  453. toolbox: {
  454. show: true,
  455. feature: {
  456. saveAsImage: {
  457. show: true
  458. },
  459. dataView: {
  460. show: true,
  461. readOnly: false
  462. }
  463. },
  464. padding: 25,
  465. orient: 'vertical'
  466. },
  467. calculable: true,
  468. xAxis: [{
  469. type: 'category',
  470. data: seNameDicP,
  471. name: '科目',
  472. position: 'left'
  473. }],
  474. yAxis: [{
  475. type: 'value',
  476. name: '得分率(%)',
  477. position: 'left'
  478. }],
  479. series: [{
  480. name: '0%', type: 'line', data: rate0Q, color: '#5cb85c'
  481. }, {
  482. name: '25%', type: 'line', data: rate25Q, color: '#c7dc68'
  483. }, {
  484. name: '50%', type: 'line', data: rate50Q, color: '#c7dc68'
  485. }, {
  486. name: '75%', type: 'line', data: rate75Q, color: '#c7dc68'
  487. }, {
  488. name: '100%', type: 'line', data: rate100Q, color: '#5cb85c'
  489. }, {
  490. name: '平均得分率', type: 'line', data: avgQ, color: '#337ab7'
  491. }, {
  492. name: '我的得分率', type: 'line', data: scoreQ, color: '#d9534f'
  493. }
  494. ]
  495. };
  496. var oOp1 = {
  497. textStyle: {
  498. fontFamily: 'Noto Serif SC'
  499. }, title: {
  500. text: '行政排名位次',
  501. textStyle: {
  502. fontSize: 14,
  503. fontStyle: 'normal',
  504. fontWeight: 'bold'
  505. },
  506. },
  507. tooltip: {
  508. trigger: 'axis'
  509. },
  510. legend: {
  511. data: ['班级排名', '年级排名']
  512. },
  513. toolbox: {
  514. show: true,
  515. feature: {
  516. saveAsImage: {
  517. show: true
  518. },
  519. dataView: {
  520. show: true,
  521. readOnly: false
  522. }
  523. },
  524. padding: 25,
  525. orient: 'vertical'
  526. },
  527. calculable: true,
  528. xAxis: [{
  529. type: 'category', data: seNameDicP2,
  530. name: '科目',
  531. position: 'left'
  532. }],
  533. yAxis: [{
  534. type: 'value',
  535. name: '排名',
  536. position: 'left'
  537. }],
  538. series: [{
  539. name: '班级排名', type: 'bar', data: classOrderPP, color: '#5bc0de'
  540. }, {
  541. name: '年级排名', type: 'bar', data: gradeOrderPP, color: '#337ab7'
  542. }
  543. ]
  544. };
  545. var oOp2 = {
  546. textStyle: {
  547. fontFamily: 'Noto Serif SC'
  548. }, title: {
  549. text: '行政排名比例',
  550. textStyle: {
  551. fontSize: 14,
  552. fontStyle: 'normal',
  553. fontWeight: 'bold'
  554. },
  555. },
  556. tooltip: {
  557. trigger: 'axis'
  558. },
  559. legend: {
  560. data: ['班级排名(%)', '年级排名(%)']
  561. },
  562. toolbox: {
  563. show: true,
  564. feature: {
  565. saveAsImage: {
  566. show: true
  567. },
  568. dataView: {
  569. show: true,
  570. readOnly: false
  571. }
  572. },
  573. padding: 25,
  574. orient: 'vertical'
  575. },
  576. calculable: true,
  577. xAxis: [{
  578. type: 'category', data: seNameDicP2,
  579. name: '科目',
  580. position: 'left'
  581. }],
  582. yAxis: [{
  583. type: 'value',
  584. name: '排名(%)',
  585. position: 'left'
  586. }],
  587. series: [{
  588. name: '班级排名(%)', type: 'bar', data: classOrderQ, color: '#5bc0de'
  589. }, {
  590. name: '年级排名(%)', type: 'bar', data: gradeOrderQ, color: '#337ab7'
  591. }
  592. ]
  593. };
  594. var oOp3 = {
  595. textStyle: {
  596. fontFamily: 'Noto Serif SC'
  597. }, title: {
  598. text: '分班排名位次',
  599. textStyle: {
  600. fontSize: 14,
  601. fontStyle: 'normal',
  602. fontWeight: 'bold'
  603. },
  604. },
  605. tooltip: {
  606. trigger: 'axis'
  607. },
  608. legend: {
  609. data: ['分班排名']
  610. },
  611. toolbox: {
  612. show: true,
  613. feature: {
  614. saveAsImage: {
  615. show: true
  616. },
  617. dataView: {
  618. show: true,
  619. readOnly: false
  620. }
  621. },
  622. padding: 25,
  623. orient: 'vertical'
  624. },
  625. calculable: true,
  626. xAxis: [{
  627. type: 'category', data: seNameDicP3,
  628. name: '科目',
  629. position: 'left'
  630. }],
  631. yAxis: [{
  632. type: 'value',
  633. name: '排名',
  634. position: 'left'
  635. }],
  636. series: [{
  637. name: '分班排名', type: 'bar', data: ysClassOrderPP, color: '#5cb85c'
  638. }
  639. ]
  640. };
  641. var oOp4 = {
  642. textStyle: {
  643. fontFamily: 'Noto Serif SC'
  644. }, title: {
  645. text: '分班排名比例',
  646. textStyle: {
  647. fontSize: 14,
  648. fontStyle: 'normal',
  649. fontWeight: 'bold'
  650. },
  651. },
  652. tooltip: {
  653. trigger: 'axis'
  654. },
  655. legend: {
  656. data: ['分班排名(%)']
  657. },
  658. toolbox: {
  659. show: true,
  660. feature: {
  661. saveAsImage: {
  662. show: true
  663. },
  664. dataView: {
  665. show: true,
  666. readOnly: false
  667. }
  668. },
  669. padding: 25,
  670. orient: 'vertical'
  671. },
  672. calculable: true,
  673. xAxis: [{
  674. type: 'category', data: seNameDicP3,
  675. name: '科目',
  676. position: 'left'
  677. }],
  678. yAxis: [{
  679. type: 'value',
  680. name: '排名(%)',
  681. position: 'left'
  682. }],
  683. series: [{
  684. name: '分班排名(%)', type: 'bar', data: ysClassOrderQ, color: '#5cb85c'
  685. }
  686. ]
  687. };
  688. // 为echarts对象加载数据
  689. sChart1.setOption(sOp1);
  690. sChart2.setOption(sOp2);
  691. oChart1.setOption(oOp1);
  692. oChart2.setOption(oOp2);
  693. oChart3.setOption(oOp3);
  694. oChart4.setOption(oOp4);
  695. }
  696. reader.readAsText(file);
  697. }
  698. $().ready(function () {
  699. $(".chart").hide()
  700. $(function () { $("[data-toggle='tooltip']").tooltip(); });
  701. })