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_2.js 3.0KB

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