Commit 32d27bdca487b8120195eb88a454b42b5b31e4c4
1 parent
5f403333
1.增加判断题和数字题,调试更改上传数据
2、更换logo等信息
Showing
8 changed files
with
264 additions
and
219 deletions
WebRoot/WEB-INF/jsp/sunvote/admin/admin_main.jsp
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <meta charset="utf-8"> |
15 | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | |
17 | +<title>教育管理系统</title> | |
18 | 18 | |
19 | 19 | <!-- Bootstrap --> |
20 | 20 | <!-- <link |
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | <body> |
40 | 40 | <div class="header"> |
41 | 41 | <div class="logo"> |
42 | - <img src="../static/images/logo.png" /> | |
42 | + <img src="../static/images/logo1.png" /> | |
43 | 43 | </div> |
44 | 44 | <div class="out"> |
45 | 45 | <a href="../logout"><img src="../static/images/close.png" />退出登录</a> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
... | ... | @@ -110,8 +110,8 @@ |
110 | 110 | <div class="col-sm-10"> |
111 | 111 | <select class="form-control" id="type"> |
112 | 112 | <option value="1" selected>单选题</option> |
113 | - <option value="2">完形填空</option> | |
114 | - <option value="3">阅读理解</option> | |
113 | + <!-- <option value="2">完形填空</option> | |
114 | + <option value="3">阅读理解</option> --> | |
115 | 115 | <option value="4">判断题</option> |
116 | 116 | <option value="5">多选题</option> |
117 | 117 | <option value="6">数字题</option> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <meta charset="utf-8"> |
15 | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | |
17 | +<title>教育管理系统</title> | |
18 | 18 | |
19 | 19 | <!-- Bootstrap --> |
20 | 20 | <link href="../static/css/bootstrap.min.css" rel="stylesheet"> |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | <body> |
37 | 37 | <div class="header"> |
38 | 38 | <div class="logo"> |
39 | - <img src="../static/images/logo.png" /> | |
39 | + <img src="../static/images/logo1.png" /> | |
40 | 40 | </div> |
41 | 41 | <div class="out"> |
42 | 42 | <a href="../logout"><img src="../static/images/close.png" />退出登录</a> |
... | ... | @@ -269,7 +269,7 @@ |
269 | 269 | }); |
270 | 270 | |
271 | 271 | $("#qingsongkao_paper").click(function() { |
272 | - var path = "../paper/list2.do?SCHOOL_ID=${pd.TEACHER.SCHOOL_ID}"; | |
272 | + var path = "../paper/list2.do?SCHOOL_ID=${pd.TEACHER.SCHOOL_ID}&SUBJECT_ID=${pd.TEACHER.SUBJECT_ID}"; | |
273 | 273 | //$(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" style="width:100%;height:'+$(".content_l").height()+'px;" src=' + path + '></iframe>'); |
274 | 274 | if ($("#mainFrame").attr('src') != (path)) { |
275 | 275 | $("#mainFrame").attr('src', path); |
... | ... | @@ -285,7 +285,7 @@ |
285 | 285 | //} |
286 | 286 | }); |
287 | 287 | |
288 | - var defaultUrl = '${pd.DEFAULTURL}?SCHOOL_ID=${pd.TEACHER.SCHOOL_ID}'; | |
288 | + var defaultUrl = '${pd.DEFAULTURL}?SCHOOL_ID=${pd.TEACHER.SCHOOL_ID}&SUBJECT_ID=${pd.TEACHER.SUBJECT_ID}'; | |
289 | 289 | if (defaultUrl != '' && defaultUrl != '') { |
290 | 290 | $("#mainFrame").attr('src', defaultUrl); |
291 | 291 | } | ... | ... |
WebRoot/WEB-INF/jsp/system/index/login.jsp
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | <meta charset="utf-8"> |
15 | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | |
17 | +<title>教育管理系统</title> | |
18 | 18 | |
19 | 19 | <!-- Bootstrap --> |
20 | 20 | <link href="static/css/bootstrap.min.css" rel="stylesheet"> |
... | ... | @@ -69,7 +69,7 @@ body{ |
69 | 69 | <body> |
70 | 70 | <div class="content"> |
71 | 71 | <div class="content_t"> |
72 | - <img src="static/login/title.png" alt="SunVote" /> | |
72 | + <img src="static/login/title1.png" alt="SunVote" /> | |
73 | 73 | </div> |
74 | 74 | <div class="content_b"> |
75 | 75 | <div class="form_box"> | ... | ... |
WebRoot/static/js/control-604.js
1 | 1 | var questionNUm = 0; |
2 | -/*数字转汉字数字*/ | |
2 | +/* 数字转汉字数字 */ | |
3 | 3 | var chnNumChar = [ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ]; |
4 | 4 | var chnUnitSection = [ "", "万", "亿", "万亿", "亿亿" ]; |
5 | 5 | var chnUnitChar = [ "", "十", "百", "千" ]; |
... | ... | @@ -8,9 +8,7 @@ var score = 0; |
8 | 8 | var total_score = 0; |
9 | 9 | var answerLen = 0; |
10 | 10 | |
11 | - | |
12 | 11 | $(function() { |
13 | - | |
14 | 12 | |
15 | 13 | function creat(str_ans, a_num, fraction) { |
16 | 14 | // $(".section").remove(); |
... | ... | @@ -31,9 +29,22 @@ $(function() { |
31 | 29 | } |
32 | 30 | } |
33 | 31 | q_num = str.length; |
34 | - $(".content").append('<div class="section section-' + answer_index_b+ ' single" data-fraction="'+ fraction+ '" data-score="' | |
35 | - + (q_num * fraction) + '" style="margin-top:80px;"><div class="title"><h3>第' + answer_index_b+ '大题(单选)总分: ' | |
36 | - + q_num + ' X ' + fraction + ' = ' + (q_num * fraction) | |
32 | + $(".content") | |
33 | + .append( | |
34 | + '<div class="section section-' | |
35 | + + answer_index_b | |
36 | + + ' single" data-fraction="' | |
37 | + + fraction | |
38 | + + '" data-score="' | |
39 | + + (q_num * fraction) | |
40 | + + '" style="margin-top:80px;"><div class="title"><h3>第' | |
41 | + + answer_index_b | |
42 | + + '大题(单选)总分: ' | |
43 | + + q_num | |
44 | + + ' X ' | |
45 | + + fraction | |
46 | + + ' = ' | |
47 | + + (q_num * fraction) | |
37 | 48 | + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); |
38 | 49 | for (var i = 0; i < q_num; i++) { |
39 | 50 | str_temp = str[i]; |
... | ... | @@ -65,14 +76,13 @@ $(function() { |
65 | 76 | // return; |
66 | 77 | } |
67 | 78 | } |
68 | - $(".section-" + answer_index_b).attr("data-score", | |
69 | - q_num * fraction); | |
79 | + $(".section-" + answer_index_b).attr("data-score", q_num * fraction); | |
70 | 80 | total_score += q_num * fraction; |
71 | 81 | $("#score_all").text(total_score); |
72 | 82 | } |
73 | 83 | |
74 | 84 | /*************************************************************************** |
75 | - * 1、单选题 2、完形填空 3、阅读理解 4、判断题 5、多选题 | |
85 | + * 1、单选题 2、完形填空 3、阅读理解 4、判断题 5、多选题 6、数字题 | |
76 | 86 | **************************************************************************/ |
77 | 87 | |
78 | 88 | function addQuestion(type, a_num, index_s_2, index_e_2, fraction2) { |
... | ... | @@ -86,9 +96,11 @@ $(function() { |
86 | 96 | .append( |
87 | 97 | '<div class="section section-' |
88 | 98 | + answer_index_b |
89 | - + ' single" data-fraction="' | |
99 | + + ' single" data-type="1" data-fraction="' | |
90 | 100 | + fraction2 |
91 | - + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
101 | + + '" data-score="' | |
102 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
103 | + + '"> <div class="title"> <h3><span class="que_num">' | |
92 | 104 | + question_num |
93 | 105 | + '、</span>' |
94 | 106 | + '<span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); |
... | ... | @@ -104,15 +116,19 @@ $(function() { |
104 | 116 | + '</li>'); |
105 | 117 | } |
106 | 118 | } |
119 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
120 | + $("#score_all").text(total_score); | |
107 | 121 | break; |
108 | 122 | case 2: // 完形填空 |
109 | 123 | $(".content") |
110 | 124 | .append( |
111 | 125 | '<div class="section section-' |
112 | 126 | + answer_index_b |
113 | - + ' single" data-fraction="' | |
127 | + + ' single" data-type="2" data-fraction="' | |
114 | 128 | + fraction2 |
115 | - + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
129 | + + '" data-score="' | |
130 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
131 | + + '"> <div class="title"> <h3><span class="que_num">' | |
116 | 132 | + question_num |
117 | 133 | + '、</span><span class="que_name">完形填空</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); |
118 | 134 | for (var i = index_s_2; i <= index_e_2; i++) { |
... | ... | @@ -127,15 +143,19 @@ $(function() { |
127 | 143 | + '</li>'); |
128 | 144 | } |
129 | 145 | } |
146 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
147 | + $("#score_all").text(total_score); | |
130 | 148 | break; |
131 | 149 | case 3: // 阅读理解 |
132 | 150 | $(".content") |
133 | 151 | .append( |
134 | 152 | '<div class="section section-' |
135 | 153 | + answer_index_b |
136 | - + ' single" data-fraction="' | |
154 | + + ' single" data-type="3" data-fraction="' | |
137 | 155 | + fraction2 |
138 | - + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
156 | + + '" data-score="' | |
157 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
158 | + + '"> <div class="title"> <h3><span class="que_num">' | |
139 | 159 | + question_num |
140 | 160 | + '、</span><span class="que_name">阅读理解</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); |
141 | 161 | for (var i = index_s_2; i <= index_e_2; i++) { |
... | ... | @@ -150,15 +170,19 @@ $(function() { |
150 | 170 | + '</li>'); |
151 | 171 | } |
152 | 172 | } |
173 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
174 | + $("#score_all").text(total_score); | |
153 | 175 | break; |
154 | 176 | case 4: // 判断题 |
155 | 177 | $(".content") |
156 | 178 | .append( |
157 | 179 | '<div class="section section-' |
158 | 180 | + answer_index_b |
159 | - + ' single" data-fraction="' | |
181 | + + ' single" data-type="4" data-fraction="' | |
160 | 182 | + fraction2 |
161 | - + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
183 | + + '" data-score="' | |
184 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
185 | + + '"> <div class="title"> <h3><span class="que_num">' | |
162 | 186 | + question_num |
163 | 187 | + '、</span><span class="que_name">判断题</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); |
164 | 188 | for (var i = index_s_2; i <= index_e_2; i++) { |
... | ... | @@ -176,6 +200,8 @@ $(function() { |
176 | 200 | + '</li>'); |
177 | 201 | } |
178 | 202 | } |
203 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
204 | + $("#score_all").text(total_score); | |
179 | 205 | break; |
180 | 206 | /* |
181 | 207 | * case 5: //多选题 $(".content").append('<div class="section |
... | ... | @@ -190,77 +216,70 @@ $(function() { |
190 | 216 | * for(var j=0;j<a_num;j++){ option=String.fromCharCode(0x41+j); |
191 | 217 | * $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); } } |
192 | 218 | */ |
193 | - | |
194 | - case 5: $(".content") //多选题 | |
195 | - .append( | |
196 | - '<div class="section section-' | |
197 | - + answer_index_b | |
198 | - + ' check" data-fraction="' | |
199 | - + fraction2 | |
200 | - + '" data-score="' | |
201 | - + ((index_e_2 - index_s_2 + 1) * fraction2) | |
202 | - + '"> <div class="title"><h3>第' | |
203 | - + answer_index_b | |
204 | - + '大题(多选)总分: ' | |
205 | - + (index_e_2 - index_s_2 + 1) | |
206 | - + ' X ' | |
207 | - + fraction2 | |
208 | - + ' = ' | |
209 | - + ((index_e_2 - index_s_2 + 1) * fraction2) | |
210 | - + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
211 | - for (var i = index_s_2; i <= index_e_2; i++) { | |
212 | - questionNUm++; | |
213 | - $(".section-" + answer_index_b + " .question_list").append( | |
214 | - '<div class="question question' + questionNUm | |
215 | - + '"><span>' + questionNUm | |
216 | - + '、</span><ul></ul></div>'); | |
217 | - for (var j = 0; j < a_num; j++) { | |
218 | - option = String.fromCharCode(0x41 + j); | |
219 | - $( | |
220 | - ".section-" + answer_index_b + " .question" | |
221 | - + questionNUm + ' ul').append( | |
222 | - '<li class="btn btn-default">' + option + '</li>'); | |
223 | - } | |
224 | - } | |
225 | - total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
226 | - $("#score_all").text(total_score); | |
227 | - break; | |
228 | - case 6: // 数字题 | |
229 | - // $(".content").html(""); | |
230 | - $(".content") | |
231 | - .append( | |
232 | - '<div class="section section-' | |
233 | - + answer_index_b | |
234 | - + ' number" data-fraction="' | |
235 | - + fraction2 | |
236 | - + '" data-score="' | |
237 | - + ((index_e_2 - index_s_2 + 1) * fraction2) | |
238 | - + '"> <div class="title"><h3>第' | |
239 | - + answer_index_b | |
240 | - + '大题(数字题)总分: ' | |
241 | - + (index_e_2 - index_s_2 + 1) | |
242 | - + ' X ' | |
243 | - + fraction2 | |
244 | - + ' = ' | |
245 | - + ((index_e_2 - index_s_2 + 1) * fraction2) | |
246 | - + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
247 | - for (var i = index_s_2; i <= index_e_2; i++) { | |
248 | - questionNUm++; | |
249 | - $(".section-" + answer_index_b + " .question_list").append( | |
250 | - '<div class="question question' + questionNUm | |
251 | - + '"><span>' + questionNUm | |
219 | + | |
220 | + case 5: | |
221 | + $(".content") | |
222 | + // 多选题 | |
223 | + .append( | |
224 | + '<div class="section section-' | |
225 | + + answer_index_b | |
226 | + + ' check" data-type="5" data-fraction="' | |
227 | + + fraction2 | |
228 | + + '" data-score="' | |
229 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
230 | + + '"> <div class="title"><h3><span class="que_num">' | |
231 | + + question_num | |
232 | + + '、</span><span class="que_name">多选题</span></h3><input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
233 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
234 | + questionNUm++; | |
235 | + $(".section-" + answer_index_b + " .question_list").append( | |
236 | + '<div class="question question' + i | |
237 | + + '"><span>' + i | |
238 | + + '、</span><ul></ul></div>'); | |
239 | + for (var j = 0; j < a_num; j++) { | |
240 | + option = String.fromCharCode(0x41 + j); | |
241 | + $( | |
242 | + ".section-" + answer_index_b + " .question" | |
243 | + + questionNUm + ' ul').append( | |
244 | + '<li class="btn btn-default">' + option + '</li>'); | |
245 | + } | |
246 | + } | |
247 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
248 | + $("#score_all").text(total_score); | |
249 | + break; | |
250 | + case 6: // 数字题 | |
251 | + // $(".content").html(""); | |
252 | + $(".content") | |
253 | + .append( | |
254 | + '<div class="section section-' | |
255 | + + answer_index_b | |
256 | + + ' number" data-type="6" data-fraction="' | |
257 | + + fraction2 | |
258 | + + '" data-score="' | |
259 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
260 | + + '"> <div class="title"><h3><span class="que_num">' | |
261 | + + question_num | |
262 | + + '、</span><span class="que_name">数字题</span><!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3><input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
263 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
264 | + questionNUm++; | |
265 | + $(".section-" + answer_index_b + " .question_list") | |
266 | + .append( | |
267 | + '<div class="question question' | |
268 | + + i | |
269 | + + '"><span>' | |
270 | + + i | |
252 | 271 | + '、</span><ul><li class="btn btn-default on" contenteditable="true" onkeyup="NumberCheck(this.innerText,this)">请输入答案</li></ul></div>'); |
253 | -// for (var j = 0; j < a_num; j++) { | |
254 | -// option = String.fromCharCode(0x41 + j); | |
255 | -// $( | |
256 | -// ".section-" + answer_index_b + " .question" | |
257 | -// + questionNUm + ' ul').append( | |
258 | -// '<li class="btn btn-default">' + option + '</li>'); | |
259 | -// } | |
260 | - } | |
261 | - total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
262 | - $("#score_all").text(total_score); | |
263 | - break; | |
272 | + // for (var j = 0; j < a_num; j++) { | |
273 | + // option = String.fromCharCode(0x41 + j); | |
274 | + // $( | |
275 | + // ".section-" + answer_index_b + " .question" | |
276 | + // + questionNUm + ' ul').append( | |
277 | + // '<li class="btn btn-default">' + option + '</li>'); | |
278 | + // } | |
279 | + } | |
280 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
281 | + $("#score_all").text(total_score); | |
282 | + break; | |
264 | 283 | } |
265 | 284 | // $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); |
266 | 285 | $(".section0").attr("data-score", |
... | ... | @@ -269,10 +288,17 @@ $(function() { |
269 | 288 | |
270 | 289 | $(document).on('click', '.remove', function() { // 删除按钮 |
271 | 290 | $(this).parent().parent(".section").remove(); |
291 | + for(i=0;i<$(".section").length;i++){ | |
292 | + $(".section").eq(i).find(".que_num").text(SectionToChinese(i+1)+'、'); | |
293 | + | |
294 | + var className = $(".section").attr("class").replace(/\d+/g,i); | |
295 | + console.log(className) | |
296 | + $(".section").attr("class",className); | |
297 | + } | |
272 | 298 | }) |
273 | 299 | |
274 | 300 | $("#fast_submit").click(function() { // 点击确定,创建答案列表 |
275 | - // $("#addQuestion").attr("disabled","disabled"); | |
301 | + // $("#addQuestion").attr("disabled","disabled"); | |
276 | 302 | var answer = $("#answer").val(); |
277 | 303 | var num_ans = $("#num_ans").val(); |
278 | 304 | var fraction = $("#fraction").val(); |
... | ... | @@ -296,8 +322,8 @@ $(function() { |
296 | 322 | |
297 | 323 | /* 添加试题的确定按钮 */ |
298 | 324 | $("#addQuestion_submit").click(function() { |
299 | - $("#fast").attr("disabled","disabled"); | |
300 | - var type_2 = parseInt($("#type").val()); | |
325 | + $("#fast").attr("disabled", "disabled"); | |
326 | + var type_2 = parseInt($("#type").val()); | |
301 | 327 | var index_s_2 = 1;// parseInt($("#index_s_2").val()) |
302 | 328 | var index_e_2 = parseInt($("#index_s_2").val()); |
303 | 329 | // var answer_2=$("#answer_2").val(); |
... | ... | @@ -326,7 +352,9 @@ $(function() { |
326 | 352 | if ($("#type").val() == 4) { |
327 | 353 | $("#num_ans_2").val(2); |
328 | 354 | $("#num_ans_2").attr("disabled", "disabled"); |
329 | - } else { | |
355 | + }else if($("#type").val() == 6){ | |
356 | + $("#num_ans_2").closest(".form-group").css("display","none"); | |
357 | + }else { | |
330 | 358 | $("#num_ans_2").removeAttr("disabled"); |
331 | 359 | $("#num_ans_2").val(4); |
332 | 360 | |
... | ... | @@ -357,7 +385,9 @@ $(function() { |
357 | 385 | } |
358 | 386 | }) |
359 | 387 | /* 提交保存数据 */ |
360 | - $("#save").click(function() { | |
388 | + $("#save") | |
389 | + .click( | |
390 | + function() { | |
361 | 391 | var url = URL; |
362 | 392 | |
363 | 393 | var data = { |
... | ... | @@ -378,7 +408,7 @@ $(function() { |
378 | 408 | // rank++; |
379 | 409 | data.questions[i] = { |
380 | 410 | chapter_id : "0", |
381 | - problem_type_id : "0", | |
411 | + problem_type_id : $(".section").eq(i).attr("data-type"), | |
382 | 412 | knowledge_id : "0", |
383 | 413 | // content: |
384 | 414 | // $(".section").eq(i).find(".que_name").text(), |
... | ... | @@ -393,8 +423,7 @@ $(function() { |
393 | 423 | part_score : "", |
394 | 424 | remark : "", |
395 | 425 | rank : rank, |
396 | - no_name : $(".section").eq(i).find( | |
397 | - ".que_num").text(), | |
426 | + no_name : "",//$(".section").eq(i).find(".que_num").text(), | |
398 | 427 | questions : [] |
399 | 428 | } |
400 | 429 | for (j = 0; j < $(".section").eq(i).find( |
... | ... | @@ -409,13 +438,14 @@ $(function() { |
409 | 438 | .eq(k).text(); |
410 | 439 | // console.log(answer); |
411 | 440 | } |
412 | - if (answer == ''||answer.indexOf("请输入答案")>=0) { | |
441 | + if (answer == '' | |
442 | + || answer.indexOf("请输入答案") >= 0) { | |
413 | 443 | alert("还有试题未编辑答案。"); |
414 | 444 | return; |
415 | 445 | } |
416 | 446 | data.questions[i].questions[j] = { |
417 | 447 | chapter_id : "0", |
418 | - problem_type_id : "0", | |
448 | + problem_type_id : $(".section").eq(i).attr("data-type"),//"0",//data-type="1" | |
419 | 449 | knowledge_id : "0", |
420 | 450 | content : "", |
421 | 451 | option_num : $(".section").eq(i).find( |
... | ... | @@ -442,7 +472,7 @@ $(function() { |
442 | 472 | "json" : data |
443 | 473 | }; |
444 | 474 | console.log(data); |
445 | - //ajax_submit(url, dataJson); | |
475 | + ajax_submit(url, dataJson); | |
446 | 476 | } else |
447 | 477 | alert("请添加试题"); |
448 | 478 | }); |
... | ... | @@ -459,10 +489,13 @@ $(function() { |
459 | 489 | contentType : "application/x-www-form-urlencoded; charset=utf-8", |
460 | 490 | success : function(data) { |
461 | 491 | $(".loading").css("display", "none"); |
462 | - if(testData.paper_type == '1'){ | |
463 | - window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list2.do"; | |
464 | - }else{ | |
465 | - window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list4.do?school_id=" + testData.school_id ; | |
492 | + if (testData.paper_type == '1') { | |
493 | + window.location.href = JUMP_URL | |
494 | + + "?a=1&defaulturl=../paper/list2.do"; | |
495 | + } else { | |
496 | + window.location.href = JUMP_URL | |
497 | + + "?a=1&defaulturl=../paper/list5.do?school_id=" | |
498 | + + testData.school_id; | |
466 | 499 | } |
467 | 500 | } |
468 | 501 | }) |
... | ... | @@ -503,22 +536,22 @@ $(function() { |
503 | 536 | fastSort(array, nowIndex + 1, tail); |
504 | 537 | } |
505 | 538 | function creatHtml(data) { |
506 | - data.questions.sort(function (a, b) { | |
507 | -// if (a.rank < b.rank) { | |
508 | -// return -1; | |
509 | -// } else if (a.rank == b.rank) { | |
510 | -// return 0; | |
511 | -// } else { | |
512 | -// return 1; | |
513 | -// } | |
514 | - var rankA = isNaN(parseInt(a.rank))?0:parseInt(a.rank); | |
515 | - var rankB = isNaN(parseInt(b.rank))?0:parseInt(b.rank); | |
516 | - return rankA-rankB; | |
539 | + data.questions.sort(function(a, b) { | |
540 | + // if (a.rank < b.rank) { | |
541 | + // return -1; | |
542 | + // } else if (a.rank == b.rank) { | |
543 | + // return 0; | |
544 | + // } else { | |
545 | + // return 1; | |
546 | + // } | |
547 | + var rankA = isNaN(parseInt(a.rank)) ? 0 : parseInt(a.rank); | |
548 | + var rankB = isNaN(parseInt(b.rank)) ? 0 : parseInt(b.rank); | |
549 | + return rankA - rankB; | |
517 | 550 | }) |
518 | 551 | console.log(data); |
519 | 552 | $(".header_box h1").html(data.title); |
520 | 553 | $("#time").html(data.exam_time); |
521 | - if(data.score != null && data.score > 0 && data.score != ''){ | |
554 | + if (data.score != null && data.score > 0 && data.score != '') { | |
522 | 555 | $("#score_all").html(data.score); |
523 | 556 | } |
524 | 557 | |
... | ... | @@ -530,35 +563,42 @@ $(function() { |
530 | 563 | |
531 | 564 | for (var i = 0; i < data.questions.length; i++) { |
532 | 565 | if (data.questions[i].questions) { |
533 | - var sortTemp = data.questions[i].questions.sort(function (a, b) { | |
534 | -// if (parseInt(a.rank) < parseInt(b.rank)) { | |
535 | -// return -1; | |
536 | -// } else if (a.rank == b.rank) { | |
537 | -// return 0; | |
538 | -// } else { | |
539 | -// return 1; | |
540 | -// } | |
541 | - var rankA = isNaN(parseInt(a.rank))?0:parseInt(a.rank); | |
542 | - var rankB = isNaN(parseInt(b.rank))?0:parseInt(b.rank); | |
543 | - return rankA-rankB; | |
566 | + var sortTemp = data.questions[i].questions.sort(function(a, b) { | |
567 | + // if (parseInt(a.rank) < parseInt(b.rank)) { | |
568 | + // return -1; | |
569 | + // } else if (a.rank == b.rank) { | |
570 | + // return 0; | |
571 | + // } else { | |
572 | + // return 1; | |
573 | + // } | |
574 | + var rankA = isNaN(parseInt(a.rank)) ? 0 : parseInt(a.rank); | |
575 | + var rankB = isNaN(parseInt(b.rank)) ? 0 : parseInt(b.rank); | |
576 | + return rankA - rankB; | |
544 | 577 | }) |
545 | 578 | console.log(sortTemp) |
579 | + var tixing = ""; | |
580 | + switch(data.questions[i].problem_type_id){ | |
581 | + case '1':tixing="单选题";break; | |
582 | + case '5':tixing="多选题";break; | |
583 | + case '4':tixing="判断题";break; | |
584 | + case '6':tixing="数字题";break; | |
585 | + } | |
546 | 586 | $(".content") |
547 | 587 | .append( |
548 | 588 | '<div class="section section-' |
549 | 589 | + i |
550 | - + '" data-fraction="' | |
590 | + + '" data-type="'+data.questions[i].problem_type_id+'" data-fraction="' | |
551 | 591 | + data.questions[i].score |
552 | 592 | + '" style="margin-top:80px;"> <h3><span class="que_num">' |
553 | - + '第' | |
554 | - + (i + 1) | |
555 | - + '大题总分:' | |
593 | + +SectionToChinese(i+1)+'、' | |
594 | + + tixing | |
595 | + + '(总分:' | |
556 | 596 | + data.questions[i].questions.length |
557 | 597 | + " X " |
558 | 598 | + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) |
559 | 599 | + " = " |
560 | 600 | + data.questions[i].sug_score |
561 | - + '</span>' | |
601 | + + '分)</span>' | |
562 | 602 | + '<span class="que_name">' |
563 | 603 | + data.questions[i].content |
564 | 604 | + '</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); |
... | ... | @@ -596,7 +636,7 @@ $(function() { |
596 | 636 | '<div class="question question' + (j + 1) |
597 | 637 | + '"><span>' + (++questionNUm) |
598 | 638 | + '、</span><ul></ul></div>'); |
599 | - if ($(".section-" + i).find(".que_name").text() == "判断题") { | |
639 | + if ($(".section-" + i).attr("data-type") == "4") { | |
600 | 640 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { |
601 | 641 | str_temp = data.questions[i].questions[j].answer; |
602 | 642 | if (k % 2 == 0) { |
... | ... | @@ -618,6 +658,13 @@ $(function() { |
618 | 658 | ".question" + (j + 1) + ' ul li').eq(1) |
619 | 659 | .attr("class", "btn btn-default on"); |
620 | 660 | } |
661 | + }else if($(".section-" + i).attr("data-type") == "6"){ | |
662 | + str_temp = data.questions[i].questions[j].answer; | |
663 | + $(".section-" + i).find( | |
664 | + ".question" + (j + 1) + ' ul').append( | |
665 | + '<li class="btn btn-default on">'+str_temp+'</li>'); | |
666 | + if(!$(".section-" + i).hasClass("number")) | |
667 | + $(".section-" + i).addClass("number"); | |
621 | 668 | } else { |
622 | 669 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { |
623 | 670 | str_temp = data.questions[i].questions[j].answer; |
... | ... | @@ -644,8 +691,7 @@ $(function() { |
644 | 691 | } |
645 | 692 | } |
646 | 693 | |
647 | - | |
648 | - /*快速建题中,每输入五个答案就加一个空格*/ | |
694 | + /* 快速建题中,每输入五个答案就加一个空格 */ | |
649 | 695 | $("#answer").on("input propertychange", function(event) { |
650 | 696 | var answerStr = ""; |
651 | 697 | answerStr = $("#answer").val(); |
... | ... | @@ -669,8 +715,6 @@ $(function() { |
669 | 715 | } |
670 | 716 | }) |
671 | 717 | |
672 | - | |
673 | - | |
674 | 718 | function SectionToChinese(section) { |
675 | 719 | var strIns = '', chnStr = ''; |
676 | 720 | var unitPos = 0; |
... | ... | @@ -694,33 +738,33 @@ $(function() { |
694 | 738 | return chnStr; |
695 | 739 | } |
696 | 740 | |
697 | - | |
698 | 741 | if (template != null && template.length > 0) { |
699 | - | |
700 | - $("#addQuestion").attr("disabled", "disabled"); | |
701 | - $("#fast").attr("disabled", "disabled"); | |
702 | - for (var i = 0; i < template.length; i++) { | |
703 | - if (template[i].type == 1) { | |
704 | - var answer = ""; | |
705 | - for (var j = 0; j < template[i].questionNum; j++) { | |
706 | - answer += "1"; | |
707 | - } | |
708 | - creat(answer, template[i].optionNum, template[i].score); | |
709 | - } | |
710 | - if (template[i].type == 2) { | |
711 | - addQuestion(5, template[i].optionNum, 1, | |
712 | - template[i].questionNum, template[i].score); | |
742 | + | |
743 | + $("#addQuestion").attr("disabled", "disabled"); | |
744 | + $("#fast").attr("disabled", "disabled"); | |
745 | + for (var i = 0; i < template.length; i++) { | |
746 | + if (template[i].type == 1) { | |
747 | + var answer = ""; | |
748 | + for (var j = 0; j < template[i].questionNum; j++) { | |
749 | + answer += "1"; | |
713 | 750 | } |
751 | + creat(answer, template[i].optionNum, template[i].score); | |
714 | 752 | } |
715 | - if(testData != null){ | |
716 | - $(".header_box h1").html(testData.title); | |
717 | - $("#time").html(testData.exam_time); | |
718 | - if(testData.score != null && testData.score > 0 && testData.score != ''){ | |
719 | - $("#score_all").html(testData.score); | |
720 | - } | |
753 | + if (template[i].type == 2) { | |
754 | + addQuestion(5, template[i].optionNum, 1, | |
755 | + template[i].questionNum, template[i].score); | |
721 | 756 | } |
722 | - | |
723 | - }else if (testData != null && testData.questions != null | |
757 | + } | |
758 | + if (testData != null) { | |
759 | + $(".header_box h1").html(testData.title); | |
760 | + $("#time").html(testData.exam_time); | |
761 | + if (testData.score != null && testData.score > 0 | |
762 | + && testData.score != '') { | |
763 | + $("#score_all").html(testData.score); | |
764 | + } | |
765 | + } | |
766 | + | |
767 | + } else if (testData != null && testData.questions != null | |
724 | 768 | && testData.questions.length > 0) { |
725 | 769 | fastSort(testData.questions, 0, testData.questions.length - 1); |
726 | 770 | for (var i = 0; i < testData.questions.length; i++) { |
... | ... | @@ -732,74 +776,75 @@ $(function() { |
732 | 776 | } |
733 | 777 | } |
734 | 778 | creatHtml(testData); |
735 | - }else{ | |
736 | - if(testData != null){ | |
779 | + } else { | |
780 | + if (testData != null) { | |
737 | 781 | $(".header_box h1").html(testData.title); |
738 | 782 | $("#time").html(testData.exam_time); |
739 | - if(testData.score != null && testData.score > 0 && testData.score != ''){ | |
783 | + if (testData.score != null && testData.score > 0 | |
784 | + && testData.score != '') { | |
740 | 785 | $("#score_all").html(testData.score); |
741 | 786 | } |
742 | 787 | } |
743 | 788 | } |
744 | - | |
745 | - $(".content").on("focus",".number .on",function(){ | |
746 | - if($(this).text()=="请输入答案") | |
789 | + | |
790 | + $(".content").on("focus", ".number .on", function() { | |
791 | + if ($(this).text() == "请输入答案") | |
747 | 792 | $(this).text(""); |
748 | - | |
749 | - | |
793 | + | |
750 | 794 | }) |
751 | - $(".content").on("blur",".number .on",function(){ | |
752 | - if($(this).text()==""){ | |
795 | + $(".content").on("blur", ".number .on", function() { | |
796 | + if ($(this).text() == "") { | |
753 | 797 | $(this).text("请输入答案"); |
754 | 798 | } |
755 | - | |
799 | + | |
756 | 800 | }) |
757 | - | |
801 | + | |
758 | 802 | }) |
759 | 803 | |
760 | 804 | /** |
761 | 805 | * 数字校验 |
806 | + * | |
762 | 807 | * @param e |
763 | 808 | */ |
764 | -function keydown2(e){ | |
765 | - var reg= /^[0-9]*$/; | |
766 | - console.log(reg.test(e.text())); | |
767 | - console.log(e.text()) | |
768 | - if(!reg.test(e.text())){ | |
769 | - e.text(""); | |
809 | +function keydown2(e) { | |
810 | + var reg = /^[0-9]*$/; | |
811 | + console.log(reg.test(e.text())); | |
812 | + console.log(e.text()) | |
813 | + if (!reg.test(e.text())) { | |
814 | + e.text(""); | |
815 | + } | |
816 | +} | |
817 | + | |
818 | +function NumberCheck(num, obj) { | |
819 | + var str = num; | |
820 | + // callback(str,obj) | |
821 | + console.log("num:" + num) | |
822 | + var len1 = str.substr(0, 1); | |
823 | + var len2 = str.substr(1, 1); | |
824 | + // 如果第一位是0,第二位不是点,就用数字把点替换掉 | |
825 | + if (str.length > 1 && len1 == 0 && len2 != ".") { | |
826 | + str = str.substr(1, 1); | |
827 | + } | |
828 | + // 第一位不能是. | |
829 | + if (len1 == ".") { | |
830 | + str = ""; | |
831 | + } | |
832 | + // 限制只能输入一个小数点 | |
833 | + if (str.indexOf(".") != -1) { | |
834 | + var str_ = str.substr(str.indexOf(".") + 1); | |
835 | + if (str_.indexOf(".") != -1) { | |
836 | + str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1); | |
770 | 837 | } |
771 | 838 | } |
839 | + // 正则替换,保留数字和小数点 | |
840 | + str = str.replace(/[^\-?\d.]/g, '') | |
841 | + | |
842 | + obj.innerText = str | |
772 | 843 | |
773 | -function NumberCheck(num,obj) { | |
774 | - var str = num; | |
775 | - //callback(str,obj) | |
776 | - console.log("num:"+num) | |
777 | - var len1 = str.substr(0, 1); | |
778 | - var len2 = str.substr(1, 1); | |
779 | - //如果第一位是0,第二位不是点,就用数字把点替换掉 | |
780 | - if (str.length > 1 && len1 == 0 && len2 != ".") { | |
781 | - str = str.substr(1, 1); | |
782 | - } | |
783 | - //第一位不能是. | |
784 | - if (len1 == ".") { | |
785 | - str = ""; | |
786 | - } | |
787 | - //限制只能输入一个小数点 | |
788 | - if (str.indexOf(".") != -1) { | |
789 | - var str_ = str.substr(str.indexOf(".") + 1); | |
790 | - if (str_.indexOf(".") != -1) { | |
791 | - str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1); | |
792 | - } | |
793 | - } | |
794 | - //正则替换,保留数字和小数点 | |
795 | - str = str.replace(/[^\-?\d.]/g,'') | |
796 | - | |
797 | - obj.innerText=str | |
798 | - | |
799 | - callback(str,obj) | |
844 | + callback(str, obj) | |
800 | 845 | } |
801 | -function callback(tp,obj) { | |
802 | - var _div = obj//document.querySelector('.number .on'); | |
846 | +function callback(tp, obj) { | |
847 | + var _div = obj// document.querySelector('.number .on'); | |
803 | 848 | var range = document.createRange(); |
804 | 849 | |
805 | 850 | range.selectNodeContents(_div); | ... | ... |
resources/dbconfig.properties
1 | 1 | #数据源 1 |
2 | -#url:jdbc:mysql://47.107.98.47:3306/education2?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
2 | +url:jdbc:mysql://47.107.98.47:3306/education2?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
3 | 3 | #url:jdbc:mysql://120.78.57.84:3306/edu?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
4 | 4 | #url:jdbc:mysql://120.78.57.84:3306/education3?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
5 | 5 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
6 | 6 | #url:jdbc:mysql://120.78.219.152:3306/fhadmin?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
7 | -url:jdbc:mysql://121.40.201.117:3306/luming?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
7 | +#url:jdbc:mysql://121.40.201.117:3306/luming?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
8 | 8 | driverClassName:com.mysql.jdbc.Driver |
9 | 9 | #username:root |
10 | 10 | #password:ZrZxKeYp | ... | ... |
resources/mybatis1/sunvote/PaperMapper.xml
... | ... | @@ -257,7 +257,7 @@ |
257 | 257 | <include refid="tableName"></include> |
258 | 258 | where 1 = 1 |
259 | 259 | AND |
260 | - (SCHOOL_ID = #{SCHOOL_ID} AND PAPER_TYPE = '2') OR | |
260 | + (SCHOOL_ID = #{SCHOOL_ID} AND PAPER_TYPE = '2' AND SUBJECT_ID=#{SUBJECT_ID}) OR | |
261 | 261 | (USER_ID = #{USER_ID} AND PAPER_TYPE = #{PAPER_TYPE}) |
262 | 262 | |
263 | 263 | order by CREATE_DATE DESC | ... | ... |
src/com/fh/controller/sunvote/paper/PaperController.java
... | ... | @@ -467,7 +467,7 @@ public class PaperController extends BaseController { |
467 | 467 | || list.get(i).get("NO_NAME").toString().isEmpty()) { |
468 | 468 | continue; |
469 | 469 | } |
470 | - Float que_score = Float.valueOf(list.get(i).get("SCORE") | |
470 | + Float que_score = list.get(i).getString("SCORE").isEmpty()?0:Float.valueOf(list.get(i).get("SCORE") | |
471 | 471 | .toString()); |
472 | 472 | temp.put("QUESTION_ID", questionid); |
473 | 473 | PageData question = questionService.findById(temp); | ... | ... |