score.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. function toggleHide() {
  2. $(".hidable").toggle(1000);
  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. }
  43. };
  44. function getFiles(event) {
  45. files[fileCount] = event.target.files[0];
  46. cur = fileCount;
  47. fileCount++;
  48. $("#controls").removeClass("disabled");
  49. $("#lbtn").removeClass("disabled");
  50. $("#rbtn").removeClass("disabled");
  51. processFiles(1);
  52. }
  53. const key = CryptoJS.enc.Utf8.parse("abcdefgabcdefg12");
  54. function aesDecrypt(encrypted) {
  55. var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Hex.parse(encrypted) })
  56. var decrypted = CryptoJS.AES.decrypt(cipherParams, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 });
  57. return decrypted.toString(CryptoJS.enc.Utf8);
  58. }
  59. function aesEncrypt(encrypted) {
  60. return CryptoJS.AES.encrypt(encrypted, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).ciphertext.toString();
  61. }
  62. function stringToByte(str) {
  63. var bytes = new Array();
  64. var len, c;
  65. len = str.length;
  66. for (var i = 0; i < len; i++) {
  67. c = str.charCodeAt(i);
  68. if (c >= 0x010000 && c <= 0x10FFFF) {
  69. bytes.push(((c >> 18) & 0x07) | 0xF0);
  70. bytes.push(((c >> 12) & 0x3F) | 0x80);
  71. bytes.push(((c >> 6) & 0x3F) | 0x80);
  72. bytes.push((c & 0x3F) | 0x80);
  73. } else if (c >= 0x000800 && c <= 0x00FFFF) {
  74. bytes.push(((c >> 12) & 0x0F) | 0xE0);
  75. bytes.push(((c >> 6) & 0x3F) | 0x80);
  76. bytes.push((c & 0x3F) | 0x80);
  77. } else if (c >= 0x000080 && c <= 0x0007FF) {
  78. bytes.push(((c >> 6) & 0x1F) | 0xC0);
  79. bytes.push((c & 0x3F) | 0x80);
  80. } else {
  81. bytes.push(c & 0xFF);
  82. }
  83. }
  84. return bytes;
  85. }
  86. $().ready(function () {
  87. $("#Input").keydown(function (e) {
  88. if (e.keyCode == 13) {
  89. $("#fetchBtn")[0].click();
  90. }
  91. });
  92. })
  93. var stuId = {}, examId = {}
  94. function fetchDo(id) {
  95. var bd = '{"meId":' + $('#Id').val() + ',"seIds":"' + knownExams + '","schoolId":19707,"studentId":"' + id + '"}';
  96. console.log(bd)
  97. bd = aesEncrypt(bd)
  98. console.log(bd)
  99. fetch('http://36.112.23.77/analysis/api/student/exam/getStudentReportMEVO', {
  100. method: 'POST',
  101. headers: {
  102. 'Content-type': 'application/json',
  103. },
  104. body: bd
  105. }).then(res => {
  106. res.text().then(resj => {
  107. files[fileCount] = new Blob([resj], {
  108. type: 'text/plain'
  109. });;
  110. cur = fileCount;
  111. fileCount++;
  112. $("#controls").removeClass("disabled");
  113. $("#lbtn").removeClass("disabled");
  114. $("#rbtn").removeClass("disabled");
  115. processFiles(1);
  116. });
  117. })
  118. }
  119. function fetchMe(id) {
  120. if (!parseInt(id)) {
  121. fetch('/js/e.json', {
  122. method: 'GET',
  123. headers: {
  124. 'Content-type': 'application/json',
  125. }
  126. }).then(res => {
  127. res.json().then(resj => {
  128. var queryData = resj.data.filter(function (e) {
  129. return e.name == id
  130. });
  131. fetchDo(queryData[0].no)
  132. });
  133. })
  134. } else fetchDo(id)
  135. }
  136. function getSe(id) {
  137. console.log(id)
  138. if (!stuId[cur]) stuId[cur] = prompt('数字校园号?')
  139. if (!examId[cur]) examId[cur] = prompt('考试编号?(心意答点击考试标题后,切换考试的列表里可见)')
  140. var bd = '{"schoolId":19707,"seId":' + id + ',"studentId":"' + stuId[cur] + '"}';
  141. console.log(bd)
  142. bd = aesEncrypt(bd)
  143. fetch('http://36.112.23.77/analysis/api/student/exam/getStudentReportSEVO', {
  144. method: 'POST',
  145. headers: {
  146. 'Content-type': 'application/json',
  147. },
  148. body: bd
  149. }).then(res => {
  150. res.json().then(resj => {
  151. // $('#singleDat').html(aesDecrypt(resj.data))
  152. });
  153. })
  154. bd = '{"schoolId":19707,"meId":' + examId[cur] + ',"seId":' + id + ',"studentId":"' + stuId[cur] + '"}';
  155. console.log(bd)
  156. bd = aesEncrypt(bd)
  157. fetch('http://36.112.23.77/analysis/api/student/exam/getStuExamDetailInfo', {
  158. method: 'POST',
  159. headers: {
  160. 'Content-type': 'application/json',
  161. },
  162. body: bd
  163. }).then(res => {
  164. res.json().then(resj => {
  165. $('#singleDat').html(aesDecrypt(resj.data))
  166. });
  167. })
  168. }
  169. function processFiles(isFirstTime = 0) {
  170. console.log("Start processing No. " + cur);
  171. var file = files[cur];
  172. var message = $("#message")[0];
  173. var upBtn = $("#upbtn")[0];
  174. var upIcon = $("#upicon")[0];
  175. var tableLayout = '<table class="table table-responsive" style="table-layout: fixed;">'
  176. message.innerHTML = (cur + 1) + "/" + (fileCount) + " - " + file.name + " - " + file.size + " 字节 - " + file.type + " - 正在读取...<br>>";
  177. upBtn.classList.remove('btn-danger');
  178. upBtn.classList.add('btn-info');
  179. upIcon.classList.remove('glyphicon-exclamation-sign');
  180. upIcon.classList.add('glyphicon-open');
  181. var reader = new FileReader();
  182. reader.onload = function (event) {
  183. try {
  184. var output = $("#fileOutput")[0];
  185. var info = $("#fileInfo")[0];
  186. var name = $("#name")[0];
  187. var object = eval("(" + event.target.result + ")");
  188. var classText = "", gradingText = "";
  189. $('#single').empty();
  190. object.data = eval("(" + aesDecrypt(object.data).toString() + ")");
  191. examId[cur] = object.data.meId.toString();
  192. stuId[cur] = object.data.studentId;
  193. console.log(examId[cur], stuId[cur])
  194. info.innerHTML = "<h3>" + object.data.multiExam.meName + "</h3>"
  195. console.log(object.data.multiExam.meName)
  196. var seIds = [], seNames = [], iter = 1;
  197. var datSingle = object.data.multiExamStudentScore.singleExamStudentScores, datClass = object.data.singleExamClassScores, datYs = object.data.singleExamClassYsScores, datMulti = object.data.multiExam.singleExams;
  198. seIds = object.data.seIds;
  199. for (var i = 0; i < seIds.length; i++) {
  200. for (var j = 0; j < seIds.length; j++) {
  201. if (datMulti[i].seId == seIds[j]) {
  202. seNames[j] = datMulti[i].seCourseName;
  203. }
  204. }
  205. }
  206. // console.log(seIds)
  207. // console.log(seNames)
  208. var seNameDic = {};
  209. for (var i = 0; i < seIds.length; i++) {
  210. seNameDic[seIds[i]] = seNames[i];
  211. }
  212. seNameDic["0"] = "总分";
  213. for (var i = 0; i < datYs.length; i++) {
  214. seNameDic[datYs[i].seId + "Ys"] = seNameDic[datYs[i].seId] + " " + datYs[i].ysClassId;
  215. }
  216. var seIdDic = {}, seIdRev = {}, hasId = {};
  217. for (var i = 0; i < seIds.length; i++) {
  218. for (var j = 0; j < seIds.length; j++) {
  219. if (!datSingle[j]) continue;
  220. if (datSingle[j].seId == seIds[i]) {
  221. hasId[i] = true;
  222. seIdDic[j] = i;
  223. }
  224. }
  225. }
  226. for (var i = 1; i < seIds.length; i++) {
  227. if (!hasId[i]) seIds[i] = -1
  228. }
  229. for (var i = 0; i < seIds.length; i++)seIdRev[seIdDic[i]] = i;
  230. var scoreP = {}, avgP = {}, rate0 = {}, rate25 = {}, rate50 = {}, rate75 = {}, rate100 = {}, rateFull = {};//表1用
  231. var classOrderP = {}, ysClassOrderP = {}, gradeOrderP = {};
  232. var classOrder = {}, ysClassOrder = {}, gradeOrder = {};
  233. for (var i = 0; i < seIds.length; i++) {
  234. if (!datSingle[i]) continue;
  235. var dId = datSingle[i].seId;
  236. scoreP[dId] = datSingle[i].essScore;
  237. avgP[dId] = datClass[i].secsAvgScore;
  238. rate0[dId] = datClass[i].secsMinScore;
  239. rate25[dId] = datClass[i].secsQuarterScore;
  240. rate50[dId] = datClass[i].secsHalfScore;
  241. rate75[dId] = datClass[i].secs3quatrerScore;
  242. rate100[dId] = datClass[i].secsMaxScore;
  243. rateFull[dId] = datMulti[seIdDic[i]].seFullScore;
  244. classOrderP[dId] = datSingle[i].essClassOrder;
  245. gradeOrderP[dId] = datSingle[i].essGradeOrder;
  246. classOrder[dId] = decimal(1 - datSingle[i].essClassOrder / datClass[i].secsStudentCount, 3);
  247. gradeOrder[dId] = decimal(1 - datSingle[i].essGradeOrder / datMulti[seIdDic[i]].seStudentCount, 3);
  248. }
  249. classOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messClassOrder / object.data.multiExamClassScores[0].mecsStudentCount, 3); + "<br>"
  250. gradeOrder["0"] = decimal(1 - object.data.multiExamStudentScore.messGradeOrder / object.data.multiExamSchoolScore.mecsStudentCount, 3); + "<br>"
  251. classOrderP["0"] = object.data.multiExamStudentScore.messClassOrder;
  252. gradeOrderP["0"] = object.data.multiExamStudentScore.messGradeOrder
  253. for (var i = 0; i < datYs.length; i++) {
  254. for (var j = 0; j < seIds.length; j++) {
  255. if (!datSingle[j]) continue;
  256. if (datYs[i].seId == datSingle[j].seId) {
  257. ysClassOrder[datYs[i].seId + "Ys"] = decimal(1 - datSingle[j].essYsClassOrder / datYs[i].secsStudentCount, 3);
  258. ysClassOrderP[datYs[i].seId + "Ys"] = datSingle[j].essYsClassOrder;
  259. }
  260. }
  261. }
  262. for (var i = 0; i < seIds.length; i++) {
  263. // object.data.multiExamStudentScore.singleExamStudentScores[i].seId ---datSingle
  264. // object.data.singleExamClassScores[i].seId ---datClass
  265. // object.data.multiExam.singleExams[i].seId ---datMulti
  266. // seIds[i]
  267. // 前两个和后两个数据应该是能分别对上号的(1-2 3-4),用 seIdDic 连接
  268. // seIdDic {key(1-2): value(3-4),..}
  269. var g = seIdRev[i];
  270. if (!datSingle[g]) continue;
  271. $('#single').append('<button class="btn btn-danger btn-how" onclick="getSe(' + seIds[i] + ');$(\'.btn-how\').removeClass(\'active\');$(this).addClass(\'active\')">' + seNameDic[datSingle[g].seId] + '</button>')
  272. classText += "<h4>"
  273. + seNameDic[datSingle[g].seId] + "</h4>"
  274. + "<b>单科分数:" + datSingle[g].essScore + "</b><br><br>"
  275. + "单科分数班级排名:" + datSingle[g].essClassOrder + "<br>"
  276. + "单科班级参考人数:" + datClass[g].secsStudentCount + "<br>"
  277. + "单科班级年级排名:" + datClass[g].secsClassOrder + "<br>"
  278. + "单科班级:"
  279. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  280. + "<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>";
  281. for (var j = 0; j < datYs.length; j++) {
  282. if (datYs[j].seId == datSingle[g].seId) {
  283. classText += "<br><br>"
  284. + "单科分层班级名称:" + datYs[j].ysClassId + "<br>"
  285. + "单科分数分层班级排名:" + datSingle[g].essYsClassOrder + "<br>"
  286. + "单科分层班级参考人数:" + datYs[j].secsStudentCount + "<br>"
  287. + "单科分层班级年级排名:" + datYs[j].secsClassOrder + "<br>"
  288. + "单科分层班级:"
  289. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  290. + "<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>";
  291. }
  292. }
  293. classText += "<br><br>"
  294. + "单科分数年级排名:" + datSingle[g].essGradeOrder + "<br>"
  295. + "单科年级参考人数:" + datMulti[seIdDic[g]].seStudentCount + "<br>"
  296. + "单科年级:"
  297. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  298. + "<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>";
  299. }
  300. } catch (e) {
  301. console.log(e);
  302. clearScreen();
  303. message.innerHTML += "读取失败!";
  304. upBtn.classList.remove('btn-info');
  305. upBtn.classList.add('btn-danger');
  306. upIcon.classList.remove('glyphicon-open');
  307. upIcon.classList.add('glyphicon-exclamation-sign');
  308. return;
  309. }
  310. $('#single').append('<pre id="singleDat" style="word-wrap: break-word; white-space: normal"></pre><br><br><br>')
  311. if (isFirstTime) {
  312. var bd = JSON.stringify({
  313. content: object.data.multiExamStudentScore.studentName + ' ' + parseInt(object.data.examStudents[0].classId),
  314. })
  315. fetch('/score/log', {
  316. method: 'POST',
  317. headers: {
  318. 'Content-type': 'application/json',
  319. },
  320. body: bd
  321. })
  322. }
  323. message.innerHTML += "读取成功!"
  324. + " - 注:实验中学 74 桌出品,我仅做搬运修改。<br>";
  325. name.innerHTML = "姓名:" + object.data.multiExamStudentScore.studentName;
  326. info.innerHTML = "<h3>" + object.data.multiExam.meName + "</h3>"
  327. + "行政班级:" + object.data.examStudents[0].classId + "<br>"
  328. + "姓名:" + object.data.multiExamStudentScore.studentName + "<br>";
  329. output.innerHTML = "<br><h4>总分</h4>"
  330. + "<b>全科分数:" + object.data.multiExamStudentScore.messScore + "</b><br><br>"
  331. + "全科分数班级排名:" + object.data.multiExamStudentScore.messClassOrder + "<br>"
  332. + "全科班级参考人数:" + object.data.multiExamClassScores[0].mecsStudentCount + "<br>"
  333. + "全科班级年级排名:" + object.data.multiExamClassScores[0].mecsClassOrder + "<br>"
  334. + "全科班级:"
  335. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  336. + "<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>"
  337. + "<br><br>全科分数年级排名:" + object.data.multiExamStudentScore.messGradeOrder + "<br>"
  338. + "全科年级参考人数:" + object.data.multiExamSchoolScore.mecsStudentCount + "<br>"
  339. + "全科年级:"
  340. + tableLayout + '<tr><td>平均分</td><td>最高分</td><td>四分位数(75%)</td><td>中位数</td><td>四分位数(25%)</td><td>最低分</td></tr>'
  341. + "<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>"
  342. + classText;
  343. $("#fileOutput table").css("display", "inline-table");
  344. $("#fileOutput table").css("margin-bottom", "0px");
  345. $('.chart').show();
  346. sChart1 = echarts.init($("#score1")[0]);
  347. sChart2 = echarts.init($("#score2")[0]);
  348. oChart1 = echarts.init($("#order1")[0]);
  349. oChart2 = echarts.init($("#order2")[0]);
  350. oChart3 = echarts.init($("#order3")[0]);
  351. oChart4 = echarts.init($("#order4")[0]);
  352. seNameDicP = []; scorePP = []; avgPP = []; rate0P = []; rate25P = []; rate50P = []; rate75P = []; rate100P = []; rateFullP = [];
  353. scoreQ = []; avgQ = []; rate0Q = []; rate25Q = []; rate50Q = []; rate75Q = []; rate100Q = [];
  354. seNameDicP2 = []; classOrderPP = []; gradeOrderPP = []; classOrderQ = []; gradeOrderQ = [];
  355. seNameDicP3 = []; ysClassOrderPP = []; ysClassOrderQ = [];
  356. seIds[seIds.length] = 0
  357. for (var i = 0; i < seIds.length; i++) {
  358. var g = seIds[i];
  359. if (g == -1) continue;
  360. if (seNameDic[g].substr(0, 2) == '总分') continue;
  361. seNameDicP.push(seNameDic[g].substr(0, 2));
  362. scorePP.push(scoreP[g]);
  363. avgPP.push(avgP[g]);
  364. rate0P.push(rate0[g]);
  365. rate25P.push(rate25[g]);
  366. rate50P.push(rate50[g]);
  367. rate75P.push(rate75[g]);
  368. rate100P.push(rate100[g]);
  369. rateFullP.push(rateFull[g]);
  370. scoreQ.push(decimal(scoreP[g] / rateFull[g] * 100, 1));
  371. avgQ.push(decimal(avgP[g] / rateFull[g] * 100, 1));
  372. rate0Q.push(decimal(rate0[g] / rateFull[g] * 100, 1));
  373. rate25Q.push(decimal(rate25[g] / rateFull[g] * 100, 1));
  374. rate50Q.push(decimal(rate50[g] / rateFull[g] * 100, 1));
  375. rate75Q.push(decimal(rate75[g] / rateFull[g] * 100, 1));
  376. rate100Q.push(decimal(rate100[g] / rateFull[g] * 100, 1));
  377. }
  378. for (var i = 0; i < seIds.length; i++) {
  379. var g = seIds[i];
  380. if (g == -1) continue;
  381. seNameDicP2.push(seNameDic[g].substr(0, 2));
  382. classOrderPP.push(classOrderP[g]);
  383. gradeOrderPP.push(gradeOrderP[g]);
  384. classOrderQ.push(decimal(classOrder[g] * 100, 1));
  385. gradeOrderQ.push(decimal(gradeOrder[g] * 100, 1));
  386. }
  387. for (var i in ysClassOrderP) {
  388. seNameDicP3.push(seNameDic[i]);
  389. ysClassOrderPP.push(ysClassOrderP[i]);
  390. ysClassOrderQ.push(decimal(ysClassOrder[i] * 100, 1));
  391. }
  392. var opBase = {
  393. textStyle: { fontFamily: 'Noto Serif SC' },
  394. tooltip: { trigger: 'axis' },
  395. toolbox: {
  396. show: true,
  397. feature: {
  398. saveAsImage: { show: true },
  399. dataView: {
  400. show: true,
  401. readOnly: false
  402. }
  403. },
  404. padding: 25,
  405. orient: 'vertical'
  406. },
  407. calculable: true,
  408. }
  409. var sOp1 = { ...opBase }, sOp2 = { ...opBase }, oOp1 = { ...opBase }, oOp2 = { ...opBase }, oOp3 = { ...opBase }, oOp4 = { ...opBase };
  410. sOp1.title = {
  411. text: '分数',
  412. textStyle: {
  413. fontSize: 14,
  414. fontStyle: 'normal',
  415. fontWeight: 'bold',
  416. },
  417. }
  418. sOp1.legend = { data: ['0%', '25%', '50%', '75%', '100%', '满分', '平均分', '我的分数'] }
  419. sOp1.xAxis = [{
  420. type: 'category', data: seNameDicP,
  421. name: '科目',
  422. position: 'left'
  423. }]
  424. sOp1.yAxis = [{
  425. type: 'value', name: '分数', position: 'left'
  426. }]
  427. sOp1.series = [
  428. { name: '0%', type: 'line', data: rate0P, color: '#5cb85c' },
  429. { name: '25%', type: 'line', data: rate25P, color: '#c7dc68' },
  430. { name: '50%', type: 'line', data: rate50P, color: '#c7dc68' },
  431. { name: '75%', type: 'line', data: rate75P, color: '#c7dc68' },
  432. { name: '100%', type: 'line', data: rate100P, color: '#5cb85c' },
  433. { name: '满分', type: 'line', data: rateFullP, color: '#f0ad4e' },
  434. { name: '平均分', type: 'line', data: avgPP, color: '#337ab7' },
  435. { name: '我的分数', type: 'line', data: scorePP, color: '#e2041b' }
  436. ]
  437. sOp2.title = {
  438. text: '得分率',
  439. textStyle: {
  440. fontSize: 14,
  441. fontStyle: 'normal',
  442. fontWeight: 'bold',
  443. },
  444. }
  445. sOp2.legend = { data: ['0%', '25%', '50%', '75%', '100%', '平均得分率', '我的得分率'] }
  446. sOp2.xAxis = [{
  447. type: 'category',
  448. data: seNameDicP,
  449. name: '科目',
  450. position: 'left'
  451. }]
  452. sOp2.yAxis = [{
  453. type: 'value',
  454. name: '得分率(%)',
  455. position: 'left'
  456. }]
  457. sOp2.series = [
  458. { name: '0%', type: 'line', data: rate0Q, color: '#5cb85c' },
  459. { name: '25%', type: 'line', data: rate25Q, color: '#c7dc68' },
  460. { name: '50%', type: 'line', data: rate50Q, color: '#c7dc68' },
  461. { name: '75%', type: 'line', data: rate75Q, color: '#c7dc68' },
  462. { name: '100%', type: 'line', data: rate100Q, color: '#5cb85c' },
  463. { name: '平均得分率', type: 'line', data: avgQ, color: '#337ab7' },
  464. { name: '我的得分率', type: 'line', data: scoreQ, color: '#d9534f' }
  465. ]
  466. oOp1.title = {
  467. text: '行政排名位次',
  468. textStyle: {
  469. fontSize: 14,
  470. fontStyle: 'normal',
  471. fontWeight: 'bold',
  472. },
  473. }
  474. oOp1.legend = { data: ['班级排名', '年级排名'] }
  475. oOp1.xAxis = [{
  476. type: 'category', data: seNameDicP2,
  477. name: '科目',
  478. position: 'left'
  479. }]
  480. oOp1.yAxis = [{
  481. type: 'value',
  482. name: '排名',
  483. position: 'left'
  484. }]
  485. oOp1.series = [
  486. { name: '班级排名', type: 'bar', data: classOrderPP, color: '#5bc0de' },
  487. { name: '年级排名', type: 'bar', data: gradeOrderPP, color: '#337ab7' }
  488. ]
  489. oOp2.title = {
  490. text: '行政排名比例',
  491. textStyle: {
  492. fontSize: 14,
  493. fontStyle: 'normal',
  494. fontWeight: 'bold',
  495. },
  496. }
  497. oOp2.legend = { data: ['班级排名(%)', '年级排名(%)'] }
  498. oOp2.xAxis = [{
  499. type: 'category', data: seNameDicP2,
  500. name: '科目',
  501. position: 'left'
  502. }]
  503. oOp2.yAxis = [{
  504. type: 'value',
  505. name: '排名(%)',
  506. position: 'left'
  507. }]
  508. oOp2.series = [
  509. { name: '班级排名(%)', type: 'bar', data: classOrderQ, color: '#5bc0de' },
  510. { name: '年级排名(%)', type: 'bar', data: gradeOrderQ, color: '#337ab7' }
  511. ]
  512. oOp3.title = {
  513. text: '分班排名位次',
  514. textStyle: {
  515. fontSize: 14,
  516. fontStyle: 'normal',
  517. fontWeight: 'bold',
  518. },
  519. }
  520. oOp3.legend = { data: ['分班排名'] }
  521. oOp3.xAxis = [{
  522. type: 'category', data: seNameDicP3,
  523. name: '科目',
  524. position: 'left'
  525. }]
  526. oOp3.yAxis = [{
  527. type: 'value',
  528. name: '排名',
  529. position: 'left'
  530. }]
  531. oOp3.series = [{
  532. name: '分班排名', type: 'bar', data: ysClassOrderPP, color: '#5cb85c'
  533. }]
  534. oOp4.title = {
  535. text: '分班排名比例',
  536. textStyle: {
  537. fontSize: 14,
  538. fontStyle: 'normal',
  539. fontWeight: 'bold',
  540. },
  541. }
  542. oOp4.legend = { data: ['分班排名(%)'] }
  543. oOp4.xAxis = [{
  544. type: 'category', data: seNameDicP3,
  545. name: '科目',
  546. position: 'left'
  547. }]
  548. oOp4.yAxis = [{
  549. type: 'value',
  550. name: '排名(%)',
  551. position: 'left'
  552. }]
  553. oOp4.series = [{
  554. name: '分班排名(%)', type: 'bar', data: ysClassOrderQ, color: '#5cb85c'
  555. }]
  556. // 为echarts对象加载数据
  557. sChart1.setOption(sOp1);
  558. sChart2.setOption(sOp2);
  559. oChart1.setOption(oOp1);
  560. oChart2.setOption(oOp2);
  561. oChart3.setOption(oOp3);
  562. oChart4.setOption(oOp4);
  563. window.onresize = function () {
  564. setTimeout(function () {
  565. sChart1.resize()
  566. sChart2.resize()
  567. oChart1.resize()
  568. oChart2.resize()
  569. oChart3.resize()
  570. oChart4.resize()
  571. }, 300)
  572. }
  573. }
  574. reader.readAsText(file);
  575. }
  576. $().ready(function () {
  577. $(".chart").hide()
  578. $(function () { $("[data-toggle='tooltip']").tooltip(); });
  579. })