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

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