Commit f917bbb9a164a69f2824519f31c0d60308a4eaeb

Authored by jack
1 parent f12ed244

1.完成单题详情

WebRoot/WEB-INF/jsp/sunvote/homework/homework_report.jsp
... ... @@ -143,7 +143,9 @@
143 143 line-height:20px;
144 144 float:left;
145 145 }
146   -
  146 + #right_ans{
  147 + margin-right:30px;
  148 + }
147 149 </style>
148 150 </head>
149 151  
... ... @@ -190,18 +192,9 @@
190 192 <div class="single">
191 193 <h3>单题正确率详情:</h3>
192 194 <ul>
  195 + <!--
193 196 <li class="list correct">1(60%)</li>
194   - <li class="list erro">2(60%)</li>
195   - <li class="list correct">3(60%)</li>
196   - <li class="list correct">4(60%)</li>
197   - <li class="list correct">5(60%)</li>
198   - <li class="list correct">6(60%)</li>
199   - <li class="list correct">7(60%)</li>
200   - <li class="list correct">8(60%)</li>
201   - <li class="list correct">9(60%)</li>
202   - <li class="list correct">10(60%)</li>
203   - <li class="list correct">11(60%)</li>
204   - <li class="list correct">12(60%)</li>
  197 + -->
205 198 </ul>
206 199 <div class="clear"></div>
207 200 </div>
... ... @@ -214,46 +207,24 @@
214 207 <div class="modal-content">
215 208 <div class="modal-header">
216 209 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
217   - <h4 class="modal-title" id="myModalLabel">第一题【3分】</h4>
  210 + <h4 class="modal-title" id="myModalLabel">第<span id="index">1</span>题【<span id="score">0</span>分】</h4>
218 211 </div>
219 212 <div class="modal-body">
220   - <p>正确答案:D 得分率:84%</p>
  213 + <p>正确答案:<span id="right_ans">D</span> 得分率:<span id="dfl">84%</span></p>
221 214 <div class="q_charts">
  215 + <!--
222 216 <div class="ans_list" style="height:50px;">
223   -
224 217 <div class="rel ans_correct">
225 218 <p class="p_num">8人</p>
226 219 </div>
227 220 <p class="ans_option">A</p>
228 221 </div>
229   - <div class="ans_list" style="height:100px;">
230   - <div class="rel ans_error">
231   - <p class="p_num">16人</p>
232   - </div>
233   - <p class="ans_option">B</p>
234   - </div>
235   - <div class="ans_list" style="height:200px;">
236   - <div class="rel ans_correct">
237   - <p class="p_num">32人</p>
238   - </div>
239   - <p class="ans_option">C</p>
240   - </div>
241   - <div class="ans_list" style="height:150px;">
242   - <div class="rel ans_correct">
243   - <p class="p_num">24人</p>
244   - </div>
245   - <p class="ans_option ans_correct_round">D</p>
246   - </div>
  222 + -->
247 223 </div>
248 224 <div class="student_list cle">
249   - <li>黄某某</li>
250   - <li>黄某某</li>
251   - <li>黄某某</li>
252   - <li>黄某某</li>
253   - <li>黄某某</li>
254   - <li>黄某某</li>
255   - <li>黄某某</li>
256   - <li>黄某某</li>
  225 +
  226 + <!-- <li>黄某某</li> -->
  227 +
257 228 </div>
258 229 </div>
259 230 </div>
... ... @@ -278,8 +249,12 @@
278 249  
279 250  
280 251  
281   - <script type="text/javascript">
282   - $(function() {
  252 + <script type="text/javascript">
  253 +
  254 + $(document).ready(function(){
  255 + window.top.loading.remove();
  256 +
  257 +
283 258 var ans_details = '${page_data.ANSWER_PERSENT}';
284 259  
285 260 if(ans_details != ''){
... ... @@ -288,167 +263,20 @@
288 263 for(i = 0;i<ans_arry.length;i++){
289 264 temp = parseInt(ans_arry[i].replace("%",""));
290 265 if(temp>=80){
291   - _html+='<li class="list correct">'+i+'('+ans_arry[i]+')'+'</li>';
  266 + _html+='<li class="list correct" data-dfl="'+ans_arry[i]+'">'+i+'('+ans_arry[i]+')'+'</li>';
292 267 }else{
293   - _html+='<li class="list erro">'+(i+1)+'('+ans_arry[i]+')'+'</li>';
  268 + _html+='<li class="list erro" data-dfl="'+ans_arry[i]+'">'+(i+1)+'('+ans_arry[i]+')'+'</li>';
294 269 }
295 270 }
296 271 $(".single ul").html(_html);
297 272 }
298   -
299   - //日期框
300   - $('.date-picker').datepicker({
301   - autoclose : true,
302   - todayHighlight : true
303   - });
304   -
305   - //下拉框
306   - if (!ace.vars['touch']) {
307   - $('.chosen-select').chosen({
308   - allow_single_deselect : true
309   - });
310   - $(window).off('resize.chosen').on('resize.chosen', function() {
311   - $('.chosen-select').each(function() {
312   - var $this = $(this);
313   - $this.next().css({
314   - 'width' : $this.parent().width()
315   - });
316   - });
317   - }).trigger('resize.chosen');
318   - $(document).on('settings.ace.chosen',
319   - function(e, event_name, event_val) {
320   - if (event_name != 'sidebar_collapsed')
321   - return;
322   - $('.chosen-select').each(function() {
323   - var $this = $(this);
324   - $this.next().css({
325   - 'width' : $this.parent().width()
326   - });
327   - });
328   - });
329   - $('#chosen-multiple-style .btn').on(
330   - 'click',
331   - function(e) {
332   - var target = $(this).find('input[type=radio]');
333   - var which = parseInt(target.val());
334   - if (which == 2)
335   - $('#form-field-select-4').addClass(
336   - 'tag-input-style');
337   - else
338   - $('#form-field-select-4').removeClass(
339   - 'tag-input-style');
340   - });
341   - }
342   -
343   - //复选框全选控制
344   - var active_class = 'active';
345   - $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on(
346   - 'click',
347   - function() {
348   - var th_checked = this.checked;//checkbox inside "TH" table header
349   - $(this).closest('table').find('tbody > tr').each(
350   - function() {
351   - var row = this;
352   - if (th_checked)
353   - $(row).addClass(active_class).find(
354   - 'input[type=checkbox]').eq(0)
355   - .prop('checked', true);
356   - else
357   - $(row).removeClass(active_class).find(
358   - 'input[type=checkbox]').eq(0)
359   - .prop('checked', false);
360   - });
361   - });
362   - });
363   -
364   - var role = '${pd.ROLE}';
365   -
366   - function precent(avg,total){
367   - if(total == 0){
368   - return "0%"
369   - }
370   - return Math.round(avg / total * 100)/100 + '%' ;
371   - }
372   -
373   - function homeReport(classId){
374   - var path = '<%=basePath%>homework/report.do?School_id=${pd.SCHOOL_ID}&CLASS_ID='+classId;
375   - console.log(path);
376   - parent.$("#mainFrame").attr('src',path);
377   - window.top.loading.show();
378   - }
379   -
380   - function tosearch(){
381   -
382   - var url = "<%=basePath%>homework/report.do?CLASS_ID=${pd.CLASS_ID}" ;
383   - var startDate = $("#lastStart").val();
384   - var endDate = $("#lastEnd").val();
385   - //var subject_id = $("#SUBJECT_ID").val();
386   - url = url + "&START_DATE=" + startDate ;
387   - if(endDate != null){
388   - url = url + "&END_DATE=" + endDate;
389   - }
390   -
391   - window.location.href = url;
392   - window.top.loading.show();
393   - /* $("#Form").sumbit(); */
394   - }
395   - function tosearch_week(type){ //上一周 本周 下一周
396   - console.log('${pd.CLASS_ID}');
397   - var url = "<%=basePath%>homework/report.do?CLASS_ID=${pd.CLASS_ID}" ;
398   - url = url + "&CURRENT_WEEK=" + type ;
399   -
400   - console.log(url);
401   - window.location.href = url;
402   - window.top.loading.show();
403   - /* $("#Form").sumbit(); */
404   - }
405   -
406   - function student(classid,studentid){
407   -
408   - var url = "<%=basePath%>homework/student.do?STUDENT_ID=" + studentid + "&CLASS_ID=" + classid ;
409   - var startDate = $("#lastStart").val();
410   - var endDate = $("#lastEnd").val();
411   - url = url + "&START_DATE=" + startDate + "&END_DATE=" + endDate ;
412   -
413   - window.location.href = url;
414   - window.top.loading.show();
415   - }
416   -
417   - function paper(class_id,testpaper_id){
418   - var url = "<%=basePath%>homework/homework_report?HOMEWORK_ID=" + testpaper_id + "&CLASS_ID=" + class_id;
419   - var startDate = $("#lastStart").val();
420   - var endDate = $("#lastEnd").val();
421   - url = url + "&START_DATE=" + startDate + "&END_DATE=" + endDate ;
422   - window.self.location.href = url;
423   - window.top.loading.show();
424   - }
425   -
426   - $(document).ready(function(){
427   - window.top.loading.remove();
428   -
429   - var sour = "${pd.DATA.HOMEWORKS}";
430   -
431   -
432   - if(sour != null && sour.length > 3){
433   - var _width = $('#mainFrame', parent.document).width()-40;
434   - var _heigh = $('#mainFrame', parent.document).height()-350;
435   - var options = {
436   - width: _width,
437   - height: _heigh,
438   - pinnedRows: 5,
439   - pinnedCols: 4,
440   - container: "#scrollableTable",
441   - removeOriginal: true
442   - };
443   - $("#simple-table").tablescroller(options);
444   - var name_height = $(".kc").last().parent().height()-18.5;
445   - console.log(name_height);
446   - $(".th_name").height(name_height);
447   - }
448   -
449 273  
450 274 var data ={};
451 275 $(document).on("click",".list",function(){
  276 +
  277 + $("#index").text($(this).index()+1);
  278 + $("#dfl").text($(this).attr("data-dfl"));
  279 +
452 280 $.ajax({
453 281 url:"<%=basePath%>homework/homeworkindex",
454 282 type:"post",
... ... @@ -456,7 +284,10 @@
456 284 success:function(res){
457 285 res = JSON.parse(res);
458 286 data=res.DATA;
459   - console.log(res.ANSWER);
  287 + console.log(res);
  288 +
  289 + $("#right_ans").text(res.ANSWER);
  290 + $("#score").text(res.SCORE);
460 291  
461 292 var stundent_num=[];
462 293 var _html='';
... ... @@ -465,7 +296,7 @@
465 296 }
466 297 max_num=Math.max.apply(null,stundent_num);
467 298 for(i=0;i<res.DATA.length;i++){
468   - if(String.fromCharCode(65+i)==res.ANSWER){
  299 + if(res.ANSWER.indexOf(String.fromCharCode(65+i))>-1){
469 300 _html += '<div class="ans_list" style="height:'+(stundent_num[i]*200/max_num).toFixed(2)+'px;"><div class="rel ans_correct"><p class="p_num">'+res.DATA[i].length+'人</p></div><p class="ans_option">'+String.fromCharCode(65+i)+'</p></div>'
470 301 }else{
471 302 _html += '<div class="ans_list" style="height:'+(stundent_num[i]*200/max_num).toFixed(2)+'px;"><div class="rel ans_error"><p class="p_num">'+res.DATA[i].length+'人</p></div><p class="ans_option">'+String.fromCharCode(65+i)+'</p></div>';
... ... @@ -478,6 +309,13 @@
478 309 $(".student_list").html(student_option_list);
479 310  
480 311 $(".q_charts").html(_html);
  312 +
  313 + var className=$(".ans_option").eq(0).siblings(".rel").attr("class");
  314 + if(className.indexOf("ans_error")>0){
  315 + $(".ans_option").eq(0).addClass("ans_error_round");
  316 + }else{
  317 + $(".ans_option").eq(0).addClass("ans_correct_round");
  318 + }
481 319 //console.log(max_num);
482 320 $('#myModal').modal('toggle')
483 321 }
... ...