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 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_all"
  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. djfx_data[djfx_item.ranktype][djfx_item.subjectid] = djfx_item;
  42. }
  43. sectionsHtmlArr.forEach(function(htmlName) {
  44. if (htmlName === "section_2_class_all") {
  45. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  46. subjectname: "全科",
  47. arr: class_all_arr
  48. }));
  49. } else if (htmlName === "section_2_class_single") {
  50. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(class_single_arr));
  51. } else if (htmlName === "section_2_level") {
  52. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  53. cjfx: parameter.cjfx,
  54. djfx: parameter.djfx
  55. }));
  56. } else if (htmlName === "section_2_part") {
  57. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  58. cjfx: parameter.cjfx,
  59. djfx: parameter.djfx
  60. }));
  61. } else if (htmlName === "section_2_lin") {
  62. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  63. 3: djfx_data[3],
  64. 4: djfx_data[4]
  65. }));
  66. } else if (htmlName === "section_2_excellent_all") {
  67. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  68. cjfx: parameter.cjfx,
  69. djfx: parameter.djfx
  70. }));
  71. }
  72. $(".section_2.score_analysis_root ." + htmlName + "_html_root").load("./sections/scoreAnalysis/" + htmlName + ".html");
  73. });
  74. });