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

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