Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

section_2.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. $(function () {
  2. var parameter = $(".section_2_html_root").data("page-params");
  3. parameter = JSON.parse(parameter);
  4. var sectionsHtmlArr = [
  5. "section_2_class_all", //全科成绩对比
  6. "section_2_class_single", //单科成绩对比
  7. "section_2_level", //分数等级
  8. "section_2_part",
  9. "section_2_lin",
  10. "section_2_excellent"
  11. ];
  12. $(".section_2.score_analysis_root").html(sectionsHtmlArr.map(function (htmlName) {
  13. return "<div class='" + htmlName + "_html_root'></div>";
  14. }).join(""));
  15. var cjfx = parameter.cjfx;
  16. // 班级成绩分析
  17. var class_all_arr = [];
  18. var class_single_arr = [];
  19. var cjfx_s_index = 2;
  20. for (var s_key in cjfx) {
  21. var s_item = cjfx[s_key];
  22. if (s_key === "总分") {
  23. class_all_arr = s_item;
  24. } else {
  25. class_single_arr.push({
  26. subjectname: s_key,
  27. s_index: cjfx_s_index,
  28. arr: s_item
  29. });
  30. cjfx_s_index += 1;
  31. }
  32. }
  33. // ranktype 类型1等级2分数段3临界分4临界名次5优困生
  34. var djfx = parameter.djfx;
  35. var djfx_data = {};
  36. for (var djfx_s_index = 0; djfx_s_index < djfx.length; djfx_s_index++) {
  37. var djfx_item = djfx[djfx_s_index];
  38. if (!djfx_data[djfx_item.ranktype]) {
  39. djfx_data[djfx_item.ranktype] = {};
  40. }
  41. if (djfx_item.ranktype === 5) {
  42. $.each(djfx_item.ranks, function(rankIndex, rankItem) {
  43. rankItem.stujson = JSON.parse(rankItem.stujson);
  44. });
  45. }
  46. if (djfx_item.subjectid === "zf") {
  47. djfx_item.subjectname = "全科";
  48. }
  49. djfx_data[djfx_item.ranktype][djfx_item.subjectid] = djfx_item;
  50. }
  51. sectionsHtmlArr.forEach(function (htmlName) {
  52. if (htmlName === "section_2_class_all") {
  53. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  54. subjectname: "全科",
  55. arr: class_all_arr
  56. }));
  57. } else if (htmlName === "section_2_class_single") {
  58. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(class_single_arr));
  59. } else if (htmlName === "section_2_level") {
  60. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[1]));
  61. } else if (htmlName === "section_2_part") {
  62. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[2]));
  63. } else if (htmlName === "section_2_lin") {
  64. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  65. 3: djfx_data[3],
  66. 4: djfx_data[4]
  67. }));
  68. } else if (htmlName === "section_2_excellent") {
  69. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[5]));
  70. }
  71. $(".section_2.score_analysis_root ." + htmlName + "_html_root").load("./sections/scoreAnalysis/" + htmlName + ".html");
  72. });
  73. });