Commit 8ba06cff1e0ed0ae97dd0ba25d970565013f2c6b

Authored by 孙向锦
1 parent 227dbfbb

添加首页

.settings/org.eclipse.core.resources.prefs
1 1 eclipse.preferences.version=1
2 2 encoding//WebRoot/WEB-INF/jsp/sunvote/paper/paper_list2.jsp=UTF-8
3 3 encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp=UTF-8
  4 +encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/indexPage.jsp=UTF-8
4 5 encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp=UTF-8
5 6 encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/set_question.jsp=UTF-8
6 7 encoding//WebRoot/WEB-INF/jsp/sunvote/teacher/stduent_report.jsp=UTF-8
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/indexPage.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://"
  8 + + request.getServerName() + ":" + request.getServerPort()
  9 + + path + "/";
  10 +%>
  11 +
  12 +<!DOCTYPE html>
  13 +<html lang="zh">
  14 +<head>
  15 + <meta charset="UTF-8">
  16 + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  17 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
  18 + <title>首页</title>
  19 + <link rel="stylesheet" href="http://lib.sinaapp.com/js/bootstrap/3.0.0/css/bootstrap.min.css" />
  20 + <link rel="stylesheet" href="css/style.css" />
  21 + <style>
  22 + body{ background-color: #fff }
  23 + .title{padding:15px;}
  24 + .question{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width: 200px;}
  25 + .erro_list table{display:inline;}
  26 + </style>
  27 + <!--[if IE]>
  28 + <script src="http://libs.baidu.com/html5shiv/3.7/html5shiv.min.js"></script>
  29 + <![endif]-->
  30 + <script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
  31 + <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  32 +</head>
  33 +<body>
  34 + <div class="container content">
  35 + <p class="bg-primary title" style="margin-top:20px">考试</p>
  36 + <table class="table table-hover">
  37 + <thead>
  38 + <col width="10%" />
  39 + <col width="20%" />
  40 + <col width="10%" />
  41 + <col width="10%" />
  42 + <col width="10%" />
  43 + <col width="10%" />
  44 + <col width="20%" />
  45 + <col width="10%" />
  46 + <tr>
  47 + <th>序号</th>
  48 + <th>测验标题</th>
  49 + <th>班级</th>
  50 + <th>班级平均分</th>
  51 + <th>测验总分</th>
  52 + <th>得分率</th>
  53 + <th>测验时间</th>
  54 + <th>操作</th>
  55 + </tr>
  56 + </thead>
  57 + <tbody class="test_list">
  58 + <!--测验列表-->
  59 + </tbody>
  60 + </table>
  61 + <p class="bg-primary title">错题</p>
  62 + <table class="table table-hover">
  63 + <thead>
  64 + <col width="10%" />
  65 + <col width="20%" />
  66 + <col width="20%" />
  67 + <col width="20%" />
  68 + <col width="20%" />
  69 + <col width="10%" />
  70 + <tr>
  71 + <th>序号</th>
  72 + <th>题目</th>
  73 + <th>错误率</th>
  74 + <th>测试名称</th>
  75 + <th>测试时间</th>
  76 + <th>操作</th>
  77 + </tr>
  78 + </thead>
  79 + <tbody class="erro_list">
  80 + <!--错题列表-->
  81 + </tbody>
  82 + </table>
  83 + </div>
  84 + <script>
  85 + $(document).ready(function(){
  86 + var test_html="";
  87 + var erro_html="";
  88 + $.ajax({
  89 + url:"/SunvoteEducation/api/v1/testpaper",
  90 + async : false,
  91 + type:"post",
  92 + data:{user_id:"8dbef15bb6d043ec94b719ede583b033"},
  93 + success:function(data){
  94 + for(var i=0;i<5;i++){
  95 + if(data.data[i].avgScore=="")
  96 + var avgScore=0;
  97 + else
  98 + var avgScore=parseInt(data.data[i].avgScore);
  99 + if(data.data[i].totalScore==null||data.data[i].totalScore==0){
  100 + var totalScore=0;
  101 + var scoringRate=0;
  102 + }
  103 + else{
  104 + var totalScore=parseInt(data.data[i].totalScore);
  105 + var scoringRate=avgScore/totalScore;
  106 + }
  107 + 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>';
  108 + }
  109 + $(".test_list").html(test_html);
  110 + }
  111 + });
  112 + $.ajax({
  113 + url:"/SunvoteEducation/api/v1/wrongquestion",
  114 + async : false,
  115 + type:"post",
  116 + data:{start_date:"",end_date:"",count:"5"},
  117 + success:function(data){
  118 + for(var i=0;i<5;i++){
  119 + 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>';
  120 + }
  121 + $(".erro_list").html(erro_html);
  122 + $(".erro_list img").remove();
  123 + $(".erro_list table").remove();
  124 + }
  125 + })
  126 + })
  127 + function getClassName(id) { // 获取班级中文名
  128 + var className = "";
  129 + $.ajax({
  130 + url : "/SunvoteEducation/api/v1/classname",
  131 + async : false,
  132 + type : "post",
  133 + data : {
  134 + id : id
  135 + },
  136 + success : function(data) {
  137 + className = data.data;
  138 + },
  139 + error: function (XMLHttpRequest, textStatus, errorThrown) {
  140 + // 错误信息
  141 + alert("状态码:"+XMLHttpRequest.status+"状态:"+XMLHttpRequest.readyState+"错误信息:"+textStatus+"");
  142 + window.top.loading.remove();
  143 + }
  144 + })
  145 + return className;
  146 + }
  147 +
  148 + </script>
  149 +</body>
  150 +</html>
0 151 \ No newline at end of file
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... ... @@ -118,7 +118,7 @@
118 118 </div>
119 119 </div>
120 120 <div class="content_r">
121   - <iframe name="mainFrame" id="mainFrame" frameborder="0" src="../paper/list2.do?" width="100%" height="100%"></iframe>
  121 + <iframe name="mainFrame" id="mainFrame" frameborder="0" src="../teacher/index.do?" width="100%" height="100%"></iframe>
122 122  
123 123 </div>
124 124  
... ...
src/com/fh/controller/sunvote/teacher/TeacherController.java
... ... @@ -296,6 +296,23 @@ public class TeacherController extends BaseController {
296 296 mv.addObject("QX", Jurisdiction.getHC()); // 按钮权限
297 297 return mv;
298 298 }
  299 +
  300 + /**
  301 + * 列表
  302 + *
  303 + * @param page
  304 + * @throws Exception
  305 + */
  306 + @RequestMapping(value = "/index")
  307 + public ModelAndView index() throws Exception {
  308 + logBefore(logger, Jurisdiction.getUsername() + "列表Teacher");
  309 + // if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;}
  310 + // //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
  311 + ModelAndView mv = this.getModelAndView();
  312 + mv.setViewName("sunvote/teacher/indexPage");
  313 + mv.addObject("pd", this.getPageData());
  314 + return mv;
  315 + }
299 316  
300 317 /**
301 318 * 去新增页面
... ...