智慧校园考试-班级报告
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

section_3.js 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. $(function () {
  2. function hexToRgba(hex, opacity) {
  3. var rgbaColor = "";
  4. var reg = /^#[\da-f]{6}$/i;
  5. if (reg.test(hex)) {
  6. rgbaColor = 'rgba(' + parseInt("0x" + hex.slice(1, 3)) + ',' + parseInt("0x" + hex.slice(3, 5))
  7. + ',' + parseInt("0x" + hex.slice(5, 7)) + ',' + opacity + ')'
  8. }
  9. return rgbaColor;
  10. }
  11. function initlargeAnalysisEcharts(s_index,list) {
  12. var schoolscore = [],
  13. classscore = [],
  14. legendlist = [currentclass, "全年级"];
  15. $.each(list, function (idx, item) {
  16. if (item.subjectname != "全科") {
  17. classscore.push(item.classavgscore);
  18. schoolscore.push(item.gradeavgscore);
  19. }
  20. });
  21. // 求出数组最大值
  22. let arr = [...schoolscore, ...classscore];
  23. let arr1 = Math.max.apply(null, arr);
  24. let maxnum = parseInt((arr1 + 10) / 10) * 10;
  25. let arrList = [];
  26. $.each(list, function (idx, item) {
  27. if (item.subjectname != "全科") {
  28. let j = {
  29. name: item.qtypename,
  30. max: maxnum
  31. };
  32. arrList.push(j);
  33. }
  34. });
  35. var option = {
  36. animation: false,
  37. color: ["#5C99FF", "#5EC5C8"],
  38. legend: {
  39. icon: "rectRound",
  40. itemWidth: $.UnitUtil.mm2px(2),
  41. itemHeight: $.UnitUtil.mm2px(2),
  42. data: legendlist,
  43. x: "center",
  44. y: "bottom"
  45. },
  46. grid: {
  47. top: $.UnitUtil.mm2px(10),
  48. left: 0,
  49. right: 0,
  50. bottom: $.UnitUtil.mm2px(8),
  51. containLabel: true
  52. },
  53. radar: {
  54. radius: "60%",
  55. center: ["50%", "55%"],
  56. indicator: arrList
  57. },
  58. series: {
  59. type: "radar",
  60. tooltip: {
  61. trigger: "item"
  62. },
  63. // areaStyle: {}, //内部阴影
  64. data: [
  65. {
  66. value: classscore,
  67. label: {
  68. show: true,
  69. formatter: function (params) {
  70. return params.value;
  71. }
  72. },
  73. name: currentclass
  74. },
  75. {
  76. value: schoolscore,
  77. label: {
  78. show: true,
  79. formatter: function (params) {
  80. return params.value;
  81. }
  82. },
  83. name: "全年级"
  84. }
  85. ]
  86. }
  87. };
  88. var myEcharts = echarts.init(
  89. document.querySelector(".section_3_"+s_index +" #largeAnalysisEcharts")
  90. );
  91. myEcharts.clear();
  92. myEcharts.setOption(option);
  93. showlargeAnalysistable(list,legendlist,s_index);
  94. }
  95. function showlargeAnalysistable (list,legendlist,s_index) {
  96. var table = "",goodTableHeadTr1Html = '<th rowspan="2">题型</th><th rowspan="2">对应题号</th><th rowspan="2">分值</th><th rowspan="2">占比</th><th colspan="2">年级</th><th colspan="2">'+currentclass+'</th>',
  97. goodTableHeadTr2Html = "", trHtml = "";
  98. $.each(list, function (idx, item) {
  99. trHtml += "<tr>";
  100. trHtml+= '<td><div class="my_cell">' +
  101. item.qtypename +
  102. '</div></td><td><div class="my_cell">' +
  103. item.qns +
  104. '</div></td><td><div class="my_cell">' +
  105. item.score +
  106. '</div></td><td><div class="my_cell">' +
  107. item.srate +
  108. '%</div></td><td><div class="my_cell">' +
  109. item.gradeavgscore +
  110. '</div></td><td><div class="my_cell">' +
  111. item.gradesrate +
  112. '%</div></td><td><div class="my_cell">' +
  113. item.classavgscore +
  114. '</div></td><td><div class="my_cell">' +
  115. item.classsrate +
  116. "%" +
  117. '</div></td>';
  118. })
  119. $.each(legendlist, function (idx, item) {
  120. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  121. })
  122. table =' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  123. goodTableHeadTr1Html +
  124. '</tr><tr class="goodTableHeadTr2">' +
  125. goodTableHeadTr2Html +
  126. '</tr></thead><tbody class="goodTableTbody">' +
  127. trHtml +
  128. "</tbody></table>"
  129. $(".section_3_"+s_index +" .largeAnalysistable").html(table)
  130. }
  131. function initSmallAnalysisEcharts (s_index,list) {
  132. let legendlist = [currentclass, "全年级"],
  133. xAxis_data = [],
  134. schoolscore = [],
  135. classscore = [],
  136. curseries = [];
  137. $.each(list, function (idx, item) {
  138. xAxis_data.push("第" + item.qn + "题");
  139. classscore.push(item.classavgscore);
  140. schoolscore.push(item.gradeavgscore);
  141. })
  142. let color = ["#5699FF", "#5EC5C8"];
  143. curseries = [
  144. {
  145. name: currentclass,
  146. type: "line",
  147. symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
  148. smooth: false, //折线是否弯曲
  149. // symbol: "emptyCircle",
  150. symbolSize: 6,
  151. itemStyle: {
  152. normal: {
  153. color: "#4190FF" // 拐点外圈颜色
  154. }
  155. },
  156. label: {
  157. normal: {
  158. show: true,
  159. align: "center",
  160. verticalAlign: "bottom",
  161. position: "top",
  162. distance: 0,
  163. formatter: `{c}`
  164. }
  165. },
  166. areaStyle: {
  167. normal: {
  168. color: new echarts.graphic.LinearGradient(
  169. 0,
  170. 0,
  171. 0,
  172. 1,
  173. [
  174. {
  175. offset: 0,
  176. color: hexToRgba(color[0], 0.3)
  177. },
  178. {
  179. offset: 1,
  180. color: hexToRgba(color[0], 0)
  181. }
  182. ],
  183. false
  184. ),
  185. shadowColor: hexToRgba(color[0], 0),
  186. shadowBlur: 10
  187. }
  188. },
  189. data: classscore
  190. },
  191. {
  192. name: "全年级",
  193. type: "line",
  194. // smooth: true, //是否平滑曲线显示
  195. symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
  196. smooth: false, //折线是否弯曲
  197. // symbol: "emptyCircle",
  198. symbolSize: 6,
  199. // zlevel: 3,
  200. itemStyle: {
  201. normal: {
  202. color: "#5FCE9E" // 拐点外圈颜色
  203. }
  204. },
  205. label: {
  206. normal: {
  207. show: true,
  208. align: "center",
  209. verticalAlign: "bottom",
  210. position: "top",
  211. distance: 0,
  212. formatter: `{c}`
  213. }
  214. },
  215. areaStyle: {
  216. normal: {
  217. color: new echarts.graphic.LinearGradient(
  218. 0,
  219. 0,
  220. 0,
  221. 1,
  222. [
  223. {
  224. offset: 0,
  225. color: hexToRgba(color[1], 0.3)
  226. },
  227. {
  228. offset: 1,
  229. color: hexToRgba(color[1], 0)
  230. }
  231. ],
  232. false
  233. ),
  234. shadowColor: hexToRgba(color[1], 0),
  235. shadowBlur: 10
  236. }
  237. },
  238. data: schoolscore
  239. }
  240. ];
  241. let option = {
  242. animation: false,
  243. color: ["#5699FF", "#5EC5C8"],
  244. title: {
  245. text: "分",
  246. x: "left",
  247. y: "top",
  248. textStyle: {
  249. color: "#5F6E82",
  250. fontSize: 12,
  251. fontWeight: 500
  252. }
  253. },
  254. legend: {
  255. icon: "rectRound",
  256. itemWidth: $.UnitUtil.mm2px(2),
  257. itemHeight: $.UnitUtil.mm2px(2),
  258. data: legendlist,
  259. x: "center",
  260. y: "bottom"
  261. },
  262. grid: {
  263. top: $.UnitUtil.mm2px(10),
  264. left: 0,
  265. right: 0,
  266. bottom: $.UnitUtil.mm2px(8),
  267. containLabel: true
  268. },
  269. xAxis: [
  270. {
  271. type: "category",
  272. data: xAxis_data,
  273. axisLabel: {
  274. color: "#5F6E82" //更改坐标轴文字颜色
  275. },
  276. axisTick: {
  277. alignWithLabel: true
  278. },
  279. boundaryGap: true,
  280. triggerEvent: true,
  281. axisLine: {
  282. show: true, //是否显示轴线
  283. lineStyle: {
  284. color: "#DADADA" //刻度线的颜色
  285. }
  286. }
  287. }
  288. ],
  289. yAxis: [
  290. {
  291. type: "value",
  292. axisTick: {
  293. show: false //刻度
  294. },
  295. axisLine: {
  296. show: false, //是否显示轴线
  297. lineStyle: {
  298. color: "#DADADA" //刻度线的颜色
  299. }
  300. },
  301. splitLine: {
  302. //网格线
  303. lineStyle: {
  304. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  305. },
  306. show: true //隐藏或显示
  307. },
  308. axisLabel: {
  309. color: "#5F6E82" //更改坐标轴文字颜色
  310. }
  311. }
  312. ],
  313. series: curseries
  314. };
  315. var myEcharts = echarts.init(
  316. document.querySelector(".section_3_"+s_index +" #SmallAnalysisEcharts")
  317. );
  318. myEcharts.clear();
  319. myEcharts.setOption(option);
  320. showSmallSmallAnalysistable(list,legendlist,s_index);
  321. }
  322. function showSmallSmallAnalysistable (list,legendlist,s_index) {
  323. var table = "",goodTableHeadTr1Html = '<th rowspan="2">题号</th><th rowspan="2">题型</th><th rowspan="2">分值</th><th rowspan="2">难度</th><th colspan="2">年级</th><th colspan="2">'+currentclass+'</th>',
  324. goodTableHeadTr2Html = "", trHtml = "";
  325. var complexityarr = ["一", "二", "三", "四", "五"];
  326. $.each(list, function (idx, item) {
  327. var complexity = item.complexity ? complexityarr[item.complexity - 1] + "星" : " ";
  328. trHtml += "<tr>";
  329. trHtml+= '<td><div class="my_cell">' +
  330. item.qn +
  331. '</div></td><td><div class="my_cell">' +
  332. item.qtypename +
  333. '</div></td><td><div class="my_cell">' +
  334. item.score +
  335. '</div></td><td><div class="my_cell">' +
  336. complexity +
  337. '</div></td><td><div class="my_cell">' +
  338. item.gradeavgscore +
  339. '</div></td><td><div class="my_cell">' +
  340. item.gradesrate +
  341. '%</div></td><td><div class="my_cell">' +
  342. item.classavgscore +
  343. '</div></td><td><div class="my_cell">' +
  344. item.classsrate +
  345. "%" +
  346. '</div></td>';
  347. })
  348. $.each(legendlist, function (idx, item) {
  349. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  350. })
  351. table =' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  352. goodTableHeadTr1Html +
  353. '</tr><tr class="goodTableHeadTr2">' +
  354. goodTableHeadTr2Html +
  355. '</tr></thead><tbody class="goodTableTbody">' +
  356. trHtml +
  357. "</tbody></table>"
  358. $(".section_3_" + s_index + " .SmallAnalysistable").html(table);
  359. }
  360. function initpointsAnalysisEcharts (s_index, list) {
  361. if (list.length == 0) return;
  362. console.log(list);
  363. var schoolscore = [],
  364. classscore = [],
  365. legendlist = [currentclass+"得分率", "年级得分率"];
  366. $.each(list, function (idx, item) {
  367. if (item.subjectname != "全科") {
  368. classscore.push(item.classsrate);
  369. schoolscore.push(item.gradesrate);
  370. }
  371. });
  372. // 求出数组最大值
  373. let arr = [...schoolscore, ...classscore];
  374. let arr1 = Math.max.apply(null, arr);
  375. let maxnum = parseInt((arr1 + 10) / 10) * 10;
  376. let arrList = [];
  377. $.each(list, function (idx, item) {
  378. if (item.subjectname != "全科") {
  379. let j = {
  380. name: item.pointname,
  381. max: maxnum
  382. };
  383. arrList.push(j);
  384. }
  385. });
  386. var option = {
  387. animation: false,
  388. color: ["#5C99FF", "#FF5F56"],
  389. legend: {
  390. icon: "rectRound",
  391. itemWidth: $.UnitUtil.mm2px(2),
  392. itemHeight: $.UnitUtil.mm2px(2),
  393. data: legendlist,
  394. x: "center",
  395. y: "bottom"
  396. },
  397. grid: {
  398. top: $.UnitUtil.mm2px(10),
  399. left: 0,
  400. right: 0,
  401. bottom: $.UnitUtil.mm2px(8),
  402. containLabel: true
  403. },
  404. radar: {
  405. radius: "60%",
  406. center: ["50%", "55%"],
  407. indicator: arrList
  408. },
  409. series: {
  410. type: "radar",
  411. tooltip: {
  412. trigger: "item"
  413. },
  414. // areaStyle: {}, //内部阴影
  415. data: [
  416. {
  417. value: classscore,
  418. label: {
  419. show: true,
  420. formatter: function (params) {
  421. return params.value;
  422. }
  423. },
  424. name: currentclass+"得分率"
  425. },
  426. {
  427. value: schoolscore,
  428. label: {
  429. show: true,
  430. formatter: function (params) {
  431. return params.value;
  432. }
  433. },
  434. name: "年级得分率"
  435. }
  436. ]
  437. }
  438. };
  439. var myEcharts = echarts.init(
  440. document.querySelector(".section_3_"+s_index +" #pointsAnalysisEcharts")
  441. );
  442. myEcharts.clear();
  443. myEcharts.setOption(option);
  444. showpointsAnalysistable(list,legendlist,s_index);
  445. }
  446. function showpointsAnalysistable (list, legendlist, s_index) {
  447. var table = "",goodTableHeadTr1Html = '<th rowspan="2">知识点</th><th rowspan="2">对应题号</th><th rowspan="2">分值</th><th rowspan="2">占比</th><th colspan="2">年级</th><th colspan="2">'+currentclass+'</th>',
  448. goodTableHeadTr2Html = "", trHtml = "";
  449. $.each(list, function (idx, item) {
  450. trHtml += "<tr>";
  451. trHtml+= '<td><div class="my_cell">' +
  452. item.pointname +
  453. '</div></td><td><div class="my_cell">' +
  454. item.qns +
  455. '</div></td><td><div class="my_cell">' +
  456. item.score +
  457. '</div></td><td><div class="my_cell">' +
  458. item.srate +
  459. '%</div></td><td><div class="my_cell">' +
  460. item.gradeavgscore +
  461. '</div></td><td><div class="my_cell">' +
  462. item.gradesrate +
  463. '%</div></td><td><div class="my_cell">' +
  464. item.classavgscore +
  465. '</div></td><td><div class="my_cell">' +
  466. item.classsrate +
  467. "%" +
  468. '</div></td>';
  469. })
  470. $.each(legendlist, function (idx, item) {
  471. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  472. })
  473. table =' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  474. goodTableHeadTr1Html +
  475. '</tr><tr class="goodTableHeadTr2">' +
  476. goodTableHeadTr2Html +
  477. '</tr></thead><tbody class="goodTableTbody">' +
  478. trHtml +
  479. "</tbody></table>"
  480. $(".section_3_" + s_index + " .pointsAnalysistable").html(table);
  481. console.log($(".section_3_" + s_index + " .pointsAnalysistable").height());
  482. var
  483. }
  484. var parameter = $(".section_3_html_root").data("page-params");
  485. parameter = JSON.parse(parameter);
  486. var html = "";
  487. $.each(parameter, function (s_index, item) {
  488. html+='<div class="page_root section_3_'+s_index +'">'+
  489. (s_index == 0?'<h1 class="section_title_1">第三章 试卷分析</h1><div class="abstract_box"><div class="abstract_left"><img src="/img/img2.png" /></div><div class="abstract_right"><div class="abstract_content">从学科试卷分析,帮我们从宏观的角度了解班级的水平和差异。系统从多个维度的数据进行学科对比分析,<strong>包括大题年级和班级的(平均分、得分率)、小题年级和班级的(平均分、得分率)。</strong></div></div></div>':"")+
  490. '<h1 class="subjectinfo">'+item.subjectname+'试卷分析</h1><h2 class="section_title_2">1. 大题分析</h2><h3 class="section_title_3">1.1 大题分析</h3><div id="largeAnalysisEcharts" style="margin: 0 4mm 4mm; height: 71mm"></div><h2 class="section_title_3">1.2 大题整体分析</h2><div class="largeAnalysistable"></div></div><div class="page_root section_3_'+
  491. s_index + '"><h2 class="section_title_2">2. 小题分析</h2><h3 class="section_title_3">2.1 小题分析</h3><div id="SmallAnalysisEcharts" style="margin: 0 4mm 4mm; height: 71mm"></div><h2 class="section_title_3_'+
  492. s_index +'">2.2 小题整体分析</h2><div class="SmallAnalysistable"></div></div>'+(item.points.length>0?'<div class="page_root section_3_'+
  493. s_index +'"><h2 class="section_title_2">3. 知识点掌握整体概况</h2><h3 class="section_title_3">3.1 知识点得分率分析</h3><div id="pointsAnalysisEcharts" style="margin: 0 4mm 4mm; height: 90mm"></div><h2 class="section_title_3">3.2 知识点整体分析</h2><div class="pointsAnalysistable"></div></div></div>':"")
  494. })
  495. $(".ChapterThree").html(html);
  496. console.log(parameter);
  497. $.each(parameter, function (s_index, item) {
  498. initlargeAnalysisEcharts(s_index, item.types);
  499. initSmallAnalysisEcharts(s_index, item.questions);
  500. initpointsAnalysisEcharts(s_index, item.points);
  501. })
  502. document.documentElement.scrollTop = 4000;
  503. });