Blame view

WebRoot/WEB-INF/jsp/sunvote/teacher/indexPage.jsp 5.08 KB
8ba06cff   孙向锦   添加首页
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <%@ page language="java" contentType="text/html; charset=UTF-8"
  	pageEncoding="UTF-8"%>
  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  <%
  	String path = request.getContextPath();
  	String basePath = request.getScheme() + "://"
  			+ request.getServerName() + ":" + request.getServerPort()
  			+ path + "/";
  %>
  
  <!DOCTYPE html>
  <html lang="zh">
  <head>
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>首页</title>
21804155   jack   1、修改jq和bootstrap路径
19
      <link rel="stylesheet" href="../static/css/bootstrap.min.css" />
8ba06cff   孙向锦   添加首页
20
21
22
23
24
25
26
27
28
29
      <link rel="stylesheet" href="css/style.css" />
      <style>
      body{ background-color: #fff }
      .title{padding:15px;}
      .question{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 200px;}
  	.erro_list table{display:inline;}
      </style>
      <!--[if IE]>
          <script src="http://libs.baidu.com/html5shiv/3.7/html5shiv.min.js"></script>
      <![endif]-->
21804155   jack   1、修改jq和bootstrap路径
30
31
      <script src="../static/js/jquery.min.js"></script>
      <link rel="stylesheet" href="../static/css/bootstrap.min.css" >
8ba06cff   孙向锦   添加首页
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
  </head>
  <body>
  	<div class="container content">
      <p class="bg-primary title" style="margin-top:20px">考试</p>
      <table class="table table-hover">
        <thead>
        <col width="10%" />
  	  <col width="20%" />
  	  <col width="10%" />
  	  <col width="10%" />
  	  <col width="10%" />
  	  <col width="10%" />
  	  <col width="20%" />
  	  <col width="10%" />
          <tr>
            <th>序号</th>
            <th>测验标题</th>
            <th>班级</th>
            <th>班级平均分</th>
            <th>测验总分</th>
            <th>得分率</th>
            <th>测验时间</th>
            <th>操作</th>
          </tr>
        </thead>  
        <tbody class="test_list">
          <!--测验列表-->
        </tbody>
      </table>
      <p class="bg-primary title">错题</p>
      <table class="table table-hover">
        <thead>
  	  <col width="10%" />
  	  <col width="20%" />
  	  <col width="20%" />
  	  <col width="20%" />
  	  <col width="20%" />
  	  <col width="10%" />
          <tr>
            <th>序号</th>
            <th>题目</th>
            <th>错误率</th>
            <th>测试名称</th>
            <th>测试时间</th>
            <th>操作</th>
          </tr>
        </thead>  
        <tbody class="erro_list">
          <!--错题列表-->
        </tbody>
      </table>
  	</div>
      <script>
      $(document).ready(function(){
          var test_html="";
          var erro_html="";
          $.ajax({
              url:"/SunvoteEducation/api/v1/testpaper",
              async : false,
              type:"post",
              data:{user_id:"8dbef15bb6d043ec94b719ede583b033"},
              success:function(data){
                  for(var i=0;i<5;i++){
                      if(data.data[i].avgScore=="")
                          var avgScore=0;
                      else
                          var avgScore=parseInt(data.data[i].avgScore);
                      if(data.data[i].totalScore==null||data.data[i].totalScore==0){
                          var totalScore=0;
                          var scoringRate=0;
                      }
                      else{
                          var totalScore=parseInt(data.data[i].totalScore);
                          var scoringRate=avgScore/totalScore;
                      }
                      test_html+='<tr><td>'+(i+1)+'</td><td>'+data.data[i].name+'</td><td>'+getClassName(data.data[i].classId)+'</td><td>'+avgScore+'</td><td>'+totalScore+'</td><td>'+scoringRate+'</td><td>'+data.data[i].createDate+'</td><td><a href="#">查看</a></td></tr>';
                  }
                  $(".test_list").html(test_html);
              }
          });
          $.ajax({
              url:"/SunvoteEducation/api/v1/wrongquestion",
              async : false,
              type:"post",
              data:{start_date:"",end_date:"",count:"5"},
              success:function(data){
                  for(var i=0;i<5;i++){
                      erro_html+='<tr><td>'+(i+1)+'</td><td><div class="question">'+data.data[i].CONTENT+'</div></td><td>'+data.data[i].WRONG_NUM+'</td><td>'+data.data[i].NAME+'</td><td>'+data.data[i].CREATE_DATE+'</td><td><a href="#">查看</a></td></tr>';
                  }
                  $(".erro_list").html(erro_html);
                  $(".erro_list img").remove();
  				$(".erro_list table").remove();
              }
          })
      })
      function getClassName(id) { // 获取班级中文名
          var className = "";
          $.ajax({
              url : "/SunvoteEducation/api/v1/classname",
              async : false,
              type : "post",
              data : {
                  id : id
              },
              success : function(data) {
                  className = data.data;
              },
              error: function (XMLHttpRequest, textStatus, errorThrown) {
                      // 错误信息   
                      alert("状态码:"+XMLHttpRequest.status+"状态:"+XMLHttpRequest.readyState+"错误信息:"+textStatus+"");
                      window.top.loading.remove();
                  }
          })
          return className;
      }
          
      </script>
  </body>
  </html>