Procházet zdrojové kódy

违纪分析,优秀试卷分析

wzl_h
wangzl před 2 roky
rodič
revize
763f0adee8
7 změnil soubory, kde provedl 172 přidání a 192 odebrání
  1. 1
    1
      css/section_3.css
  2. 1
    1
      css/section_4.css
  3. 4
    4
      js/index.js
  4. 77
    16
      js/section_3.js
  5. 79
    18
      js/section_4.js
  6. 5
    76
      sections/section_3.html
  7. 5
    76
      sections/section_4.html

+ 1
- 1
css/section_3.css Zobrazit soubor

@@ -3,7 +3,7 @@
3 3
   padding: 3mm;
4 4
   background-color: #fff;
5 5
 }
6
-.section_3 .echarts_result_content span {
6
+.section_3 .echarts_result_content .dot {
7 7
   display: inline-block;
8 8
   margin-right: 2mm;
9 9
   width: 2mm;

+ 1
- 1
css/section_4.css Zobrazit soubor

@@ -3,7 +3,7 @@
3 3
   padding: 3mm;
4 4
   background-color: #fff;
5 5
 }
6
-.section_4 .echarts_result_content span {
6
+.section_4 .echarts_result_content .dot {
7 7
   display: inline-block;
8 8
   margin-right: 2mm;
9 9
   width: 2mm;

+ 4
- 4
js/index.js Zobrazit soubor

@@ -1,10 +1,10 @@
1 1
 $(function () {
2 2
   function loadSectionHtml(sectionsData) {
3 3
     var loadHtmlArr = [
4
-      "cover",
5
-      "preface",
6
-      "section_1",
7
-      "section_2",
4
+      // "cover",
5
+      // "preface",
6
+      // "section_1",
7
+      // "section_2",
8 8
       "section_3",
9 9
       "section_4",
10 10
     ];

+ 77
- 16
js/section_3.js Zobrazit soubor

@@ -1,17 +1,5 @@
1 1
 $(function () {
2
-  function initSubjectBadEcharts() {
3
-    var xAxis_data = [
4
-      "语文",
5
-      "数学",
6
-      "英语",
7
-      "物理",
8
-      "地理",
9
-      "化学",
10
-      "道德与法治",
11
-      "历史",
12
-      "生物"
13
-    ];
14
-    var series_data = [12, 20, 15, 8, 7, 11, 13, 15, 8];
2
+  function initSubjectBadEcharts(xAxis_data, series_data) {
15 3
     var option = {
16 4
       animation: false,
17 5
       title: {
@@ -110,7 +98,80 @@ $(function () {
110 98
     myEcharts.setOption(option);
111 99
   }
112 100
   var parameter = $(".section_3_html_root").data("page-params");
113
-  console.log("section_3:parameter", JSON.parse(parameter));
114
-
115
-  initSubjectBadEcharts();
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 badTableHeadTr1Html = '<th rowspan="2">班级</th>';
137
+  var badTableHeadTr2Html = '';
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
+    badTableHeadTr1Html += '<th colspan="2">' + subjectid_subjectname[subjectid] + '</th>';
149
+    badTableHeadTr2Html += '<th>人数</th><th>比例</th>';
150
+  }
151
+  $(".section_3 .subjectBadMaxNum").text(maxSubjectInfo.subjectname);
152
+  initSubjectBadEcharts(xAxis_data, series_data);
153
+  var maxClassInfo = {
154
+    num: 0,
155
+    classname: ""
156
+  };
157
+  var badTableTbodyHtml = "";
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
+    badTableTbodyHtml += '<tr>' + trHtml + '</tr>';
172
+  }
173
+  $(".section_3 .classBadMaxNum").text(maxClassInfo.classname);
174
+  $(".section_3 .badTableHeadTr1").html(badTableHeadTr1Html);
175
+  $(".section_3 .badTableHeadTr2").html(badTableHeadTr2Html);
176
+  $(".section_3 .badTableTbody").html(badTableTbodyHtml);
116 177
 });

+ 79
- 18
js/section_4.js Zobrazit soubor

@@ -1,17 +1,5 @@
1 1
 $(function () {
2
-  function initSubjectGoodEcharts() {
3
-    var xAxis_data = [
4
-      "语文",
5
-      "数学",
6
-      "英语",
7
-      "物理",
8
-      "地理",
9
-      "化学",
10
-      "道德与法治",
11
-      "历史",
12
-      "生物"
13
-    ];
14
-    var series_data = [12, 20, 15, 8, 7, 11, 13, 15, 8];
2
+  function initSubjectGoodEcharts(xAxis_data, series_data) {
15 3
     var option = {
16 4
       animation: false,
17 5
       title: {
@@ -29,7 +17,7 @@ $(function () {
29 17
         itemWidth: $.UnitUtil.mm2px(2),
30 18
         itemHeight: $.UnitUtil.mm2px(2),
31 19
         top: "bottom",
32
-        data: ["违纪人数"],
20
+        data: ["优秀人数"],
33 21
       },
34 22
       grid: {
35 23
         top: $.UnitUtil.mm2px(10),
@@ -85,7 +73,7 @@ $(function () {
85 73
       ],
86 74
       series: [
87 75
         {
88
-          name: "违纪人数",
76
+          name: "优秀人数",
89 77
           type: "bar",
90 78
           barWidth: $.UnitUtil.mm2px(5),
91 79
           // 柱状图最小高度
@@ -110,7 +98,80 @@ $(function () {
110 98
     myEcharts.setOption(option);
111 99
   }
112 100
   var parameter = $(".section_4_html_root").data("page-params");
113
-  console.log("section_4:parameter", JSON.parse(parameter));
114
-
115
-  initSubjectGoodEcharts();
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_4 .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_4 .classGoodMaxNum").text(maxClassInfo.classname);
174
+  $(".section_4 .goodTableHeadTr1").html(goodTableHeadTr1Html);
175
+  $(".section_4 .goodTableHeadTr2").html(goodTableHeadTr2Html);
176
+  $(".section_4 .goodTableTbody").html(goodTableTbodyHtml);
116 177
 });

+ 5
- 76
sections/section_3.html Zobrazit soubor

@@ -22,90 +22,19 @@
22 22
     <div id="subjectBadEcharts" style="margin: 0 4mm 4mm;height: 71mm;"></div>
23 23
     <div class="echarts_result">
24 24
       <div>上图统计结果表示:</div>
25
-      <div class="echarts_result_content"><span class="bg_5699FF"></span>违纪行为最多的科目:英语</div>
25
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪行为最多的科目:<span class="subjectBadMaxNum"></span></div>
26 26
     </div>
27 27
     <h2 class="section_title_2">2. 班级违纪行为统计</h2>
28 28
     <table border="1" class="my_table">
29 29
       <thead>
30
-        <tr>
31
-          <th rowspan="2">班级</th>
32
-          <th colspan="2" class="w29mm">语文</th>
33
-          <th colspan="2" class="w29mm">数学</th>
34
-          <th colspan="2" class="w29mm">英语</th>
35
-          <th colspan="2" class="w29mm">物理</th>
36
-          <th colspan="2" class="w29mm">地理</th>
37
-        </tr>
38
-        <tr>
39
-          <th>人数</th>
40
-          <th>比例</th>
41
-          <th>人数</th>
42
-          <th>比例</th>
43
-          <th>人数</th>
44
-          <th>比例</th>
45
-          <th>人数</th>
46
-          <th>比例</th>
47
-          <th>人数</th>
48
-          <th>比例</th>
49
-        </tr>
30
+        <tr class="badTableHeadTr1"></tr>
31
+        <tr class="badTableHeadTr2"></tr>
50 32
       </thead>
51
-      <tbody>
52
-        <tr>
53
-          <td><div class="my_cell">全部班级</div></td>
54
-          <td><div class="my_cell">5</div></td>
55
-          <td><div class="my_cell">4%</div></td>
56
-          <td><div class="my_cell">5</div></td>
57
-          <td><div class="my_cell">4%</div></td>
58
-          <td><div class="my_cell">5</div></td>
59
-          <td><div class="my_cell">4%</div></td>
60
-          <td><div class="my_cell">5</div></td>
61
-          <td><div class="my_cell">4%</div></td>
62
-          <td><div class="my_cell">5</div></td>
63
-          <td><div class="my_cell">4%</div></td>
64
-        </tr>
65
-        <tr>
66
-          <td><div class="my_cell">八年级一班</div></td>
67
-          <td><div class="my_cell">5</div></td>
68
-          <td><div class="my_cell">4%</div></td>
69
-          <td><div class="my_cell">5</div></td>
70
-          <td><div class="my_cell">4%</div></td>
71
-          <td><div class="my_cell">5</div></td>
72
-          <td><div class="my_cell">4%</div></td>
73
-          <td><div class="my_cell">5</div></td>
74
-          <td><div class="my_cell">4%</div></td>
75
-          <td><div class="my_cell">5</div></td>
76
-          <td><div class="my_cell">4%</div></td>
77
-        </tr>
78
-        <tr>
79
-          <td><div class="my_cell">八年级二班</div></td>
80
-          <td><div class="my_cell">5</div></td>
81
-          <td><div class="my_cell">4%</div></td>
82
-          <td><div class="my_cell">5</div></td>
83
-          <td><div class="my_cell">4%</div></td>
84
-          <td><div class="my_cell">5</div></td>
85
-          <td><div class="my_cell">4%</div></td>
86
-          <td><div class="my_cell">5</div></td>
87
-          <td><div class="my_cell">4%</div></td>
88
-          <td><div class="my_cell">5</div></td>
89
-          <td><div class="my_cell">4%</div></td>
90
-        </tr>
91
-        <tr>
92
-          <td><div class="my_cell">八年级三班</div></td>
93
-          <td><div class="my_cell">5</div></td>
94
-          <td><div class="my_cell">4%</div></td>
95
-          <td><div class="my_cell">5</div></td>
96
-          <td><div class="my_cell">4%</div></td>
97
-          <td><div class="my_cell">5</div></td>
98
-          <td><div class="my_cell">4%</div></td>
99
-          <td><div class="my_cell">5</div></td>
100
-          <td><div class="my_cell">4%</div></td>
101
-          <td><div class="my_cell">5</div></td>
102
-          <td><div class="my_cell">4%</div></td>
103
-        </tr>
104
-      </tbody>
33
+      <tbody class="badTableTbody"></tbody>
105 34
     </table>
106 35
     <div class="echarts_result">
107 36
       <div>上图统计结果表示:</div>
108
-      <div class="echarts_result_content"><span class="bg_5699FF"></span>违纪行为最多的班级:八年级三班</div>
37
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>违纪行为最多的班级:<span class="classBadMaxNum"></span></div>
109 38
     </div>
110 39
   </div>
111 40
   <script src="../js/section_3.js"></script>

+ 5
- 76
sections/section_4.html Zobrazit soubor

@@ -22,90 +22,19 @@
22 22
     <div id="subjectGoodEcharts" style="margin: 0 4mm 4mm;height: 71mm;"></div>
23 23
     <div class="echarts_result">
24 24
       <div>上图统计结果表示:</div>
25
-      <div class="echarts_result_content"><span class="bg_5699FF"></span>优秀试卷最多的科目:英语</div>
25
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>优秀试卷最多的科目:<span class="subjectGoodMaxNum"></span></div>
26 26
     </div>
27 27
     <h2 class="section_title_2">2. 班级优秀试卷统计</h2>
28 28
     <table border="1" class="my_table">
29 29
       <thead>
30
-        <tr>
31
-          <th rowspan="2">班级</th>
32
-          <th colspan="2" class="w29mm">语文</th>
33
-          <th colspan="2" class="w29mm">数学</th>
34
-          <th colspan="2" class="w29mm">英语</th>
35
-          <th colspan="2" class="w29mm">物理</th>
36
-          <th colspan="2" class="w29mm">地理</th>
37
-        </tr>
38
-        <tr>
39
-          <th>人数</th>
40
-          <th>比例</th>
41
-          <th>人数</th>
42
-          <th>比例</th>
43
-          <th>人数</th>
44
-          <th>比例</th>
45
-          <th>人数</th>
46
-          <th>比例</th>
47
-          <th>人数</th>
48
-          <th>比例</th>
49
-        </tr>
30
+        <tr class="goodTableHeadTr1"></tr>
31
+        <tr class="goodTableHeadTr2"></tr>
50 32
       </thead>
51
-      <tbody>
52
-        <tr>
53
-          <td><div class="my_cell">全部班级</div></td>
54
-          <td><div class="my_cell">5</div></td>
55
-          <td><div class="my_cell">4%</div></td>
56
-          <td><div class="my_cell">5</div></td>
57
-          <td><div class="my_cell">4%</div></td>
58
-          <td><div class="my_cell">5</div></td>
59
-          <td><div class="my_cell">4%</div></td>
60
-          <td><div class="my_cell">5</div></td>
61
-          <td><div class="my_cell">4%</div></td>
62
-          <td><div class="my_cell">5</div></td>
63
-          <td><div class="my_cell">4%</div></td>
64
-        </tr>
65
-        <tr>
66
-          <td><div class="my_cell">八年级一班</div></td>
67
-          <td><div class="my_cell">5</div></td>
68
-          <td><div class="my_cell">4%</div></td>
69
-          <td><div class="my_cell">5</div></td>
70
-          <td><div class="my_cell">4%</div></td>
71
-          <td><div class="my_cell">5</div></td>
72
-          <td><div class="my_cell">4%</div></td>
73
-          <td><div class="my_cell">5</div></td>
74
-          <td><div class="my_cell">4%</div></td>
75
-          <td><div class="my_cell">5</div></td>
76
-          <td><div class="my_cell">4%</div></td>
77
-        </tr>
78
-        <tr>
79
-          <td><div class="my_cell">八年级二班</div></td>
80
-          <td><div class="my_cell">5</div></td>
81
-          <td><div class="my_cell">4%</div></td>
82
-          <td><div class="my_cell">5</div></td>
83
-          <td><div class="my_cell">4%</div></td>
84
-          <td><div class="my_cell">5</div></td>
85
-          <td><div class="my_cell">4%</div></td>
86
-          <td><div class="my_cell">5</div></td>
87
-          <td><div class="my_cell">4%</div></td>
88
-          <td><div class="my_cell">5</div></td>
89
-          <td><div class="my_cell">4%</div></td>
90
-        </tr>
91
-        <tr>
92
-          <td><div class="my_cell">八年级三班</div></td>
93
-          <td><div class="my_cell">5</div></td>
94
-          <td><div class="my_cell">4%</div></td>
95
-          <td><div class="my_cell">5</div></td>
96
-          <td><div class="my_cell">4%</div></td>
97
-          <td><div class="my_cell">5</div></td>
98
-          <td><div class="my_cell">4%</div></td>
99
-          <td><div class="my_cell">5</div></td>
100
-          <td><div class="my_cell">4%</div></td>
101
-          <td><div class="my_cell">5</div></td>
102
-          <td><div class="my_cell">4%</div></td>
103
-        </tr>
104
-      </tbody>
33
+      <tbody class="goodTableTbody"></tbody>
105 34
     </table>
106 35
     <div class="echarts_result">
107 36
       <div>上图统计结果表示:</div>
108
-      <div class="echarts_result_content"><span class="bg_5699FF"></span>优秀试卷最多的班级:八年级三班</div>
37
+      <div class="echarts_result_content"><span class="dot bg_5699FF"></span>优秀试卷最多的班级:<span class="classGoodMaxNum"></span></div>
109 38
     </div>
110 39
   </div>
111 40
   <script src="../js/section_4.js"></script>

Načítá se…
Zrušit
Uložit