Commit a51b67cfeee628d398ce73d12256e54d1f393f97

Authored by 孙向锦
1 parent 28147ecc

交互第一个版本

WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
... ... @@ -216,6 +216,7 @@
216 216 <script>
217 217 var testData = ${pd.JSON};
218 218 var URL = "<%=basePath%>api/v1/uploadpaper";
  219 + var JUMP_URL = "<%=basePath%>/main/teacher";
219 220 if(testData.questions.length>0){
220 221 $("title").html("浏览试卷");
221 222 }
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... ... @@ -98,7 +98,7 @@
98 98 <div class="test">测验</div>
99 99 <div class="analysis">分析</div>
100 100 </div>
101   - <div style="width:70%;height:100%;margin-left:30%;">
  101 + <div style="width:70%;height:100%;margin-left:30%;" class="content_r">
102 102 <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe>
103 103 </div>
104 104 </div>
... ... @@ -198,9 +198,16 @@
198 198 $("#time_submit").click(function(){
199 199 var name = $("#enter_title").val();
200 200 var time = $("#enter_time").val();
201   - window.open("<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time);
  201 + //window.open("<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time);
  202 + self.location.href = "<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time ;
202 203 $(".title_time").modal("hide");
203 204 });
  205 + $(".test").click(function(){
  206 + $(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" style="width:100%;height:'+$(".content_l").height()+'px;"></iframe>');
  207 + })
  208 + $(".analysis").click(function(){
  209 + $(".content_r").html('<img src="static/images/analysis.png" width="100%" />');
  210 + })
204 211 </script>
205 212  
206 213 </body>
... ...
WebRoot/static/css/index-style.css
1   -.content_l{width:30%;min-width:400px;}
2   -.info_box{width:100%;height:300px;background:#36c345;color:#fff;position:relative;}
3   -.info{display:table;width:70%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;}
4   -.info_l{width:120px;height:120px;float:left;border-radius:100px;overflow:hidden;position:relative;}
5   -.info_l img{width:100%;position:absolute;top:0;min-height:100%;}
6   -.info_r{margin-left:150px;}
7   -.info_r p{width:100%;text-align:left;}
8   -.info_r p:first-child{font-size:24px;}
9   -.class{background:#36c333;color:#fff;margin-top:12px;}
10   -.class p{margin:0;line-height:3em;box-sizing:border-box;padding-left:3em;font-size:20px;}
11   -.test{background:#36b733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
12   -.analysis{background:#36a733;font-size:32px;text-align:center;color:#fff;padding:3% 0;letter-spacing:1em;margin-top:12px;}
  1 +.content_l {
  2 + width: 30%;
  3 + min-width: 400px;
  4 +}
  5 +
  6 +.info_box {
  7 + width: 100%;
  8 + height: 300px;
  9 + background: #36c345;
  10 + color: #fff;
  11 + position: relative;
  12 +}
  13 +
  14 +.info {
  15 + display: table;
  16 + width: 70%;
  17 + position: absolute;
  18 + top: 0;
  19 + bottom: 0;
  20 + left: 0;
  21 + right: 0;
  22 + margin: auto;
  23 +}
  24 +
  25 +.info_l {
  26 + width: 120px;
  27 + height: 120px;
  28 + float: left;
  29 + border-radius: 100px;
  30 + overflow: hidden;
  31 + position: relative;
  32 +}
  33 +
  34 +.info_l img {
  35 + width: 100%;
  36 + position: absolute;
  37 + top: 0;
  38 + min-height: 100%;
  39 +}
  40 +
  41 +.info_r {
  42 + margin-left: 150px;
  43 + position: absolute;
  44 + top: 0;
  45 + bottom: 0;
  46 + margin: auto;
  47 + left: 150px;
  48 + right: 0;
  49 + display: table;
  50 +}
  51 +
  52 +.info_r p {
  53 + width: 100%;
  54 + text-align: left;
  55 +}
  56 +
  57 +.info_r p:first-child {
  58 + font-size: 24px;
  59 +}
  60 +
  61 +.class {
  62 + background: #36c333;
  63 + color: #fff;
  64 + margin-top: 12px;
  65 +}
  66 +
  67 +.class p {
  68 + margin: 0;
  69 + line-height: 3em;
  70 + box-sizing: border-box;
  71 + text-align:center;
  72 + font-size: 20px;
  73 +}
  74 +
  75 +.test {
  76 + background: #36b733;
  77 + font-size: 32px;
  78 + text-align: center;
  79 + color: #fff;
  80 + padding: 3% 0;
  81 + letter-spacing: 1em;
  82 + margin-top: 12px;
  83 +}
  84 +
  85 +.analysis {
  86 + background: #36a733;
  87 + font-size: 32px;
  88 + text-align: center;
  89 + color: #fff;
  90 + padding: 3% 0;
  91 + letter-spacing: 1em;
  92 + margin-top: 12px;
  93 +}
13 94 \ No newline at end of file
... ...
WebRoot/static/js/control.js
... ... @@ -212,10 +212,10 @@
212 212 var data={
213 213 title: $(".text-center").html(),
214 214 exam_time: parseInt($("#time").text()),
215   - paper_type: "1",
216   - subject_id: "1",
217   - grade_id: "1",
218   - user_id: "1",
  215 + paper_type: testData.paper_type,
  216 + subject_id: testData.subject_id,
  217 + grade_id: testData.grade_id,
  218 + user_id: testData.user_id,
219 219 score:score,
220 220 questions:[]
221 221 }
... ... @@ -292,8 +292,9 @@ function ajax_submit(url,data){
292 292 success:function(data){
293 293 flag=1;
294 294 $(".loading").css("display","none");
295   - alert("保存成功");
296   - window.close();
  295 +// alert("保存成功");
  296 +// window.close();
  297 + window.location.href = JUMP_URL ;
297 298 }
298 299 })
299 300 return flag;
... ... @@ -340,6 +341,7 @@ function fastSort(array,head,tail){
340 341 function creatHtml(data){
341 342 console.log(data);
342 343 if(data.questions.length>0){
  344 + $(".time").removeAttr("data-target");
343 345 $(".btn_box").remove();
344 346 }
345 347 $(".header_box h1").html(data.title);
... ...
resources/mybatis1/api/V1Mapper.xml
... ... @@ -127,9 +127,13 @@
127 127 SELECT
128 128 sv_teacher.`NAME` AS TEACHER_NAME,
129 129 sv_grade.`NAME` AS GRADE_NAME,
  130 + sv_grade.ID AS GRADE_ID,
130 131 sv_sclass.CLASS_NAME AS CLASS_NAME,
  132 + sv_sclass.ID AS CLASS_ID,
131 133 sv_subject.CNAME AS SUBJECT_NAME,
132   - sv_school.`NAME` as SCHOOL_NAME
  134 + sv_subject.ID AS SUBJECT_ID,
  135 + sv_school.`NAME` as SCHOOL_NAME,
  136 + sv_school.ID AS SCHOOL_ID
133 137 FROM
134 138 sv_coursemanagement AS couse
135 139 LEFT JOIN sv_term AS term ON couse.TERM_ID = term.TERM_ID
... ...
resources/mybatis1/sunvote/PaperMapper.xml
... ... @@ -122,6 +122,10 @@
122 122 )
123 123 </if>
124 124  
  125 + <if test="pd.USER_ID != null and pd.USER_ID != ''"><!-- 关键词检索 -->
  126 + and USER_ID = #{pd.USER_ID}
  127 + </if>
  128 +
125 129 order by CREATE_DATE DESC
126 130 </select>
127 131  
... ...
src/com/fh/controller/base/BaseController.java
... ... @@ -82,5 +82,55 @@ public class BaseController {
82 82 return "ERROR";
83 83 }
84 84  
  85 + public String getUserID(){
  86 + Session session = Jurisdiction.getSession();
  87 + User user = (User)session.getAttribute(Const.SESSION_USER);
  88 + if(user != null){
  89 + return user.getUSER_ID();
  90 + }
  91 + return "ERROR";
  92 + }
  93 +
  94 +
  95 + public String getSchoolID(){
  96 + Session session = Jurisdiction.getSession();
  97 + String schoolName = (String)session.getAttribute(getUsername() + Const.SCHOOL_ID);
  98 + return schoolName;
  99 + }
  100 + public String getSchoolName(){
  101 + Session session = Jurisdiction.getSession();
  102 + String schoolName = (String)session.getAttribute(getUsername() + Const.SCHOOL_NAME);
  103 + return schoolName;
  104 + }
  105 + public String getGradeID(){
  106 + Session session = Jurisdiction.getSession();
  107 + String schoolName = (String)session.getAttribute(getUsername() + Const.GRADE_ID);
  108 + return schoolName;
  109 + }
  110 + public String getGradeName(){
  111 + Session session = Jurisdiction.getSession();
  112 + String schoolName = (String)session.getAttribute(getUsername() + Const.GRADE_NAME);
  113 + return schoolName;
  114 + }
  115 + public String getSubjectId(){
  116 + Session session = Jurisdiction.getSession();
  117 + String schoolName = (String)session.getAttribute(getUsername() + Const.SUBJECT_ID);
  118 + return schoolName;
  119 + }
  120 + public String getSubjectName(){
  121 + Session session = Jurisdiction.getSession();
  122 + String schoolName = (String)session.getAttribute(getUsername() + Const.SUBJECT_NAME);
  123 + return schoolName;
  124 + }
  125 + public String getClassId(){
  126 + Session session = Jurisdiction.getSession();
  127 + String schoolName = (String)session.getAttribute(getUsername() + Const.CLASS_ID);
  128 + return schoolName;
  129 + }
  130 + public String getClassName(){
  131 + Session session = Jurisdiction.getSession();
  132 + String schoolName = (String)session.getAttribute(getUsername() + Const.CLASS_NAME);
  133 + return schoolName;
  134 + }
85 135  
86 136 }
... ...
src/com/fh/controller/sunvote/paper/PaperController.java
... ... @@ -243,8 +243,8 @@ public class PaperController extends BaseController {
243 243 User user = (User)session.getAttribute(Const.SESSION_USER);
244 244 paper.setUser_id(user.getUSER_ID());
245 245 paper.setPaper_type("1");
246   - paper.setSubject_id("1");
247   - paper.setGrade_id("1");
  246 + paper.setSubject_id(getSubjectId());
  247 + paper.setGrade_id(getGradeID());
248 248 paper.setQuestions(new ArrayList<Question>());
249 249 pd.put("JSON", paper.toJson());
250 250 logger.info(paper.toJson());
... ... @@ -272,6 +272,8 @@ public class PaperController extends BaseController {
272 272 if(null != keywords && !"".equals(keywords)){
273 273 pd.put("keywords", keywords.trim());
274 274 }
  275 + String userID = getUserID();
  276 + pd.put("USER_ID", userID);
275 277 page.setPd(pd);
276 278 List<PageData> varList = paperService.list(page); //列出Paper列表
277 279 mv.setViewName("sunvote/paper/paper_list2");
... ...
src/com/fh/controller/sunvote/teacher/TeacherController.java
... ... @@ -64,8 +64,8 @@ public class TeacherController extends BaseController {
64 64 if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限
65 65 ModelAndView mv = this.getModelAndView();
66 66 PageData pd = new PageData();
67   - pd.put("ID", this.get32UUID());
68 67 pd = this.getPageData();
  68 + pd.put("ID", this.get32UUID());
69 69 teacherService.save(pd);
70 70  
71 71 pd.put("USER_ID", pd.getString("ID")); //ID 主键
... ...
src/com/fh/controller/system/login/LoginController.java
... ... @@ -220,6 +220,25 @@ public class LoginController extends BaseController {
220 220 tpd.put("ID", user.getUSER_ID());
221 221 List<PageData> teacherInfos = v1Service.getTeacherInfo(tpd);
222 222 pd.put("TEACHER", teacherInfos);
  223 + if (teacherInfos != null && teacherInfos.size() > 0) {
  224 + PageData sData = teacherInfos.get(0);
  225 + session.setAttribute(USERNAME + Const.SCHOOL_ID,
  226 + sData.get("SCHOOL_ID"));
  227 + session.setAttribute(USERNAME + Const.SCHOOL_NAME,
  228 + sData.get("SCHOOL_NAME"));
  229 + session.setAttribute(USERNAME + Const.GRADE_ID,
  230 + sData.get("GRADE_ID"));
  231 + session.setAttribute(USERNAME + Const.GRADE_NAME,
  232 + sData.get("GRADE_NAME"));
  233 + session.setAttribute(USERNAME + Const.CLASS_ID,
  234 + sData.get("CLASS_ID"));
  235 + session.setAttribute(USERNAME + Const.CLASS_NAME,
  236 + sData.get("CLASS_NAME"));
  237 + session.setAttribute(USERNAME + Const.SUBJECT_ID,
  238 + sData.get("SUBJECT_ID"));
  239 + session.setAttribute(USERNAME + Const.SUBJECT_NAME,
  240 + sData.get("SUBJECT_NAME"));
  241 + }
223 242 mv.setViewName("sunvote/teacher/teacher_main");
224 243 }
225 244 mv.addObject("user", user);
... ...
src/com/fh/util/Const.java
... ... @@ -16,6 +16,16 @@ public class Const {
16 16 public static final String DEPARTMENT_IDS = "DEPARTMENT_IDS"; //当前用户拥有的最高部门权限集合
17 17 public static final String DEPARTMENT_ID = "DEPARTMENT_ID"; //当前用户拥有的最高部门权限
18 18 public static final String TRUE = "T";
  19 +
  20 + public static final String SCHOOL_ID = "SCHOOL_ID";
  21 + public static final String SCHOOL_NAME = "SCHOOL_NAME";
  22 + public static final String GRADE_ID = "GRADE_ID";
  23 + public static final String GRADE_NAME = "GRADE_NAME";
  24 + public static final String CLASS_ID = "CLASS_ID";
  25 + public static final String CLASS_NAME = "CLASS_NAME";
  26 + public static final String SUBJECT_ID = "SUBJECT_ID";
  27 + public static final String SUBJECT_NAME = "SUBJECT_NAME";
  28 +
19 29 public static final String FALSE = "F";
20 30 public static final String LOGIN = "/login_toLogin.do"; //登录地址
21 31 public static final String SYSNAME = "admin/config/SYSNAME.txt"; //系统名称路径
... ...