var pageheight = 1047; // 单页高度 var currentclass = null; // 当前班级 $(function () { function getGradeName(gradeid) { var gradename = ""; if (gradeid == 1) { gradename = "一年级"; } else if (gradeid == 2) { gradename = "二年级"; } else if (gradeid == 3) { gradename = "三年级"; } else if (gradeid == 4) { gradename = "四年级"; } else if (gradeid == 5) { gradename = "五年级"; } else if (gradeid == 6) { gradename = "六年级"; } else if (gradeid == 7) { gradename = "七年级"; } else if (gradeid == 8) { gradename = "八年级"; } else if (gradeid == 9) { gradename = "九年级"; } else if (gradeid == 10) { gradename = "高一"; } else if (gradeid == 11) { gradename = "高二"; } else if (gradeid == 12) { gradename = "高三"; } return gradename; }; function loadSectionHtml (sectionsData) { console.log(sectionsData); currentclass = getGradeName(sectionsData.ksgk.gradeid) +sectionsData.xkcj[0].classname; var loadHtmlArr = [ // "cover", //封面 // "preface", //前言 // "section_1", // "section_2", // "section_3", "section_4", // "section_5", ]; $(".pdf_root").html(loadHtmlArr.map(function (htmlName) { return "
"; }).join("")); loadHtmlArr.forEach(function (htmlName) { // 考试概况ksgk, 成绩分析cjfx, 成绩分析-等级分析djfx, 违纪分析wjfx, 优秀试卷yxsj if (htmlName === "cover") { $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.ksgk)); } else 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)); } else if (htmlName === "section_2") { $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.subjects)); } else if (htmlName === "section_3") { $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.subjects)); } else if (htmlName === "section_4") { $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData)); } else if (htmlName === "section_5") { $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.yxsj)); } $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html"); }); } // 请求接口前缀 var _pdfBaseurl = "https://schoolapitest.xhkjedu.com/"; // 47.1.1pdf报告 var _sexam_ers_pdf = _pdfBaseurl + "sexam/erc/pdf"; $.ajax({ type: "POST", url: _sexam_ers_pdf, data: JSON.stringify({ examid: 2, classid:9666 }), dataType: "json", contentType: "application/json; charset=utf-8", success: function (data) { if (data.code === 0) { loadSectionHtml(data.obj); } else { alert(data.msg); } } }); });