1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- $(function () {
- function loadSectionHtml(sectionsData) {
-
- var loadHtmlArr = [
- // "cover", //封面
- // "preface", //前言
- // "section_1",
- "section_2",
- // "section_3",
- // "section_4",
- ];
- $(".pdf_root").html(loadHtmlArr.map(function (htmlName) {
- return "<div class='" + htmlName + "_html_root'></div>";
- }).join(""));
- loadHtmlArr.forEach(function (htmlName) {
- // 考试概况ksgk, 成绩分析cjfx, 成绩分析-等级分析djfx, 违纪分析wjfx, 优秀试卷yxsj
- if (htmlName === "preface") {
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData));
- } else if (htmlName === "section_1") {
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk));
- } else if (htmlName === "section_2") {
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify({
- cjfx: sectionsData.cjfx,
- djfx: sectionsData.djfx
- }));
- } else if (htmlName === "section_3") {
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjfx));
- } else if (htmlName === "section_4") {
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.yxsj));
- }
- $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
- });
- }
- $.ajax({
- type: "POST",
- url: _sexam_ers_pdf,
- data: JSON.stringify({
- examid: 2
- }),
- dataType: "json",
- contentType: "application/json; charset=utf-8",
- success: function (data) {
- if (data.code === 0) {
- loadSectionHtml(data.obj);
- } else {
- alert(data.msg);
- }
- }
- });
- });
|