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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. $(function () {
  2. function loadSectionHtml(sectionsData) {
  3. var loadHtmlArr = [
  4. "cover", //封面
  5. "preface", //前言
  6. "section_1",
  7. "section_2",
  8. "section_3",
  9. "section_4",
  10. "section_5",
  11. ];
  12. $(".pdf_root").html(loadHtmlArr.map(function (htmlName) {
  13. return "<div class='" + htmlName + "_html_root'></div>";
  14. }).join(""));
  15. loadHtmlArr.forEach(function (htmlName) {
  16. // 考试概况ksgk, 成绩分析cjfx, 成绩分析-等级分析djfx, 违纪分析wjfx, 优秀试卷yxsj
  17. if (htmlName === "cover") {
  18. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk));
  19. } else if (htmlName === "preface") {
  20. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  21. } else if (htmlName === "section_1") {
  22. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk));
  23. } else if (htmlName === "section_2") {
  24. $("." + htmlName + "_html_root").data("page-params", JSON.stringify({
  25. cjfx: sectionsData.cjfx,
  26. djfx: sectionsData.djfx
  27. }));
  28. } else if (htmlName === "section_3") {
  29. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjfx));
  30. } else if (htmlName === "section_4") {
  31. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.yxsj));
  32. } else if (htmlName === "section_5") {
  33. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjsj));
  34. }
  35. $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
  36. });
  37. }
  38. // 请求接口前缀
  39. var _pdfBaseurl = "https://schoolapitest.xhkjedu.com/";
  40. // 47.1.1pdf报告
  41. var _sexam_ers_pdf = _pdfBaseurl + "sexam/ers/pdf";
  42. window.status = "no_completed";
  43. $.ajax({
  44. type: "POST",
  45. url: _sexam_ers_pdf,
  46. data: JSON.stringify({
  47. examid: 2
  48. }),
  49. dataType: "json",
  50. contentType: "application/json; charset=utf-8",
  51. success: function (data) {
  52. if (data.code === 0) {
  53. loadSectionHtml(data.obj);
  54. window.status = "completed";
  55. } else {
  56. alert(data.msg);
  57. }
  58. }
  59. });
  60. });