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.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_all",
  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. var djfx = parameter.djfx;
  18. var class_all_arr = [];
  19. var class_single_arr = [];
  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. arr: s_item
  28. });
  29. }
  30. }
  31. sectionsHtmlArr.forEach(function(htmlName) {
  32. if (htmlName === "section_2_class_all") {
  33. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  34. subjectname: "全科",
  35. arr: class_all_arr
  36. }));
  37. } else if (htmlName === "section_2_class_single") {
  38. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(class_single_arr));
  39. } else if (htmlName === "section_2_level") {
  40. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  41. cjfx: parameter.cjfx,
  42. djfx: parameter.djfx
  43. }));
  44. } else if (htmlName === "section_2_part") {
  45. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  46. cjfx: parameter.cjfx,
  47. djfx: parameter.djfx
  48. }));
  49. } else if (htmlName === "section_2_lin_all") {
  50. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  51. cjfx: parameter.cjfx,
  52. djfx: parameter.djfx
  53. }));
  54. } else if (htmlName === "section_2_lin_single") {
  55. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  56. cjfx: parameter.cjfx,
  57. djfx: parameter.djfx
  58. }));
  59. } else if (htmlName === "section_2_excellent_all") {
  60. $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
  61. cjfx: parameter.cjfx,
  62. djfx: parameter.djfx
  63. }));
  64. }
  65. $(".section_2.score_analysis_root ." + htmlName + "_html_root").load("./sections/scoreAnalysis/" + htmlName + ".html");
  66. });
  67. });