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

index.js 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. var pageheight = 1047; // 单页高度
  2. var currentclass = null; // 当前班级
  3. $(function () {
  4. function getGradeName(gradeid) {
  5. var gradename = "";
  6. if (gradeid == 1) {
  7. gradename = "一年级";
  8. } else if (gradeid == 2) {
  9. gradename = "二年级";
  10. } else if (gradeid == 3) {
  11. gradename = "三年级";
  12. } else if (gradeid == 4) {
  13. gradename = "四年级";
  14. } else if (gradeid == 5) {
  15. gradename = "五年级";
  16. } else if (gradeid == 6) {
  17. gradename = "六年级";
  18. } else if (gradeid == 7) {
  19. gradename = "七年级";
  20. } else if (gradeid == 8) {
  21. gradename = "八年级";
  22. } else if (gradeid == 9) {
  23. gradename = "九年级";
  24. } else if (gradeid == 10) {
  25. gradename = "高一";
  26. } else if (gradeid == 11) {
  27. gradename = "高二";
  28. } else if (gradeid == 12) {
  29. gradename = "高三";
  30. }
  31. return gradename;
  32. };
  33. function loadSectionHtml (sectionsData) {
  34. currentclass = getGradeName(sectionsData.ksgk.gradeid) +sectionsData.xkcj[0].classname;
  35. var loadHtmlArr = [
  36. // "cover", //封面
  37. // "preface", //前言
  38. "section_1",
  39. "section_2",
  40. "section_3",
  41. "section_4",
  42. "section_5",
  43. "section_6"
  44. ];
  45. $(".pdf_root").html(loadHtmlArr.map(function (htmlName) {
  46. return "<div class='" + htmlName + "_html_root'></div>";
  47. }).join(""));
  48. loadHtmlArr.forEach(function (htmlName) {
  49. // 考试概况ksgk, 成绩分析cjfx, 成绩分析-等级分析djfx, 违纪分析wjfx, 优秀试卷yxsj
  50. if (htmlName === "cover") {
  51. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk));
  52. } else if (htmlName === "preface") {
  53. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  54. } else if (htmlName === "section_1") {
  55. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  56. } else if (htmlName === "section_2") {
  57. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.subjects));
  58. } else if (htmlName === "section_3") {
  59. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.subjects));
  60. } else if (htmlName === "section_4") {
  61. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  62. } else if (htmlName === "section_5") {
  63. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  64. }else if (htmlName === "section_6") {
  65. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  66. }
  67. $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
  68. });
  69. }
  70. // 请求接口前缀
  71. var _pdfBaseurl = "https://schoolapitest.xhkjedu.com/";
  72. // 47.1.1pdf报告
  73. var _sexam_ers_pdf = _pdfBaseurl + "sexam/erc/pdf";
  74. $.ajax({
  75. type: "POST",
  76. url: _sexam_ers_pdf,
  77. data: JSON.stringify({
  78. examid: 2,
  79. classid:9666
  80. }),
  81. dataType: "json",
  82. contentType: "application/json; charset=utf-8",
  83. success: function (data) {
  84. if (data.code === 0) {
  85. loadSectionHtml(data.obj);
  86. } else {
  87. alert(data.msg);
  88. }
  89. }
  90. });
  91. });