|
@@ -1,30 +1,49 @@
|
1
|
1
|
$(function () {
|
2
|
|
- var loadHtmlArr = [
|
3
|
|
- "cover",
|
4
|
|
- "preface",
|
5
|
|
- "section_1",
|
6
|
|
- "section_2",
|
7
|
|
- "section_3",
|
8
|
|
- "section_4",
|
9
|
|
- ];
|
10
|
|
- $(".pdf_root").html(loadHtmlArr.map(function (htmlName) {
|
11
|
|
- return "<div class='" + htmlName + "_html_root'></div>";
|
12
|
|
- }).join(""));
|
13
|
|
- loadHtmlArr.forEach(function (htmlName) {
|
14
|
|
- if (htmlName === "preface") {
|
15
|
|
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify({
|
16
|
|
- htmlName: htmlName,
|
17
|
|
- subjectname: "语文",
|
18
|
|
- num: 12
|
19
|
|
- }));
|
20
|
|
- } else if (htmlName === "section_1") {
|
21
|
|
- $("." + htmlName + "_html_root").data("page-params", JSON.stringify({
|
22
|
|
- htmlName: htmlName,
|
23
|
|
- subjectname: "数学",
|
24
|
|
- num: 33
|
25
|
|
- }));
|
|
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: _pdfBaseurl + "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
|
+ }
|
26
|
47
|
}
|
27
|
|
- console.log(htmlName);
|
28
|
|
- $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
|
29
|
48
|
});
|
30
|
49
|
});
|