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,7 +14,7 @@ | ||
14 | <meta charset="utf-8"> | 14 | <meta charset="utf-8"> |
15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | <meta name="viewport" content="width=device-width, initial-scale=1"> | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | 17 | +<title>教育管理系统</title> |
18 | 18 | ||
19 | <!-- Bootstrap --> | 19 | <!-- Bootstrap --> |
20 | <!-- <link | 20 | <!-- <link |
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | <body> | 39 | <body> |
40 | <div class="header"> | 40 | <div class="header"> |
41 | <div class="logo"> | 41 | <div class="logo"> |
42 | - <img src="../static/images/logo.png" /> | 42 | + <img src="../static/images/logo1.png" /> |
43 | </div> | 43 | </div> |
44 | <div class="out"> | 44 | <div class="out"> |
45 | <a href="../logout"><img src="../static/images/close.png" />退出登录</a> | 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,8 +110,8 @@ | ||
110 | <div class="col-sm-10"> | 110 | <div class="col-sm-10"> |
111 | <select class="form-control" id="type"> | 111 | <select class="form-control" id="type"> |
112 | <option value="1" selected>单选题</option> | 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 | <option value="4">判断题</option> | 115 | <option value="4">判断题</option> |
116 | <option value="5">多选题</option> | 116 | <option value="5">多选题</option> |
117 | <option value="6">数字题</option> | 117 | <option value="6">数字题</option> |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <meta charset="utf-8"> | 14 | <meta charset="utf-8"> |
15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | <meta name="viewport" content="width=device-width, initial-scale=1"> | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | 17 | +<title>教育管理系统</title> |
18 | 18 | ||
19 | <!-- Bootstrap --> | 19 | <!-- Bootstrap --> |
20 | <link href="../static/css/bootstrap.min.css" rel="stylesheet"> | 20 | <link href="../static/css/bootstrap.min.css" rel="stylesheet"> |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | <body> | 36 | <body> |
37 | <div class="header"> | 37 | <div class="header"> |
38 | <div class="logo"> | 38 | <div class="logo"> |
39 | - <img src="../static/images/logo.png" /> | 39 | + <img src="../static/images/logo1.png" /> |
40 | </div> | 40 | </div> |
41 | <div class="out"> | 41 | <div class="out"> |
42 | <a href="../logout"><img src="../static/images/close.png" />退出登录</a> | 42 | <a href="../logout"><img src="../static/images/close.png" />退出登录</a> |
@@ -269,7 +269,7 @@ | @@ -269,7 +269,7 @@ | ||
269 | }); | 269 | }); |
270 | 270 | ||
271 | $("#qingsongkao_paper").click(function() { | 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 | //$(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" style="width:100%;height:'+$(".content_l").height()+'px;" src=' + path + '></iframe>'); | 273 | //$(".content_r").html('<iframe name="mainFrame" id="mainFrame" frameborder="0" style="width:100%;height:'+$(".content_l").height()+'px;" src=' + path + '></iframe>'); |
274 | if ($("#mainFrame").attr('src') != (path)) { | 274 | if ($("#mainFrame").attr('src') != (path)) { |
275 | $("#mainFrame").attr('src', path); | 275 | $("#mainFrame").attr('src', path); |
@@ -285,7 +285,7 @@ | @@ -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 | if (defaultUrl != '' && defaultUrl != '') { | 289 | if (defaultUrl != '' && defaultUrl != '') { |
290 | $("#mainFrame").attr('src', defaultUrl); | 290 | $("#mainFrame").attr('src', defaultUrl); |
291 | } | 291 | } |
WebRoot/WEB-INF/jsp/system/index/login.jsp
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <meta charset="utf-8"> | 14 | <meta charset="utf-8"> |
15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | 15 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
16 | <meta name="viewport" content="width=device-width, initial-scale=1"> | 16 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
17 | -<title>中天电子-教育管理系统</title> | 17 | +<title>教育管理系统</title> |
18 | 18 | ||
19 | <!-- Bootstrap --> | 19 | <!-- Bootstrap --> |
20 | <link href="static/css/bootstrap.min.css" rel="stylesheet"> | 20 | <link href="static/css/bootstrap.min.css" rel="stylesheet"> |
@@ -69,7 +69,7 @@ body{ | @@ -69,7 +69,7 @@ body{ | ||
69 | <body> | 69 | <body> |
70 | <div class="content"> | 70 | <div class="content"> |
71 | <div class="content_t"> | 71 | <div class="content_t"> |
72 | - <img src="static/login/title.png" alt="SunVote" /> | 72 | + <img src="static/login/title1.png" alt="SunVote" /> |
73 | </div> | 73 | </div> |
74 | <div class="content_b"> | 74 | <div class="content_b"> |
75 | <div class="form_box"> | 75 | <div class="form_box"> |
WebRoot/static/js/control-604.js
1 | var questionNUm = 0; | 1 | var questionNUm = 0; |
2 | -/*数字转汉字数字*/ | 2 | +/* 数字转汉字数字 */ |
3 | var chnNumChar = [ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ]; | 3 | var chnNumChar = [ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ]; |
4 | var chnUnitSection = [ "", "万", "亿", "万亿", "亿亿" ]; | 4 | var chnUnitSection = [ "", "万", "亿", "万亿", "亿亿" ]; |
5 | var chnUnitChar = [ "", "十", "百", "千" ]; | 5 | var chnUnitChar = [ "", "十", "百", "千" ]; |
@@ -8,9 +8,7 @@ var score = 0; | @@ -8,9 +8,7 @@ var score = 0; | ||
8 | var total_score = 0; | 8 | var total_score = 0; |
9 | var answerLen = 0; | 9 | var answerLen = 0; |
10 | 10 | ||
11 | - | ||
12 | $(function() { | 11 | $(function() { |
13 | - | ||
14 | 12 | ||
15 | function creat(str_ans, a_num, fraction) { | 13 | function creat(str_ans, a_num, fraction) { |
16 | // $(".section").remove(); | 14 | // $(".section").remove(); |
@@ -31,9 +29,22 @@ $(function() { | @@ -31,9 +29,22 @@ $(function() { | ||
31 | } | 29 | } |
32 | } | 30 | } |
33 | q_num = str.length; | 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 | + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | 48 | + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); |
38 | for (var i = 0; i < q_num; i++) { | 49 | for (var i = 0; i < q_num; i++) { |
39 | str_temp = str[i]; | 50 | str_temp = str[i]; |
@@ -65,14 +76,13 @@ $(function() { | @@ -65,14 +76,13 @@ $(function() { | ||
65 | // return; | 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 | total_score += q_num * fraction; | 80 | total_score += q_num * fraction; |
71 | $("#score_all").text(total_score); | 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 | function addQuestion(type, a_num, index_s_2, index_e_2, fraction2) { | 88 | function addQuestion(type, a_num, index_s_2, index_e_2, fraction2) { |
@@ -86,9 +96,11 @@ $(function() { | @@ -86,9 +96,11 @@ $(function() { | ||
86 | .append( | 96 | .append( |
87 | '<div class="section section-' | 97 | '<div class="section section-' |
88 | + answer_index_b | 98 | + answer_index_b |
89 | - + ' single" data-fraction="' | 99 | + + ' single" data-type="1" data-fraction="' |
90 | + fraction2 | 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 | + question_num | 104 | + question_num |
93 | + '、</span>' | 105 | + '、</span>' |
94 | + '<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>'); | 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,15 +116,19 @@ $(function() { | ||
104 | + '</li>'); | 116 | + '</li>'); |
105 | } | 117 | } |
106 | } | 118 | } |
119 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | ||
120 | + $("#score_all").text(total_score); | ||
107 | break; | 121 | break; |
108 | case 2: // 完形填空 | 122 | case 2: // 完形填空 |
109 | $(".content") | 123 | $(".content") |
110 | .append( | 124 | .append( |
111 | '<div class="section section-' | 125 | '<div class="section section-' |
112 | + answer_index_b | 126 | + answer_index_b |
113 | - + ' single" data-fraction="' | 127 | + + ' single" data-type="2" data-fraction="' |
114 | + fraction2 | 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 | + question_num | 132 | + question_num |
117 | + '、</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>'); | 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 | for (var i = index_s_2; i <= index_e_2; i++) { | 134 | for (var i = index_s_2; i <= index_e_2; i++) { |
@@ -127,15 +143,19 @@ $(function() { | @@ -127,15 +143,19 @@ $(function() { | ||
127 | + '</li>'); | 143 | + '</li>'); |
128 | } | 144 | } |
129 | } | 145 | } |
146 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | ||
147 | + $("#score_all").text(total_score); | ||
130 | break; | 148 | break; |
131 | case 3: // 阅读理解 | 149 | case 3: // 阅读理解 |
132 | $(".content") | 150 | $(".content") |
133 | .append( | 151 | .append( |
134 | '<div class="section section-' | 152 | '<div class="section section-' |
135 | + answer_index_b | 153 | + answer_index_b |
136 | - + ' single" data-fraction="' | 154 | + + ' single" data-type="3" data-fraction="' |
137 | + fraction2 | 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 | + question_num | 159 | + question_num |
140 | + '、</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>'); | 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 | for (var i = index_s_2; i <= index_e_2; i++) { | 161 | for (var i = index_s_2; i <= index_e_2; i++) { |
@@ -150,15 +170,19 @@ $(function() { | @@ -150,15 +170,19 @@ $(function() { | ||
150 | + '</li>'); | 170 | + '</li>'); |
151 | } | 171 | } |
152 | } | 172 | } |
173 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | ||
174 | + $("#score_all").text(total_score); | ||
153 | break; | 175 | break; |
154 | case 4: // 判断题 | 176 | case 4: // 判断题 |
155 | $(".content") | 177 | $(".content") |
156 | .append( | 178 | .append( |
157 | '<div class="section section-' | 179 | '<div class="section section-' |
158 | + answer_index_b | 180 | + answer_index_b |
159 | - + ' single" data-fraction="' | 181 | + + ' single" data-type="4" data-fraction="' |
160 | + fraction2 | 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 | + question_num | 186 | + question_num |
163 | + '、</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>'); | 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 | for (var i = index_s_2; i <= index_e_2; i++) { | 188 | for (var i = index_s_2; i <= index_e_2; i++) { |
@@ -176,6 +200,8 @@ $(function() { | @@ -176,6 +200,8 @@ $(function() { | ||
176 | + '</li>'); | 200 | + '</li>'); |
177 | } | 201 | } |
178 | } | 202 | } |
203 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | ||
204 | + $("#score_all").text(total_score); | ||
179 | break; | 205 | break; |
180 | /* | 206 | /* |
181 | * case 5: //多选题 $(".content").append('<div class="section | 207 | * case 5: //多选题 $(".content").append('<div class="section |
@@ -190,77 +216,70 @@ $(function() { | @@ -190,77 +216,70 @@ $(function() { | ||
190 | * for(var j=0;j<a_num;j++){ option=String.fromCharCode(0x41+j); | 216 | * for(var j=0;j<a_num;j++){ option=String.fromCharCode(0x41+j); |
191 | * $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); } } | 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 | + '、</span><ul><li class="btn btn-default on" contenteditable="true" onkeyup="NumberCheck(this.innerText,this)">请输入答案</li></ul></div>'); | 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 | // $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); | 284 | // $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); |
266 | $(".section0").attr("data-score", | 285 | $(".section0").attr("data-score", |
@@ -269,10 +288,17 @@ $(function() { | @@ -269,10 +288,17 @@ $(function() { | ||
269 | 288 | ||
270 | $(document).on('click', '.remove', function() { // 删除按钮 | 289 | $(document).on('click', '.remove', function() { // 删除按钮 |
271 | $(this).parent().parent(".section").remove(); | 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 | $("#fast_submit").click(function() { // 点击确定,创建答案列表 | 300 | $("#fast_submit").click(function() { // 点击确定,创建答案列表 |
275 | - // $("#addQuestion").attr("disabled","disabled"); | 301 | + // $("#addQuestion").attr("disabled","disabled"); |
276 | var answer = $("#answer").val(); | 302 | var answer = $("#answer").val(); |
277 | var num_ans = $("#num_ans").val(); | 303 | var num_ans = $("#num_ans").val(); |
278 | var fraction = $("#fraction").val(); | 304 | var fraction = $("#fraction").val(); |
@@ -296,8 +322,8 @@ $(function() { | @@ -296,8 +322,8 @@ $(function() { | ||
296 | 322 | ||
297 | /* 添加试题的确定按钮 */ | 323 | /* 添加试题的确定按钮 */ |
298 | $("#addQuestion_submit").click(function() { | 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 | var index_s_2 = 1;// parseInt($("#index_s_2").val()) | 327 | var index_s_2 = 1;// parseInt($("#index_s_2").val()) |
302 | var index_e_2 = parseInt($("#index_s_2").val()); | 328 | var index_e_2 = parseInt($("#index_s_2").val()); |
303 | // var answer_2=$("#answer_2").val(); | 329 | // var answer_2=$("#answer_2").val(); |
@@ -326,7 +352,9 @@ $(function() { | @@ -326,7 +352,9 @@ $(function() { | ||
326 | if ($("#type").val() == 4) { | 352 | if ($("#type").val() == 4) { |
327 | $("#num_ans_2").val(2); | 353 | $("#num_ans_2").val(2); |
328 | $("#num_ans_2").attr("disabled", "disabled"); | 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 | $("#num_ans_2").removeAttr("disabled"); | 358 | $("#num_ans_2").removeAttr("disabled"); |
331 | $("#num_ans_2").val(4); | 359 | $("#num_ans_2").val(4); |
332 | 360 | ||
@@ -357,7 +385,9 @@ $(function() { | @@ -357,7 +385,9 @@ $(function() { | ||
357 | } | 385 | } |
358 | }) | 386 | }) |
359 | /* 提交保存数据 */ | 387 | /* 提交保存数据 */ |
360 | - $("#save").click(function() { | 388 | + $("#save") |
389 | + .click( | ||
390 | + function() { | ||
361 | var url = URL; | 391 | var url = URL; |
362 | 392 | ||
363 | var data = { | 393 | var data = { |
@@ -378,7 +408,7 @@ $(function() { | @@ -378,7 +408,7 @@ $(function() { | ||
378 | // rank++; | 408 | // rank++; |
379 | data.questions[i] = { | 409 | data.questions[i] = { |
380 | chapter_id : "0", | 410 | chapter_id : "0", |
381 | - problem_type_id : "0", | 411 | + problem_type_id : $(".section").eq(i).attr("data-type"), |
382 | knowledge_id : "0", | 412 | knowledge_id : "0", |
383 | // content: | 413 | // content: |
384 | // $(".section").eq(i).find(".que_name").text(), | 414 | // $(".section").eq(i).find(".que_name").text(), |
@@ -393,8 +423,7 @@ $(function() { | @@ -393,8 +423,7 @@ $(function() { | ||
393 | part_score : "", | 423 | part_score : "", |
394 | remark : "", | 424 | remark : "", |
395 | rank : rank, | 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 | questions : [] | 427 | questions : [] |
399 | } | 428 | } |
400 | for (j = 0; j < $(".section").eq(i).find( | 429 | for (j = 0; j < $(".section").eq(i).find( |
@@ -409,13 +438,14 @@ $(function() { | @@ -409,13 +438,14 @@ $(function() { | ||
409 | .eq(k).text(); | 438 | .eq(k).text(); |
410 | // console.log(answer); | 439 | // console.log(answer); |
411 | } | 440 | } |
412 | - if (answer == ''||answer.indexOf("请输入答案")>=0) { | 441 | + if (answer == '' |
442 | + || answer.indexOf("请输入答案") >= 0) { | ||
413 | alert("还有试题未编辑答案。"); | 443 | alert("还有试题未编辑答案。"); |
414 | return; | 444 | return; |
415 | } | 445 | } |
416 | data.questions[i].questions[j] = { | 446 | data.questions[i].questions[j] = { |
417 | chapter_id : "0", | 447 | chapter_id : "0", |
418 | - problem_type_id : "0", | 448 | + problem_type_id : $(".section").eq(i).attr("data-type"),//"0",//data-type="1" |
419 | knowledge_id : "0", | 449 | knowledge_id : "0", |
420 | content : "", | 450 | content : "", |
421 | option_num : $(".section").eq(i).find( | 451 | option_num : $(".section").eq(i).find( |
@@ -442,7 +472,7 @@ $(function() { | @@ -442,7 +472,7 @@ $(function() { | ||
442 | "json" : data | 472 | "json" : data |
443 | }; | 473 | }; |
444 | console.log(data); | 474 | console.log(data); |
445 | - //ajax_submit(url, dataJson); | 475 | + ajax_submit(url, dataJson); |
446 | } else | 476 | } else |
447 | alert("请添加试题"); | 477 | alert("请添加试题"); |
448 | }); | 478 | }); |
@@ -459,10 +489,13 @@ $(function() { | @@ -459,10 +489,13 @@ $(function() { | ||
459 | contentType : "application/x-www-form-urlencoded; charset=utf-8", | 489 | contentType : "application/x-www-form-urlencoded; charset=utf-8", |
460 | success : function(data) { | 490 | success : function(data) { |
461 | $(".loading").css("display", "none"); | 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,22 +536,22 @@ $(function() { | ||
503 | fastSort(array, nowIndex + 1, tail); | 536 | fastSort(array, nowIndex + 1, tail); |
504 | } | 537 | } |
505 | function creatHtml(data) { | 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 | console.log(data); | 551 | console.log(data); |
519 | $(".header_box h1").html(data.title); | 552 | $(".header_box h1").html(data.title); |
520 | $("#time").html(data.exam_time); | 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 | $("#score_all").html(data.score); | 555 | $("#score_all").html(data.score); |
523 | } | 556 | } |
524 | 557 | ||
@@ -530,35 +563,42 @@ $(function() { | @@ -530,35 +563,42 @@ $(function() { | ||
530 | 563 | ||
531 | for (var i = 0; i < data.questions.length; i++) { | 564 | for (var i = 0; i < data.questions.length; i++) { |
532 | if (data.questions[i].questions) { | 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 | console.log(sortTemp) | 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 | $(".content") | 586 | $(".content") |
547 | .append( | 587 | .append( |
548 | '<div class="section section-' | 588 | '<div class="section section-' |
549 | + i | 589 | + i |
550 | - + '" data-fraction="' | 590 | + + '" data-type="'+data.questions[i].problem_type_id+'" data-fraction="' |
551 | + data.questions[i].score | 591 | + data.questions[i].score |
552 | + '" style="margin-top:80px;"> <h3><span class="que_num">' | 592 | + '" style="margin-top:80px;"> <h3><span class="que_num">' |
553 | - + '第' | ||
554 | - + (i + 1) | ||
555 | - + '大题总分:' | 593 | + +SectionToChinese(i+1)+'、' |
594 | + + tixing | ||
595 | + + '(总分:' | ||
556 | + data.questions[i].questions.length | 596 | + data.questions[i].questions.length |
557 | + " X " | 597 | + " X " |
558 | + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) | 598 | + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) |
559 | + " = " | 599 | + " = " |
560 | + data.questions[i].sug_score | 600 | + data.questions[i].sug_score |
561 | - + '</span>' | 601 | + + '分)</span>' |
562 | + '<span class="que_name">' | 602 | + '<span class="que_name">' |
563 | + data.questions[i].content | 603 | + data.questions[i].content |
564 | + '</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | 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,7 +636,7 @@ $(function() { | ||
596 | '<div class="question question' + (j + 1) | 636 | '<div class="question question' + (j + 1) |
597 | + '"><span>' + (++questionNUm) | 637 | + '"><span>' + (++questionNUm) |
598 | + '、</span><ul></ul></div>'); | 638 | + '、</span><ul></ul></div>'); |
599 | - if ($(".section-" + i).find(".que_name").text() == "判断题") { | 639 | + if ($(".section-" + i).attr("data-type") == "4") { |
600 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | 640 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { |
601 | str_temp = data.questions[i].questions[j].answer; | 641 | str_temp = data.questions[i].questions[j].answer; |
602 | if (k % 2 == 0) { | 642 | if (k % 2 == 0) { |
@@ -618,6 +658,13 @@ $(function() { | @@ -618,6 +658,13 @@ $(function() { | ||
618 | ".question" + (j + 1) + ' ul li').eq(1) | 658 | ".question" + (j + 1) + ' ul li').eq(1) |
619 | .attr("class", "btn btn-default on"); | 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 | } else { | 668 | } else { |
622 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | 669 | for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { |
623 | str_temp = data.questions[i].questions[j].answer; | 670 | str_temp = data.questions[i].questions[j].answer; |
@@ -644,8 +691,7 @@ $(function() { | @@ -644,8 +691,7 @@ $(function() { | ||
644 | } | 691 | } |
645 | } | 692 | } |
646 | 693 | ||
647 | - | ||
648 | - /*快速建题中,每输入五个答案就加一个空格*/ | 694 | + /* 快速建题中,每输入五个答案就加一个空格 */ |
649 | $("#answer").on("input propertychange", function(event) { | 695 | $("#answer").on("input propertychange", function(event) { |
650 | var answerStr = ""; | 696 | var answerStr = ""; |
651 | answerStr = $("#answer").val(); | 697 | answerStr = $("#answer").val(); |
@@ -669,8 +715,6 @@ $(function() { | @@ -669,8 +715,6 @@ $(function() { | ||
669 | } | 715 | } |
670 | }) | 716 | }) |
671 | 717 | ||
672 | - | ||
673 | - | ||
674 | function SectionToChinese(section) { | 718 | function SectionToChinese(section) { |
675 | var strIns = '', chnStr = ''; | 719 | var strIns = '', chnStr = ''; |
676 | var unitPos = 0; | 720 | var unitPos = 0; |
@@ -694,33 +738,33 @@ $(function() { | @@ -694,33 +738,33 @@ $(function() { | ||
694 | return chnStr; | 738 | return chnStr; |
695 | } | 739 | } |
696 | 740 | ||
697 | - | ||
698 | if (template != null && template.length > 0) { | 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 | && testData.questions.length > 0) { | 768 | && testData.questions.length > 0) { |
725 | fastSort(testData.questions, 0, testData.questions.length - 1); | 769 | fastSort(testData.questions, 0, testData.questions.length - 1); |
726 | for (var i = 0; i < testData.questions.length; i++) { | 770 | for (var i = 0; i < testData.questions.length; i++) { |
@@ -732,74 +776,75 @@ $(function() { | @@ -732,74 +776,75 @@ $(function() { | ||
732 | } | 776 | } |
733 | } | 777 | } |
734 | creatHtml(testData); | 778 | creatHtml(testData); |
735 | - }else{ | ||
736 | - if(testData != null){ | 779 | + } else { |
780 | + if (testData != null) { | ||
737 | $(".header_box h1").html(testData.title); | 781 | $(".header_box h1").html(testData.title); |
738 | $("#time").html(testData.exam_time); | 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 | $("#score_all").html(testData.score); | 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 | $(this).text(""); | 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 | $(this).text("请输入答案"); | 797 | $(this).text("请输入答案"); |
754 | } | 798 | } |
755 | - | 799 | + |
756 | }) | 800 | }) |
757 | - | 801 | + |
758 | }) | 802 | }) |
759 | 803 | ||
760 | /** | 804 | /** |
761 | * 数字校验 | 805 | * 数字校验 |
806 | + * | ||
762 | * @param e | 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 | var range = document.createRange(); | 848 | var range = document.createRange(); |
804 | 849 | ||
805 | range.selectNodeContents(_div); | 850 | range.selectNodeContents(_div); |
resources/dbconfig.properties
1 | #数据源 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 | #url:jdbc:mysql://120.78.57.84:3306/edu?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 3 | #url:jdbc:mysql://120.78.57.84:3306/edu?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
4 | #url:jdbc:mysql://120.78.57.84:3306/education3?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 4 | #url:jdbc:mysql://120.78.57.84:3306/education3?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
5 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 5 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
6 | #url:jdbc:mysql://120.78.219.152:3306/fhadmin?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | 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 | driverClassName:com.mysql.jdbc.Driver | 8 | driverClassName:com.mysql.jdbc.Driver |
9 | #username:root | 9 | #username:root |
10 | #password:ZrZxKeYp | 10 | #password:ZrZxKeYp |
resources/mybatis1/sunvote/PaperMapper.xml
@@ -257,7 +257,7 @@ | @@ -257,7 +257,7 @@ | ||
257 | <include refid="tableName"></include> | 257 | <include refid="tableName"></include> |
258 | where 1 = 1 | 258 | where 1 = 1 |
259 | AND | 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 | (USER_ID = #{USER_ID} AND PAPER_TYPE = #{PAPER_TYPE}) | 261 | (USER_ID = #{USER_ID} AND PAPER_TYPE = #{PAPER_TYPE}) |
262 | 262 | ||
263 | order by CREATE_DATE DESC | 263 | order by CREATE_DATE DESC |
src/com/fh/controller/sunvote/paper/PaperController.java
@@ -467,7 +467,7 @@ public class PaperController extends BaseController { | @@ -467,7 +467,7 @@ public class PaperController extends BaseController { | ||
467 | || list.get(i).get("NO_NAME").toString().isEmpty()) { | 467 | || list.get(i).get("NO_NAME").toString().isEmpty()) { |
468 | continue; | 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 | .toString()); | 471 | .toString()); |
472 | temp.put("QUESTION_ID", questionid); | 472 | temp.put("QUESTION_ID", questionid); |
473 | PageData question = questionService.findById(temp); | 473 | PageData question = questionService.findById(temp); |