Commit a51b67cfeee628d398ce73d12256e54d1f393f97
1 parent
28147ecc
交互第一个版本
Showing
11 changed files
with
204 additions
and
24 deletions
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
@@ -216,6 +216,7 @@ | @@ -216,6 +216,7 @@ | ||
216 | <script> | 216 | <script> |
217 | var testData = ${pd.JSON}; | 217 | var testData = ${pd.JSON}; |
218 | var URL = "<%=basePath%>api/v1/uploadpaper"; | 218 | var URL = "<%=basePath%>api/v1/uploadpaper"; |
219 | + var JUMP_URL = "<%=basePath%>/main/teacher"; | ||
219 | if(testData.questions.length>0){ | 220 | if(testData.questions.length>0){ |
220 | $("title").html("浏览试卷"); | 221 | $("title").html("浏览试卷"); |
221 | } | 222 | } |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
@@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
98 | <div class="test">测验</div> | 98 | <div class="test">测验</div> |
99 | <div class="analysis">分析</div> | 99 | <div class="analysis">分析</div> |
100 | </div> | 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 | <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe> | 102 | <iframe name="mainFrame" id="mainFrame" frameborder="0" src="paper/list2.do?" ></iframe> |
103 | </div> | 103 | </div> |
104 | </div> | 104 | </div> |
@@ -198,9 +198,16 @@ | @@ -198,9 +198,16 @@ | ||
198 | $("#time_submit").click(function(){ | 198 | $("#time_submit").click(function(){ |
199 | var name = $("#enter_title").val(); | 199 | var name = $("#enter_title").val(); |
200 | var time = $("#enter_time").val(); | 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 | $(".title_time").modal("hide"); | 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 | </script> | 211 | </script> |
205 | 212 | ||
206 | </body> | 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 | \ No newline at end of file | 94 | \ No newline at end of file |
WebRoot/static/js/control.js
@@ -212,10 +212,10 @@ | @@ -212,10 +212,10 @@ | ||
212 | var data={ | 212 | var data={ |
213 | title: $(".text-center").html(), | 213 | title: $(".text-center").html(), |
214 | exam_time: parseInt($("#time").text()), | 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 | score:score, | 219 | score:score, |
220 | questions:[] | 220 | questions:[] |
221 | } | 221 | } |
@@ -292,8 +292,9 @@ function ajax_submit(url,data){ | @@ -292,8 +292,9 @@ function ajax_submit(url,data){ | ||
292 | success:function(data){ | 292 | success:function(data){ |
293 | flag=1; | 293 | flag=1; |
294 | $(".loading").css("display","none"); | 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 | return flag; | 300 | return flag; |
@@ -340,6 +341,7 @@ function fastSort(array,head,tail){ | @@ -340,6 +341,7 @@ function fastSort(array,head,tail){ | ||
340 | function creatHtml(data){ | 341 | function creatHtml(data){ |
341 | console.log(data); | 342 | console.log(data); |
342 | if(data.questions.length>0){ | 343 | if(data.questions.length>0){ |
344 | + $(".time").removeAttr("data-target"); | ||
343 | $(".btn_box").remove(); | 345 | $(".btn_box").remove(); |
344 | } | 346 | } |
345 | $(".header_box h1").html(data.title); | 347 | $(".header_box h1").html(data.title); |
resources/mybatis1/api/V1Mapper.xml
@@ -127,9 +127,13 @@ | @@ -127,9 +127,13 @@ | ||
127 | SELECT | 127 | SELECT |
128 | sv_teacher.`NAME` AS TEACHER_NAME, | 128 | sv_teacher.`NAME` AS TEACHER_NAME, |
129 | sv_grade.`NAME` AS GRADE_NAME, | 129 | sv_grade.`NAME` AS GRADE_NAME, |
130 | + sv_grade.ID AS GRADE_ID, | ||
130 | sv_sclass.CLASS_NAME AS CLASS_NAME, | 131 | sv_sclass.CLASS_NAME AS CLASS_NAME, |
132 | + sv_sclass.ID AS CLASS_ID, | ||
131 | sv_subject.CNAME AS SUBJECT_NAME, | 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 | FROM | 137 | FROM |
134 | sv_coursemanagement AS couse | 138 | sv_coursemanagement AS couse |
135 | LEFT JOIN sv_term AS term ON couse.TERM_ID = term.TERM_ID | 139 | LEFT JOIN sv_term AS term ON couse.TERM_ID = term.TERM_ID |
resources/mybatis1/sunvote/PaperMapper.xml
@@ -122,6 +122,10 @@ | @@ -122,6 +122,10 @@ | ||
122 | ) | 122 | ) |
123 | </if> | 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 | order by CREATE_DATE DESC | 129 | order by CREATE_DATE DESC |
126 | </select> | 130 | </select> |
127 | 131 |
src/com/fh/controller/base/BaseController.java
@@ -82,5 +82,55 @@ public class BaseController { | @@ -82,5 +82,55 @@ public class BaseController { | ||
82 | return "ERROR"; | 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,8 +243,8 @@ public class PaperController extends BaseController { | ||
243 | User user = (User)session.getAttribute(Const.SESSION_USER); | 243 | User user = (User)session.getAttribute(Const.SESSION_USER); |
244 | paper.setUser_id(user.getUSER_ID()); | 244 | paper.setUser_id(user.getUSER_ID()); |
245 | paper.setPaper_type("1"); | 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 | paper.setQuestions(new ArrayList<Question>()); | 248 | paper.setQuestions(new ArrayList<Question>()); |
249 | pd.put("JSON", paper.toJson()); | 249 | pd.put("JSON", paper.toJson()); |
250 | logger.info(paper.toJson()); | 250 | logger.info(paper.toJson()); |
@@ -272,6 +272,8 @@ public class PaperController extends BaseController { | @@ -272,6 +272,8 @@ public class PaperController extends BaseController { | ||
272 | if(null != keywords && !"".equals(keywords)){ | 272 | if(null != keywords && !"".equals(keywords)){ |
273 | pd.put("keywords", keywords.trim()); | 273 | pd.put("keywords", keywords.trim()); |
274 | } | 274 | } |
275 | + String userID = getUserID(); | ||
276 | + pd.put("USER_ID", userID); | ||
275 | page.setPd(pd); | 277 | page.setPd(pd); |
276 | List<PageData> varList = paperService.list(page); //列出Paper列表 | 278 | List<PageData> varList = paperService.list(page); //列出Paper列表 |
277 | mv.setViewName("sunvote/paper/paper_list2"); | 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,8 +64,8 @@ public class TeacherController extends BaseController { | ||
64 | if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 | 64 | if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 |
65 | ModelAndView mv = this.getModelAndView(); | 65 | ModelAndView mv = this.getModelAndView(); |
66 | PageData pd = new PageData(); | 66 | PageData pd = new PageData(); |
67 | - pd.put("ID", this.get32UUID()); | ||
68 | pd = this.getPageData(); | 67 | pd = this.getPageData(); |
68 | + pd.put("ID", this.get32UUID()); | ||
69 | teacherService.save(pd); | 69 | teacherService.save(pd); |
70 | 70 | ||
71 | pd.put("USER_ID", pd.getString("ID")); //ID 主键 | 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,6 +220,25 @@ public class LoginController extends BaseController { | ||
220 | tpd.put("ID", user.getUSER_ID()); | 220 | tpd.put("ID", user.getUSER_ID()); |
221 | List<PageData> teacherInfos = v1Service.getTeacherInfo(tpd); | 221 | List<PageData> teacherInfos = v1Service.getTeacherInfo(tpd); |
222 | pd.put("TEACHER", teacherInfos); | 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 | mv.setViewName("sunvote/teacher/teacher_main"); | 242 | mv.setViewName("sunvote/teacher/teacher_main"); |
224 | } | 243 | } |
225 | mv.addObject("user", user); | 244 | mv.addObject("user", user); |
src/com/fh/util/Const.java
@@ -16,6 +16,16 @@ public class Const { | @@ -16,6 +16,16 @@ public class Const { | ||
16 | public static final String DEPARTMENT_IDS = "DEPARTMENT_IDS"; //当前用户拥有的最高部门权限集合 | 16 | public static final String DEPARTMENT_IDS = "DEPARTMENT_IDS"; //当前用户拥有的最高部门权限集合 |
17 | public static final String DEPARTMENT_ID = "DEPARTMENT_ID"; //当前用户拥有的最高部门权限 | 17 | public static final String DEPARTMENT_ID = "DEPARTMENT_ID"; //当前用户拥有的最高部门权限 |
18 | public static final String TRUE = "T"; | 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 | public static final String FALSE = "F"; | 29 | public static final String FALSE = "F"; |
20 | public static final String LOGIN = "/login_toLogin.do"; //登录地址 | 30 | public static final String LOGIN = "/login_toLogin.do"; //登录地址 |
21 | public static final String SYSNAME = "admin/config/SYSNAME.txt"; //系统名称路径 | 31 | public static final String SYSNAME = "admin/config/SYSNAME.txt"; //系统名称路径 |