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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 === "preface") {
  17. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
  18. } else if (htmlName === "section_1") {
  19. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk));
  20. } else if (htmlName === "section_2") {
  21. $("." + htmlName + "_html_root").data("page-params", JSON.stringify({
  22. cjfx: sectionsData.cjfx,
  23. djfx: sectionsData.djfx
  24. }));
  25. } else if (htmlName === "section_3") {
  26. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjfx));
  27. } else if (htmlName === "section_4") {
  28. $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.yxsj));
  29. }
  30. $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
  31. });
  32. }
  33. $.ajax({
  34. type: "POST",
  35. url: _sexam_ers_pdf,
  36. data: JSON.stringify({
  37. examid: 2
  38. }),
  39. dataType: "json",
  40. contentType: "application/json; charset=utf-8",
  41. success: function (data) {
  42. if (data.code === 0) {
  43. loadSectionHtml(data.obj);
  44. } else {
  45. alert(data.msg);
  46. }
  47. }
  48. });
  49. });