-
Notifications
You must be signed in to change notification settings - Fork 1
/
scoreByClassName.php
284 lines (245 loc) · 8.21 KB
/
scoreByClassName.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php
/**
* @name 生蚝体测信息管理系统-Web-按班+名查成绩
* @author Jerry Cheung <master@xshgzs.com>
* @create 2018-11-10
* @update 2019-12-16
*/
require_once 'include/public.func.php';
?>
<html>
<head>
<title>生蚝科技-体测信息管理系统</title>
<?php include 'include/header.php'; ?>
</head>
<body>
<?php include 'include/pageHeader.php'; ?>
<h3 style="text-align:center;">按班级+姓名查询成绩</h3>
<hr>
<!--div style="width:98%;text-align:center;margin: 0 auto;">
<div class="alert alert-warning">
<i class="fa fa-info-circle" aria-hidden="true"></i> 请按照<b style="color:green;">2017年9月时的年级、班级</b>点选!!<br>如:现在是高二,则需选择高一<br>(若有分班请按之前的班级选择)
</div>
</div>
<hr-->
<!-- 姓名输入框 -->
<div class="input-group">
<span class="input-group-addon">姓名</span>
<input class="form-control" id="name" onkeyup='if(event.keyCode==13)$("#grade").focus();'>
</div>
<!-- ./姓名输入框 -->
<br>
<div class="col-xs-12">
<select class="form-control" id="grade" onchange='$("#enrollmentYear").focus();'>
<option selected disabled>::: 请选择学段 :::</option>
<option disabled>-------------- 西校区 --------------</option>
<option value="高" selected>高中</option>
<option disabled>-------------- 东校区 --------------</option>
<option value="初">初中</option>
</select>
</div>
<div class="col-xs-6">
<select class="form-control" id="enrollmentYear" onchange='$("#classNum").focus();'>
<option selected disabled>::: 请选择入学年份 :::</option>
<?php for($i=2016;$i<=date('Y');$i++){ ?>
<option value="<?=$i;?>"><?php if($i==date('Y')) echo '★ '; ?><?=$i;?> 年</option>
<?php } ?>
</select>
</div>
<div class="col-xs-6">
<select class="form-control" id="classNum">
<option selected disabled>::: 请选择班别 :::</option>
<option value="1">1 班</option>
<option value="2">2 班</option>
<option value="3">3 班</option>
<option value="4">4 班</option>
<option value="5">5 班</option>
<option value="6">6 班</option>
<option value="7">7 班</option>
<option value="8">8 班</option>
<option value="9">9 班</option>
<option value="10">10 班</option>
<option value="11">11 班</option>
<option value="12">12 班</option>
</select>
</div>
<p style="line-height:8px;"> </p>
<!-- 提交按钮 -->
<center>
<a class="btn btn-primary" style="width:48%" href="<?=ROOT_PATH;?>">< 返 回</a> <button class="btn btn-success" style="width:48%" onclick="inputPassword();">立 即 查 询 ></button>
</center>
<!-- ./提交按钮 -->
<hr>
<div style="width:98%;text-align:center;margin: 0 auto;">
<div class="alert alert-danger">
<i class="fa fa-lightbulb-o" aria-hidden="true"></i> 点击项目名称可查看该项目的练习建议
</div>
</div>
<div id="scoreShow"></div>
<?php include 'include/footer.php'; ?>
<script src="<?=JS_PATH;?>advice.js"></script>
<script>
var tableStyle="border-radius:5px;border-collapse: separate;text-align:center;";
var token="";
function inputPassword(){
lockScreen();
name=$("#name").val();
grade=$("#grade").val();
enrollmentYear=$("#enrollmentYear").val();
classNum=$("#classNum").val();
className=grade+enrollmentYear+"级"+classNum+"班";
$("#scoreShow").html("");
$("#password").val("");
if(name=="" || name.length<2){
unlockScreen();
showTipsModal("请正确输入姓名!");
return false;
}
if(grade=="" || grade==null){
unlockScreen();
showTipsModal("请选择学段!");
return false;
}
if(enrollmentYear=="" || enrollmentYear==null){
unlockScreen();
showTipsModal("请选择入学年份!");
return false;
}
if(classNum=="" || classNum==null){
unlockScreen();
showTipsModal("请选择班别!");
return false;
}
$.ajax({
url:"getScoreToken.php",
data:{"orderBy":"className","name":name,"className":className},
dataType:"json",
error:function(e){
unlockScreen();
console.log(JSON.stringify(e));
showTipsModal("服务器错误!<br>请将错误码["+e.readyState+"."+e.status+"]至技术支持");
return false;
},
success:function(ret){
unlockScreen();
if(ret.code==200){
token=ret.data['token'];
setCookie("phyToken",token);
$("#inputPwdModal").modal("show");
return true;
}else if(ret.code==1){
showTipsModal("学生不存在 或 成绩暂未录入!");
return false;
}else if(ret.code==0 || ret.code==2){
showTipsModal("参数缺失!<br>请联系管理员!");
return false;
}else{
showTipsModal("系统错误!<br>请将错误码["+ret.code+"]至技术支持");
return false;
}
}
});
}
function search(){
lockScreen();
password=$("#password").val();
if(password=="" || password.length<6){
unlockScreen();
$("#inputPwdModal").modal("hide");
showTipsModal("请正确输入查询密码!");
return false;
}
$.ajax({
url:"getScore.php",
data:{"token":token,"password":password},
dataType:"json",
error:function(e){
unlockScreen();
console.log(JSON.stringify(e));
showTipsModal("服务器错误!<br>请将错误码["+e.readyState+"."+e.status+"]至技术支持");
return false;
},
success:function(ret){
unlockScreen();
$("#inputPwdModal").modal("hide");
$("#scoreShow").html("");
if(ret.code==200){
scoreList=ret.data['scoreList'];
scoreFieldList=ret.data['scoreFieldList'];
totalScore=scoreList.length;
totalField=scoreFieldList.length;
className=scoreList[0]['class_name'];
name=scoreList[0]['name'];
html="<center><h4>"+className+" "+name+"</h4></center>";
// 显示每年的成绩
for(i=0;i<totalScore;i++){
info=scoreList[i];
html+='<table class="table table-hover table-striped table-bordered" style="border-radius:5px;border-collapse: separate;text-align:center;">'
+'<tr>'
+'<th colspan="4" style="text-align:center;background-color:#BAF7FD;">'+info['year']+' 学年</th>'
+'</tr>'
+'<tr>'
+'<th style="text-align:center;background-color:#BEFFB1;">项目名称</th>'
+'<th style="text-align:center;background-color:#BEFFB1;">成绩</th>'
+'<th style="text-align:center;background-color:#BEFFB1;">得分</th>'
+'<th style="text-align:center;background-color:#BEFFB1;">等级</th>'
+'</tr>';
// 显示各项目
for(field in scoreFieldList){
score=info[field].split("|");
scoreNum=score[0];
point=score[1];
level=score[2];
html+='<tr>'
+'<th style="vertical-align:middle;text-align:center;" onclick="showExerciseAdvice('+"'"+field+"'"+','+"'"+scoreFieldList[field]+"'"+');">'+scoreFieldList[field]+'</th>';
if(info[field]=="||"){
html+='<td colspan="3">/</td>';
}else if(field=="height"){
html+='<td colspan="3">'+scoreNum+'</td>';
}else{
html+='<td style="vertical-align:middle;text-align:center;">'+scoreNum+'</td>'
+'<td style="vertical-align:middle;text-align:center;">'+point+'</td>'
+'<td style="vertical-align:middle;text-align:center;">'+level+'</td>'
+'</tr>';
}
}
html+='</table>';
}
$("#scoreShow").html(html);
return true;
}else if(ret.code==403){
showTipsModal("查询密码有误!");
return false;
}else if(ret.code==1){
showTipsModal("无此学生或成绩暂未录入!<br>请耐心等待,谢谢配合!");
return false;
}else{
showTipsModal("系统错误!<br>请将错误码["+ret.code+"]至技术支持");
return false;
}
}
});
}
</script>
<div class="modal fade" id="adviceModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true"></span><span class="sr-only">Close</span></button>
<h3 class="modal-title" id="fieldName"></h3>
</div>
<div class="modal-body">
<font style="font-weight:bold;font-size:20px;">
<p id="adviceContent"></p>
</font>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">关闭 ></button>
</div>
</div>
</div>
</div>
<?php include 'include/password.php'; ?>
<?php include 'include/tipsModal.php'; ?>
</body>
</html>