Просмотр исходного кода

Merge commit '7c041f9b7ecb11ae97f178eccd97677cd639c802' into gzb

gzb
guozhongbo 1 год назад
Родитель
Сommit
3b9fa5542f
6 измененных файлов: 239 добавлений и 12 удалений
  1. 12
    0
      css/section_5.css
  2. 4
    1
      js/index.js
  3. 3
    6
      js/section_2.js
  4. 177
    0
      js/section_5.js
  5. 1
    5
      notes.txt
  6. 42
    0
      sections/section_5.html

+ 12
- 0
css/section_5.css Просмотреть файл

@@ -0,0 +1,12 @@
1
+.section_5 .echarts_result_content {
2
+  margin-top: 3mm;
3
+  padding: 3mm;
4
+  background-color: #fff;
5
+}
6
+.section_5 .echarts_result_content .dot {
7
+  display: inline-block;
8
+  margin-right: 2mm;
9
+  width: 2mm;
10
+  height: 2mm;
11
+  border-radius: 50%;
12
+}

+ 4
- 1
js/index.js Просмотреть файл

@@ -5,9 +5,10 @@ $(function () {
5 5
       // "cover", //封面
6 6
       // "preface", //前言
7 7
       // "section_1",
8
-      "section_2",
8
+      // "section_2",
9 9
       // "section_3",
10 10
       // "section_4",
11
+      "section_5",
11 12
     ];
12 13
     $(".pdf_root").html(loadHtmlArr.map(function (htmlName) {
13 14
       return "<div class='" + htmlName + "_html_root'></div>";
@@ -29,6 +30,8 @@ $(function () {
29 30
         $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjfx));
30 31
       } else if (htmlName === "section_4") {
31 32
         $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.yxsj));
33
+      } else if (htmlName === "section_5") {
34
+        $("." + htmlName + "_html_root").data("page-params", JSON.stringify(sectionsData.wjsj));
32 35
       }
33 36
       $("." + htmlName + "_html_root").load("../sections/" + htmlName + ".html");
34 37
     });

+ 3
- 6
js/section_2.js Просмотреть файл

@@ -4,8 +4,8 @@ $(function () {
4 4
   var sectionsHtmlArr = [
5 5
     // "section_2_class_all", //全科成绩对比
6 6
     // "section_2_class_single", //单科成绩对比
7
-    "section_2_level", //分数等级
8
-    // "section_2_part",
7
+    // "section_2_level", //分数等级
8
+    "section_2_part",
9 9
     // "section_2_lin",
10 10
     // "section_2_excellent"
11 11
   ];
@@ -59,10 +59,7 @@ $(function () {
59 59
     } else if (htmlName === "section_2_level") {
60 60
       $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[1]));
61 61
     } else if (htmlName === "section_2_part") {
62
-      $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
63
-        cjfx: parameter.cjfx,
64
-        djfx: parameter.djfx
65
-      }));
62
+      $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify(djfx_data[2]));
66 63
     } else if (htmlName === "section_2_lin") {
67 64
       $(".section_2.score_analysis_root ." + htmlName + "_html_root").data("page-params", JSON.stringify({
68 65
         3: djfx_data[3],

+ 177
- 0
js/section_5.js Просмотреть файл

@@ -0,0 +1,177 @@
1
+$(function () {
2
+  function initSubjectGoodEcharts(xAxis_data, series_data) {
3
+    var option = {
4
+      animation: false,
5
+      title: {
6
+        text: "人",
7
+        x: "left",
8
+        y: "top",
9
+        textStyle: {
10
+          color: "#5F6E82",
11
+          fontSize: $.UnitUtil.mm2px(3),
12
+          fontWeight: 500,
13
+        },
14
+      },
15
+      color: ["#5C99FF"],
16
+      legend: {
17
+        itemWidth: $.UnitUtil.mm2px(2),
18
+        itemHeight: $.UnitUtil.mm2px(2),
19
+        top: "bottom",
20
+        data: ["违纪人数"],
21
+      },
22
+      grid: {
23
+        top: $.UnitUtil.mm2px(10),
24
+        left: 0,
25
+        right: 0,
26
+        bottom: $.UnitUtil.mm2px(8),
27
+        containLabel: true,
28
+      },
29
+      xAxis: [
30
+        {
31
+          type: "category",
32
+          data: xAxis_data,
33
+          axisLabel: {
34
+            color: "#5F6E82", //更改坐标轴文字颜色
35
+            interval: 0
36
+          },
37
+          axisTick: {
38
+            alignWithLabel: true,
39
+          },
40
+          boundaryGap: true,
41
+          triggerEvent: true,
42
+          axisLine: {
43
+            show: true, //是否显示轴线
44
+            lineStyle: {
45
+              color: "#DADADA", //刻度线的颜色
46
+            },
47
+          },
48
+        },
49
+      ],
50
+      yAxis: [
51
+        {
52
+          type: "value",
53
+          axisTick: {
54
+            show: false, //刻度
55
+          },
56
+          axisLine: {
57
+            show: false, //是否显示轴线
58
+            lineStyle: {
59
+              color: "#DADADA", //刻度线的颜色
60
+            },
61
+          },
62
+          splitLine: {
63
+            //网格线
64
+            lineStyle: {
65
+              type: "dotted", //设置网格线类型 dotted:虚线   solid:实线
66
+            },
67
+            show: true, //隐藏或显示
68
+          },
69
+          axisLabel: {
70
+            color: "#5F6E82", //更改坐标轴文字颜色
71
+          },
72
+        },
73
+      ],
74
+      series: [
75
+        {
76
+          name: "违纪人数",
77
+          type: "bar",
78
+          barWidth: $.UnitUtil.mm2px(5),
79
+          // 柱状图最小高度
80
+          barMinHeight: $.UnitUtil.mm2px(2),
81
+          barGap: 0,
82
+          label: {
83
+            normal: {
84
+              show: true,
85
+              align: "center",
86
+              verticalAlign: "bottom",
87
+              position: "top",
88
+              distance: 0,
89
+              formatter: "{c}",
90
+            },
91
+          },
92
+          data: series_data,
93
+        },
94
+      ],
95
+    };
96
+    var myEcharts = echarts.init(document.querySelector(".section_5 #subjectGoodEcharts"));
97
+    myEcharts.clear();
98
+    myEcharts.setOption(option);
99
+  }
100
+  var parameter = $(".section_5_html_root").data("page-params");
101
+  parameter = JSON.parse(parameter);
102
+  var subjectid_subjectname = {};
103
+  var subjectid_num = {};
104
+  var classes = [];
105
+  parameter = $.map(parameter, function(paraItem) {
106
+    paraItem.subjectjson = paraItem.subjectjson ? JSON.parse(paraItem.subjectjson) : [];
107
+    var subjects = {};
108
+    var class_num = 0;
109
+    $.each(paraItem.subjectjson, function(index, subjectItem) {
110
+      subjectid_subjectname[subjectItem.subjectid] = subjectItem.subjectname;
111
+      if (subjectid_num[subjectItem.subjectid]) {
112
+        subjectid_num[subjectItem.subjectid] += subjectItem.num;
113
+      } else {
114
+        subjectid_num[subjectItem.subjectid] = subjectItem.num;
115
+      }
116
+      subjects[subjectItem.subjectid] = {
117
+        num: subjectItem.num,
118
+        nrate: subjectItem.nrate,
119
+      };
120
+      class_num += subjectItem.num;
121
+    });
122
+    classes.push({
123
+      classid: paraItem.classid,
124
+      classname: paraItem.classname,
125
+      class_num: class_num,
126
+      subjects: subjects
127
+    });
128
+    return paraItem;
129
+  });
130
+  var xAxis_data = [];
131
+  var series_data = [];
132
+  var maxSubjectInfo = {
133
+    num: 0,
134
+    subjectname: ""
135
+  };
136
+  var goodTableHeadTr1Html = '<th rowspan="2">班级</th>';
137
+  var goodTableHeadTr2Html = '';
138
+  for (var subjectid in subjectid_subjectname) {
139
+    xAxis_data.push(subjectid_subjectname[subjectid]);
140
+    series_data.push(subjectid_num[subjectid]);
141
+    if(maxSubjectInfo.num < subjectid_num[subjectid]) {
142
+      maxSubjectInfo = {
143
+        num: subjectid_num[subjectid],
144
+        subjectname: subjectid_subjectname[subjectid]
145
+      };
146
+    }
147
+    // class="w29mm"
148
+    goodTableHeadTr1Html += '<th colspan="2">' + subjectid_subjectname[subjectid] + '</th>';
149
+    goodTableHeadTr2Html += '<th>人数</th><th>比例</th>';
150
+  }
151
+  $(".section_5 .subjectGoodMaxNum").text(maxSubjectInfo.subjectname);
152
+  initSubjectGoodEcharts(xAxis_data, series_data);
153
+  var maxClassInfo = {
154
+    num: 0,
155
+    classname: ""
156
+  };
157
+  var goodTableTbodyHtml = "";
158
+  for (var i = 0; i < classes.length; i++) {
159
+    var classItem = classes[i];
160
+    var trHtml = '<td><div class="my_cell">' + classItem.classname + '</div></td>'
161
+    if (maxClassInfo.num < classItem.class_num) {
162
+      maxClassInfo = {
163
+        num: classItem.class_num,
164
+        classname: classItem.classname
165
+      };
166
+    }
167
+    for (var subjectid in subjectid_subjectname) {
168
+      series_data.push(subjectid_num[subjectid]);
169
+      trHtml += '<td><div class="my_cell">' + (classItem.subjects[subjectid].num || 0) + '</div></td><td><div class="my_cell">' + (classItem.subjects[subjectid].nrate || 0) + '%</div></td>'
170
+    }
171
+    goodTableTbodyHtml += '<tr>' + trHtml + '</tr>';
172
+  }
173
+  $(".section_5 .classGoodMaxNum").text(maxClassInfo.classname);
174
+  $(".section_5 .goodTableHeadTr1").html(goodTableHeadTr1Html);
175
+  $(".section_5 .goodTableHeadTr2").html(goodTableHeadTr2Html);
176
+  $(".section_5 .goodTableTbody").html(goodTableTbodyHtml);
177
+});

+ 1
- 5
notes.txt Просмотреть файл

@@ -19,8 +19,4 @@ section_4.html 第四部分
19 19
   不支持vw和vh
20 20
   Echarts也要取消动画效果 animation: false
21 21
   不支持css3
22
-  不支持ES6
23
-
24
-未完成:
25
-分数等级对比-全科(分数等级对比-单科)section_2_level
26
-分数分段对比-全科(分数分段对比-单科)section_2_part
22
+  不支持ES6

+ 42
- 0
sections/section_5.html Просмотреть файл

@@ -0,0 +1,42 @@
1
+<!DOCTYPE html>
2
+<html lang="zh-cn">
3
+<head>
4
+  <meta charset="UTF-8">
5
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+  <title>校本PDF报告-第五章 违纪试卷分析</title>
8
+  <link rel="stylesheet" href="../css/section_5.css">
9
+</head>
10
+<body>
11
+  <div class="page_root section_5">
12
+    <h1 class="section_title_1">第五章 违纪试卷分析</h1>
13
+    <div class="abstract_box">
14
+      <div class="abstract_left">
15
+        <img src="/img/img4.png" />
16
+      </div>
17
+      <div class="abstract_right">
18
+        <div class="abstract_content">从学校和数据的角度分析整体科目、整体班级及各科各班之间的违纪试卷情况,系统按照科目和班级进行分析统计,包括<strong>人数、比例。</strong></div>
19
+      </div>
20
+    </div>
21
+    <h2 class="section_title_2">1. 科目违纪试卷统计</h2>
22
+    <div id="subjectGoodEcharts" style="margin: 0 4mm 4mm;height: 71mm;"></div>
23
+    <div class="echarts_result">
24
+      <div>上图统计结果表示:</div>
25
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪试卷最多的科目:<span class="subjectGoodMaxNum"></span></div>
26
+    </div>
27
+    <h2 class="section_title_2">2. 班级违纪试卷统计</h2>
28
+    <table border="1" class="my_table">
29
+      <thead>
30
+        <tr class="goodTableHeadTr1"></tr>
31
+        <tr class="goodTableHeadTr2"></tr>
32
+      </thead>
33
+      <tbody class="goodTableTbody"></tbody>
34
+    </table>
35
+    <div class="echarts_result">
36
+      <div>上图统计结果表示:</div>
37
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪试卷最多的班级:<span class="classGoodMaxNum"></span></div>
38
+    </div>
39
+  </div>
40
+  <script src="../js/section_5.js"></script>
41
+</body>
42
+</html>

Загрузка…
Отмена
Сохранить