-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_in.html
391 lines (356 loc) · 12 KB
/
test_in.html
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<link href="css/mui.min.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
<link href="css/iconfont.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<link rel="prerender" href="test_done.html">
<link rel="prerender" href="banji.html"> <script src="js/mui.min.js"></script>
<script src="js/tool.js"></script>
<!--<script src="js/testdata.js"></script>-->
<style>
.title {
margin: 20px 15px 10px;
color: #6d6d72;
font-size: 15px;
}
.oa-contact-cell.mui-table .mui-table-cell {
padding: 11px 0;
vertical-align: middle;
}
.oa-contact-cell {
position: relative;
margin: -11px 0;
}
.oa-contact-avatar {
width: 75px;
}
.oa-contact-avatar img {
border-radius: 50%;
}
.oa-contact-content {
width: 100%;
}
.oa-contact-name {
margin-right: 20px;
}
.oa-contact-name,
oa-contact-position {
float: left;
}
body {
background-color: #EFEFF4;
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li {
float: left;
}
button:link,
button:visited {
display: block;
width: 150px;
font-size: 30px;
font-weight: bold;
color: #29C4B5;
background-color: #FFFFFF;
text-align: center;
padding: 20px;
text-decoration: none;
text-transform: uppercase;
}
button:hover,
button:active {
background-color: #29C4B5;
color: #FFFFFF;
}
.header button {
width: 150px;
height: 50px;
-webkit-border-radius: 1em;
-moz-border-radius: 1em;
border: 1px solid #29C4B5;
font-size: 30px;
margin-left: 35%;
}
.header ul input {
margin-left: 10%;
margin-right: 10%;
margin-bottom: 1%;
width: 500px;
height: 200px;
padding: 5em 5em 5em 5.4em;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border: 1px solid #29C4B5;
}
.header {
position: relative;
margin-left: 20%;
margin-right: 20%;
margin-top: 1%;
}
.nav {
background: #FFFFFF;
padding: 20px;
width: 100%;
position: fixed;
left: 0;
bottom: 0;
margin-bottom: 1%;
}
.top {
margin-left: 38%;
margin-right: 25%;
}
.inner {
margin-left: 15%;
margin-right: 25%;
}
.inner ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
.inner li {
float: left;
}
#top-segment-control {
background: #FFFFFF;
width: 70%;
margin: auto;
}
.inner a:link,
a:visited {
display: block;
width: 150px;
font-weight: bold;
color: #8F8F94;
background-color: #FFFFFF;
text-align: center;
padding: 10px;
text-decoration: none;
text-transform: uppercase;
}
.mui-active {
color: #29C4B5;
}
.mui-content
{
height: 100%;
margin-left: 24%;
}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">测试</h1>
<a href="addtest.html" ><span id="addtest" class="mui-icon mui-icon-plusempty mui-pull-right" ></span></a>
</header>
<div class="mui-content">
<ul>
<li><button id="test_in" style="background-color:#29C4B5;">进行中</button></li>
<li><button id="test_done" >已结束</button></li>
<li><button id="test_before" >未进行</button></li>
</ul>
</div>
<div id="test">
</div>
<nav class="mui-bar mui-bar-tab">
<a class="mui-tab-item " id="test1" href="test.html">
<span class="mui-icon iconfont icon-ceshi"></span>
<span class="mui-tab-label">测试</span>
</a>
<a class="mui-tab-item" href="tiku.html" id="tiku">
<span class="mui-icon mui-icon-email"></span>
<span class="mui-tab-label">题库</span>
</a>
<a class="mui-tab-item" href="banji.html" id="banji">
<span class="mui-icon mui-icon-contact"></span>
<span class="mui-tab-label">班级</span>
</a>
<a class="mui-tab-item" href="user.html" id="user">
<span class="mui-icon mui-icon-gear"></span>
<span class="mui-tab-label">我</span>
</a>
</nav>
<script>
mui.init({
swipeBack:true //启用右滑关闭功能
});
mui('body').on('tap','a',function(){document.location.href=this.href;});
mui.init({
swipeBack:true //启用右滑关闭功能
});
(function($,doc){
jQuery.noConflict();
//var url='127.0.0.1:8080';
// var url='210.36.22.231';
var userid = GetUseridCookie().get("userid");
if(userid==undefined){
alert("登录过期,请重新登录!");
javascript:window.location.href="login.html"
}
var test_in = document.getElementById("test_in");
var test_done = document.getElementById("test_done");
var test_before = document.getElementById("test_before");
// test_in.onclick=function(){
// window.location.href='test_in.html?data='+JSON.stringify(testdata);
// }
// test_before.onclick=function()
// {
// window.location.href='test_before.html?data='+JSON.stringify(testdata);
// }
// test_done.onclick=function()
// {
// window.location.href='test_done.html?data='+JSON.stringify(testdata);
// }
// var test = document.getElementById("test");
// var bookmark='';
// var usertype = GetUsertypeCookie().get("usertype");
// if(usertype==2){
// document.getElementById("test1").href = 't_test.html?data='+JSON.stringify(testdata);
// document.getElementById("tiku").href = "t_tiku.html";
// document.getElementById("banji").href = "t_banji.html";
// document.getElementById("user").href = "t_user.html";
// }else{
// document.getElementById("test1").href = 'test.html?data='+JSON.stringify(testdata);
// document.getElementById("addtest").style.display = "none";
// }
test_in.onclick=function(){
window.location.href='test_in.html';
}
test_before.onclick=function()
{
window.location.href='test_before.html';
}
test_done.onclick=function()
{
window.location.href='test_done.html';
}
var test = document.getElementById("test");
var bookmark='0';
var usertype = GetUsertypeCookie().get("usertype");
if(usertype==2){
document.getElementById("test1").href = 't_test.html';
document.getElementById("tiku").href = "t_tiku.html";
document.getElementById("banji").href = "t_banji.html";
document.getElementById("user").href = "t_user.html";
}else{
document.getElementById("test1").href = 'test.html';
document.getElementById("addtest").style.display = "none";
}
var d=new Date().getTime();
mui.ajax('http://'+url+'/jizhibackend/servlet/GetTestsServlet',{
data:
{
userid:userid,
type:1,
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
async: false,//同步
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
success: function(data) {
addtest(data);
},
error: function(xhr, type, errorThrown) {
console.log(errorThrown);
}
});
function addtest(data){
var system_time=data.system_time;
//var data1=testdata.testList;
var data1=data.testList;
var q_order=1;
jQuery.each(data1,function(index,item){
var useranswer='';
var timeuse='';
var answertrace='';
for(var i=0;i<item.qNum-1;i++)
{
useranswer=useranswer+'null@@';
timeuse=timeuse+'0,';
answertrace=answertrace+' $$';
}
useranswer=useranswer+'null';
timeuse=timeuse+'0';
var testtime=item.end_time;
//var testtime=item.end_time-d;
var a = document.createElement('a');
var div = document.createElement('div');
div.className="mui-card";
div.style="margin: 10px;";
var end_timed=new Date(item.end_time);
if(system_time>item.start_time&&system_time<item.end_time){
if(end_timed.getMinutes()<10)
{
var end_time=end_timed.getHours() + ":0" + end_timed.getMinutes() ;
}
else{
var end_time=end_timed.getHours() + ":" + end_timed.getMinutes() ;
}
var create_timed=new Date(item.create_time);
var start_timed=new Date(item.start_time);
if(start_timed.getMinutes()<10)
var start_time=start_timed.getHours() + ":0" + start_timed.getMinutes() ;
else
var start_time=start_timed.getHours() + ":" + start_timed.getMinutes() ;
var create_day=create_timed.getFullYear() + "-" + (create_timed.getMonth()+1)+"-"+create_timed.getDate() ;
if(data.isDone[index]==1)
{
// a.href='datijieguo.html?testid='+item.testid;
alert("已完成,待测试结束后可查看结果!");
}
else{
a.href='new_pro2.html?testid='+item.testid+'&qnum='+item.qNum+'&porder='+q_order+'&answer='+useranswer+'&testtime='+testtime+'&timeuse='+timeuse+'&bookmark='+bookmark+'&answertrace='+answertrace;
}
div.innerHTML='<div class="mui-card" style="margin: 10px;">'+
'<div id="div-space" style="width: 32%; height: 90px; background-color: #2DBFB0;padding: 10px;float: left;">'+
'<i class="iconfont2 icon-time1" style="color: #FFFFFF;"></i>'+
'<span style="position: relative; float: right;color: #FFFFFF;">进行中</span>'+
'<div style="position:absolute; color: #FFFFFF;top: 40%;left: 13%;width: 32%;margin-left: -35px;font-size:15px;">'+start_time+'~'+end_time+
'</div>'+
'</div>'+
'<div style="height:90px;width: 68%;float: left; padding: 15px;">'+
'<div style="font-size:large ;">'+item.title+'</div>'+
'<div style="height: 15px;"></div>'+
'<div style="font-size:large ;margin-top: 10px;">'+
'<span class="mui-icon iconfont icon-class" ></span>'+
'<span style="font-size:small">'+item.myclass.name+'   </span>'+
'<i class="iconfont2 icon-calendar"></i>'+
'<span style="font-size:small">'+create_day+'</span>'+
'</div></div></div>'
test.appendChild(a);
a.appendChild(div);
}
});
if(test.children.length==0){
mui.toast("目前没有进行中的测试!");
}
}
}(mui.document));
</script>
</body>
</html>