智慧校园考试-班级报告
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 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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%", "50%"],
  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. var data = {
  99. 0:""
  100. }, page = 0;
  101. var pointnum = s_index == 0?11:16;//第一次是半页 显示十条 往后二十条每页
  102. $.each(list, function (idx, item) {
  103. if((idx + 1) % pointnum == 0){
  104. page++;
  105. if (page == 1) {
  106. pointnum = 31;
  107. }
  108. data[page] = "";
  109. }
  110. data[page] += "<tr>";
  111. data[page]+= '<td><div class="my_cell">' +
  112. item.qtypename +
  113. '</div></td><td><div class="my_cell">' +
  114. item.qns +
  115. '</div></td><td><div class="my_cell">' +
  116. item.score +
  117. '</div></td><td><div class="my_cell">' +
  118. item.srate +
  119. '%</div></td><td><div class="my_cell">' +
  120. item.gradeavgscore +
  121. '</div></td><td><div class="my_cell">' +
  122. item.gradesrate +
  123. '%</div></td><td><div class="my_cell">' +
  124. item.classavgscore +
  125. '</div></td><td><div class="my_cell">' +
  126. item.classsrate +
  127. "%" +
  128. '</div></td>';
  129. })
  130. console.log(page,data);
  131. $.each(legendlist, function (idx, item) {
  132. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  133. })
  134. table =' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  135. goodTableHeadTr1Html +
  136. '</tr><tr class="goodTableHeadTr2">' +
  137. goodTableHeadTr2Html +
  138. '</tr></thead><tbody class="goodTableTbody">' +
  139. trHtml +
  140. "</tbody></table>"
  141. for (var i = 0; i <= page; i++){
  142. table ='<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  143. goodTableHeadTr1Html +
  144. '</tr><tr class="goodTableHeadTr2">' +
  145. goodTableHeadTr2Html +
  146. '</tr></thead><tbody class="goodTableTbody">' +
  147. data[i] +
  148. "</tbody></table>"
  149. $(".section_3_" + s_index + ".large_"+ i+" .largeAnalysistable").html(table);
  150. if (i != 0) {
  151. //添加分页
  152. $(".large_"+ (i-1)+".section_3_"+s_index).after(
  153. '<div class="page_root section_3_'+s_index+' large_'+i+'"></div>'
  154. );
  155. $(".page_root.section_3_"+s_index+'.large_'+i).html(table);
  156. }
  157. }
  158. // $(".section_3_"+s_index +" .largeAnalysistable").html(table)
  159. }
  160. function initSmallAnalysisEcharts (s_index,list) {
  161. let legendlist = [currentclass, "全年级"],
  162. xAxis_data = [],
  163. schoolscore = [],
  164. classscore = [],
  165. curseries = [];
  166. $.each(list, function (idx, item) {
  167. xAxis_data.push("第" + item.qn + "题");
  168. classscore.push(item.classavgscore);
  169. schoolscore.push(item.gradeavgscore);
  170. })
  171. let color = ["#5699FF", "#5EC5C8"];
  172. curseries = [
  173. {
  174. name: currentclass,
  175. type: "line",
  176. symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
  177. smooth: false, //折线是否弯曲
  178. // symbol: "emptyCircle",
  179. symbolSize: 6,
  180. itemStyle: {
  181. normal: {
  182. color: "#4190FF" // 拐点外圈颜色
  183. }
  184. },
  185. label: {
  186. normal: {
  187. show: true,
  188. align: "center",
  189. verticalAlign: "bottom",
  190. position: "top",
  191. distance: 0,
  192. formatter: `{c}`
  193. }
  194. },
  195. areaStyle: {
  196. normal: {
  197. color: new echarts.graphic.LinearGradient(
  198. 0,
  199. 0,
  200. 0,
  201. 1,
  202. [
  203. {
  204. offset: 0,
  205. color: hexToRgba(color[0], 0.3)
  206. },
  207. {
  208. offset: 1,
  209. color: hexToRgba(color[0], 0)
  210. }
  211. ],
  212. false
  213. ),
  214. shadowColor: hexToRgba(color[0], 0),
  215. shadowBlur: 10
  216. }
  217. },
  218. data: classscore
  219. },
  220. {
  221. name: "全年级",
  222. type: "line",
  223. // smooth: true, //是否平滑曲线显示
  224. symbol: "circle", // 默认是空心圆(中间是白色的),改成实心圆
  225. smooth: false, //折线是否弯曲
  226. // symbol: "emptyCircle",
  227. symbolSize: 6,
  228. // zlevel: 3,
  229. itemStyle: {
  230. normal: {
  231. color: "#5FCE9E" // 拐点外圈颜色
  232. }
  233. },
  234. label: {
  235. normal: {
  236. show: true,
  237. align: "center",
  238. verticalAlign: "bottom",
  239. position: "top",
  240. distance: 0,
  241. formatter: `{c}`
  242. }
  243. },
  244. areaStyle: {
  245. normal: {
  246. color: new echarts.graphic.LinearGradient(
  247. 0,
  248. 0,
  249. 0,
  250. 1,
  251. [
  252. {
  253. offset: 0,
  254. color: hexToRgba(color[1], 0.3)
  255. },
  256. {
  257. offset: 1,
  258. color: hexToRgba(color[1], 0)
  259. }
  260. ],
  261. false
  262. ),
  263. shadowColor: hexToRgba(color[1], 0),
  264. shadowBlur: 10
  265. }
  266. },
  267. data: schoolscore
  268. }
  269. ];
  270. let option = {
  271. animation: false,
  272. color: ["#5699FF", "#5EC5C8"],
  273. title: {
  274. text: "分",
  275. x: "left",
  276. y: "top",
  277. textStyle: {
  278. color: "#5F6E82",
  279. fontSize: 12,
  280. fontWeight: 500
  281. }
  282. },
  283. legend: {
  284. icon: "rectRound",
  285. itemWidth: $.UnitUtil.mm2px(2),
  286. itemHeight: $.UnitUtil.mm2px(2),
  287. data: legendlist,
  288. x: "center",
  289. y: "bottom"
  290. },
  291. grid: {
  292. top: $.UnitUtil.mm2px(10),
  293. left: 0,
  294. right: 0,
  295. bottom: $.UnitUtil.mm2px(8),
  296. containLabel: true
  297. },
  298. xAxis: [
  299. {
  300. type: "category",
  301. data: xAxis_data,
  302. axisLabel: {
  303. color: "#5F6E82" //更改坐标轴文字颜色
  304. },
  305. axisTick: {
  306. alignWithLabel: true
  307. },
  308. boundaryGap: true,
  309. triggerEvent: true,
  310. axisLine: {
  311. show: true, //是否显示轴线
  312. lineStyle: {
  313. color: "#DADADA" //刻度线的颜色
  314. }
  315. }
  316. }
  317. ],
  318. yAxis: [
  319. {
  320. type: "value",
  321. axisTick: {
  322. show: false //刻度
  323. },
  324. axisLine: {
  325. show: false, //是否显示轴线
  326. lineStyle: {
  327. color: "#DADADA" //刻度线的颜色
  328. }
  329. },
  330. splitLine: {
  331. //网格线
  332. lineStyle: {
  333. type: "dotted" //设置网格线类型 dotted:虚线 solid:实线
  334. },
  335. show: true //隐藏或显示
  336. },
  337. axisLabel: {
  338. color: "#5F6E82" //更改坐标轴文字颜色
  339. }
  340. }
  341. ],
  342. series: curseries
  343. };
  344. var myEcharts = echarts.init(
  345. document.querySelector(".section_3_"+s_index +" #SmallAnalysisEcharts")
  346. );
  347. myEcharts.clear();
  348. myEcharts.setOption(option);
  349. showSmallSmallAnalysistable(list,legendlist,s_index);
  350. }
  351. function showSmallSmallAnalysistable (list,legendlist,s_index) {
  352. 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>',
  353. goodTableHeadTr2Html = "", trHtml = "";
  354. var complexityarr = ["一", "二", "三", "四", "五"];
  355. $.each(list, function (idx, item) {
  356. var complexity = item.complexity ? complexityarr[item.complexity - 1] + "星" : " ";
  357. trHtml += "<tr>";
  358. trHtml+= '<td><div class="my_cell">' +
  359. item.qn +
  360. '</div></td><td><div class="my_cell">' +
  361. item.qtypename +
  362. '</div></td><td><div class="my_cell">' +
  363. item.score +
  364. '</div></td><td><div class="my_cell">' +
  365. complexity +
  366. '</div></td><td><div class="my_cell">' +
  367. item.gradeavgscore +
  368. '</div></td><td><div class="my_cell">' +
  369. item.gradesrate +
  370. '%</div></td><td><div class="my_cell">' +
  371. item.classavgscore +
  372. '</div></td><td><div class="my_cell">' +
  373. item.classsrate +
  374. "%" +
  375. '</div></td>';
  376. })
  377. $.each(legendlist, function (idx, item) {
  378. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  379. })
  380. table =' <table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  381. goodTableHeadTr1Html +
  382. '</tr><tr class="goodTableHeadTr2">' +
  383. goodTableHeadTr2Html +
  384. '</tr></thead><tbody class="goodTableTbody">' +
  385. trHtml +
  386. "</tbody></table>"
  387. $(".section_3_" + s_index + " .SmallAnalysistable").html(table);
  388. }
  389. function initpointsAnalysisEcharts (s_index, list) {
  390. if (list.length == 0) return;
  391. console.log(list);
  392. var schoolscore = [],
  393. classscore = [],
  394. legendlist = [currentclass+"得分率", "年级得分率"];
  395. $.each(list, function (idx, item) {
  396. if (item.subjectname != "全科") {
  397. classscore.push(item.classsrate);
  398. schoolscore.push(item.gradesrate);
  399. }
  400. });
  401. // 求出数组最大值
  402. let arr = [...schoolscore, ...classscore];
  403. let arr1 = Math.max.apply(null, arr);
  404. let maxnum = parseInt((arr1 + 10) / 10) * 10;
  405. let arrList = [];
  406. $.each(list, function (idx, item) {
  407. if (item.subjectname != "全科") {
  408. let j = {
  409. name: item.pointname,
  410. max: maxnum
  411. };
  412. arrList.push(j);
  413. }
  414. });
  415. var option = {
  416. animation: false,
  417. color: ["#5C99FF", "#FF5F56"],
  418. legend: {
  419. icon: "rectRound",
  420. itemWidth: $.UnitUtil.mm2px(2),
  421. itemHeight: $.UnitUtil.mm2px(2),
  422. data: legendlist,
  423. x: "center",
  424. y: "bottom"
  425. },
  426. grid: {
  427. top: $.UnitUtil.mm2px(10),
  428. left: 0,
  429. right: 0,
  430. bottom: $.UnitUtil.mm2px(8),
  431. containLabel: true
  432. },
  433. radar: {
  434. radius: "60%",
  435. center: ["50%", "55%"],
  436. indicator: arrList
  437. },
  438. series: {
  439. type: "radar",
  440. tooltip: {
  441. trigger: "item"
  442. },
  443. // areaStyle: {}, //内部阴影
  444. data: [
  445. {
  446. value: classscore,
  447. label: {
  448. show: true,
  449. formatter: function (params) {
  450. return params.value;
  451. }
  452. },
  453. name: currentclass+"得分率"
  454. },
  455. {
  456. value: schoolscore,
  457. label: {
  458. show: true,
  459. formatter: function (params) {
  460. return params.value;
  461. }
  462. },
  463. name: "年级得分率"
  464. }
  465. ]
  466. }
  467. };
  468. var myEcharts = echarts.init(
  469. document.querySelector(".section_3_"+s_index +" #pointsAnalysisEcharts")
  470. );
  471. myEcharts.clear();
  472. myEcharts.setOption(option);
  473. showpointsAnalysistable(list,legendlist,s_index);
  474. }
  475. function showpointsAnalysistable (list, legendlist, s_index) {
  476. var table = "",goodTableHeadTr1Html = '<th rowspan="2" class="points">知识点</th><th rowspan="2">对应题号</th><th rowspan="2">分值</th><th rowspan="2">占比</th><th colspan="2">年级</th><th colspan="2">'+currentclass+'</th>',
  477. goodTableHeadTr2Html = "", trHtml = "";
  478. var data = {
  479. 0:""
  480. }, page = 0;
  481. var pointnum = 16;//第一次是半页 显示十条 往后二十条每页
  482. $.each(list, function (idx, item) {
  483. if((idx + 1) % pointnum == 0){
  484. page++;
  485. if (page == 1) {
  486. pointnum = 31;
  487. }
  488. data[page] = "";
  489. }
  490. data[page] += "<tr>";
  491. data[page]+= '<td><div class="my_cell">' +
  492. item.pointname +
  493. '</div></td><td><div class="my_cell">' +
  494. item.qns +
  495. '</div></td><td><div class="my_cell">' +
  496. item.score +
  497. '</div></td><td><div class="my_cell">' +
  498. item.srate +
  499. '%</div></td><td><div class="my_cell">' +
  500. item.gradeavgscore +
  501. '</div></td><td><div class="my_cell">' +
  502. item.gradesrate +
  503. '%</div></td><td><div class="my_cell">' +
  504. item.classavgscore +
  505. '</div></td><td><div class="my_cell">' +
  506. item.classsrate +
  507. "%" +
  508. '</div></td>';
  509. })
  510. $.each(legendlist, function (idx, item) {
  511. goodTableHeadTr2Html+="<th>平均分</th><th>得分率</th>";
  512. })
  513. for (var i = 0; i <= page; i++){
  514. table ='<table border="1" class="my_table"><thead><tr class="goodTableHeadTr1">' +
  515. goodTableHeadTr1Html +
  516. '</tr><tr class="goodTableHeadTr2">' +
  517. goodTableHeadTr2Html +
  518. '</tr></thead><tbody class="goodTableTbody">' +
  519. data[i] +
  520. "</tbody></table>"
  521. $(".section_3_" + s_index + ".page_"+ i+" .pointsAnalysistable").html(table);
  522. if (i != 0) {
  523. //添加分页
  524. $(".page_"+ (i-1)+".section_3_"+s_index).after(
  525. '<div class="page_root section_3_'+s_index+' page_'+i+'"></div>'
  526. );
  527. $(".page_root.section_3_"+s_index+'.page_'+i).html(table);
  528. }
  529. }
  530. }
  531. var parameter = $(".section_3_html_root").data("page-params");
  532. parameter = JSON.parse(parameter);
  533. var html = "";
  534. $.each(parameter, function (s_index, item) {
  535. html+='<div class="page_root large_0 section_3_'+s_index +'">'+
  536. (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>':"")+
  537. '<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_'+
  538. 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_'+
  539. s_index +'">2.2 小题整体分析</h2><div class="SmallAnalysistable"></div></div>'+(item.points.length>0?'<div class="page_root page_0 section_3_'+
  540. 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>':"")
  541. })
  542. $(".ChapterThree").html(html);
  543. console.log(parameter);
  544. $.each(parameter, function (s_index, item) {
  545. initlargeAnalysisEcharts(s_index, item.types);
  546. initSmallAnalysisEcharts(s_index, item.questions);
  547. initpointsAnalysisEcharts(s_index, item.points);
  548. })
  549. // document.documentElement.scrollTop = 1000;
  550. });