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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. console.log(sectionsData);
  35. currentclass = getGradeName(sectionsData.ksgk.gradeid) +sectionsData.xkcj[0].classname;
  36. var loadHtmlArr = [
  37. // "cover", //封面
  38. // "preface", //前言
  39. // "section_1",
  40. // "section_2",
  41. // "section_3",
  42. "section_4",
  43. // "section_5",
  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.yxsj));
  64. }
  65. $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
  66. });
  67. }
  68. // 请求接口前缀
  69. var _pdfBaseurl = "https://schoolapitest.xhkjedu.com/";
  70. // 47.1.1pdf报告
  71. var _sexam_ers_pdf = _pdfBaseurl + "sexam/erc/pdf";
  72. $.ajax({
  73. type: "POST",
  74. url: _sexam_ers_pdf,
  75. data: JSON.stringify({
  76. examid: 2,
  77. classid:9666
  78. }),
  79. dataType: "json",
  80. contentType: "application/json; charset=utf-8",
  81. success: function (data) {
  82. if (data.code === 0) {
  83. loadSectionHtml(data.obj);
  84. } else {
  85. alert(data.msg);
  86. }
  87. }
  88. });
  89. });