Commit 5d2c20339b498830f42e08b8b21342175eb229f7
1 parent
cea072ff
自定义出题
Showing
5 changed files
with
427 additions
and
11 deletions
WebRoot/WEB-INF/jsp/sunvote/coursemanagement/coursemanagement_edit.jsp
... | ... | @@ -65,6 +65,14 @@ |
65 | 65 | </td> |
66 | 66 | </tr> |
67 | 67 | <tr> |
68 | + <td style="width:75px;text-align: right;padding-top: 13px;">学期:</td> | |
69 | + <select class="chosen-select form-control" name="TERM_ID" id="TERM_ID" data-placeholder="学期"> | |
70 | + <c:forEach var="item" items="${subjects}"> | |
71 | + <option value="${item.ID}" <c:if test="${pd.TERM_ID==item.TERM_ID}">selected="true"</c:if>>${item.NAME}</option> | |
72 | + </c:forEach> | |
73 | + </select> | |
74 | + </tr> | |
75 | + <%-- <tr> | |
68 | 76 | <td style="width:75px;text-align: right;padding-top: 13px;">开始时间:</td> |
69 | 77 | <td><input class="span10 date-picker" name="START_DATE" id="START_DATE" value="${pd.START_DATE}" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" placeholder="开始时间" title="开始时间" style="width:98%;"/></td> |
70 | 78 | </tr> |
... | ... | @@ -75,7 +83,7 @@ |
75 | 83 | <tr> |
76 | 84 | <td style="width:75px;text-align: right;padding-top: 13px;">备注:</td> |
77 | 85 | <td><input type="text" name="REMARK" id="REMARK" value="${pd.REMARK}" maxlength="255" placeholder="这里输入备注" title="备注" style="width:98%;"/></td> |
78 | - </tr> | |
86 | + </tr> --%> | |
79 | 87 | <tr> |
80 | 88 | <td style="text-align: center;" colspan="10"> |
81 | 89 | <a class="btn btn-mini btn-primary" onclick="save();">保存</a> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | <div class="btn_box pull-right"> |
30 | 30 | <input type="button" class="btn btn-success btn-lg" name="save" value="保存" id="save"/> |
31 | 31 | <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">快速出题</button> |
32 | - <!-- <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".addQuestion" id="addQuestion">添加试题</button> --> | |
32 | + <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".addQuestion" id="addQuestion">添加试题</button> | |
33 | 33 | <div class="clearfix"></div> |
34 | 34 | </div> |
35 | 35 | </div> |
... | ... | @@ -147,13 +147,6 @@ |
147 | 147 | <div class="clearfix"></div> |
148 | 148 | </div> |
149 | 149 | <div class="form-group"> |
150 | - <label for="answer_2" class="col-sm-2 control-label">试题答案</label> | |
151 | - <div class="col-sm-10"> | |
152 | - <input type="text" class="form-control" id="answer_2" placeholder="输入题目答案,以分号隔开"> | |
153 | - </div> | |
154 | - <div class="clearfix"></div> | |
155 | - </div> | |
156 | - <div class="form-group"> | |
157 | 150 | <label for="num_ans_2" class="col-sm-2 control-label">选项个数</label> |
158 | 151 | <div class="col-sm-10"> |
159 | 152 | <select class="form-control" id="num_ans_2"> |
... | ... | @@ -223,7 +216,7 @@ |
223 | 216 | //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"单选","option_num":"","option_content":"","answer":"","difficulty":"","analysis":"","question_from":"","score":1,"part_score":"","remark":"","rank":"1","no_name":"一、","questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.1"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"B","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.2"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"C","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.3"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"D","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.4"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.5"}]}]}; |
224 | 217 | //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[]}; |
225 | 218 | </script> |
226 | -<script type="text/javascript" src="../static/js/control.js"></script> | |
219 | +<script type="text/javascript" src="../static/js/control-604.js"></script> | |
227 | 220 | |
228 | 221 | |
229 | 222 | </body> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... | ... | @@ -94,7 +94,7 @@ |
94 | 94 | </div> |
95 | 95 | <c:forEach items="${pd.TEACHER}" var="var" varStatus="vs"> |
96 | 96 | <div class="class"> |
97 | - <p>${var.GRADE_NAME}${var.SUBJECT_NAME} <span>${var.CLASS_NAME}</span></p> | |
97 | + <p><a href="javascript:;">${var.GRADE_NAME}${var.SUBJECT_NAME} <span>${var.CLASS_NAME}</span></a></p> | |
98 | 98 | </div> |
99 | 99 | </c:forEach> |
100 | 100 | <div class="test">测验</div> | ... | ... |
WebRoot/static/js/control-604.js
0 → 100644
1 | +$(function(){ | |
2 | + /*快速创建答案列表*/ | |
3 | + var score=0; | |
4 | + function creat(str_ans,a_num,fraction){ | |
5 | + $(".section").remove(); | |
6 | + $(".content").append('<div class="section section-1 single" data-fraction="'+fraction+'" data-score=""> <div class="title"> <h3><span class="que_num">一、</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>') | |
7 | + var str=str_ans.split(''); | |
8 | + console.log(str); | |
9 | + for(i=0;i<str.length;i++){ | |
10 | + if(str[i] == " "){ | |
11 | + str.splice(i,1); | |
12 | + i= i-1; | |
13 | + } | |
14 | + } | |
15 | + q_num=str.length; | |
16 | + for(var i=0;i<q_num;i++){ | |
17 | + str_temp=str[i]; | |
18 | + str_temp=str_temp.toUpperCase() | |
19 | + code = str_temp.charCodeAt(); | |
20 | + on_index=code-65; | |
21 | + if(code<(65+a_num)){ | |
22 | + console.log(str_temp); | |
23 | + $(".question_list").append('<div class="question question'+(i+1)+'"><span>'+(i+1)+'、</span><ul></ul></div>'); | |
24 | + for(var j=0;j<a_num;j++){ | |
25 | + option=String.fromCharCode(0x41+j); | |
26 | + if(on_index==j){ | |
27 | + console.log(on_index+"---"+j); | |
28 | + $(".question"+(i+1)+' ul').append('<li class="btn btn-default on">'+option+'</li>'); | |
29 | + }else | |
30 | + $(".question"+(i+1)+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
31 | + } | |
32 | + }else{ | |
33 | + alert("题目"+(i+1)+":"+String.fromCharCode(code)+"答案错误,超出选项数"); | |
34 | + //return; | |
35 | + } | |
36 | + } | |
37 | + $(".section-1").attr("data-score",$(".section-1").find(".question").length*fraction); | |
38 | + } | |
39 | + | |
40 | + /*********** | |
41 | + *1、单选题 | |
42 | + *2、完形填空 | |
43 | + *3、阅读理解 | |
44 | + *4、判断题 | |
45 | + *5、多选题 | |
46 | + ***********/ | |
47 | + | |
48 | + function addQuestion(type,a_num,index_s_2,index_e_2,fraction2){ | |
49 | + console.log(type); | |
50 | + answer_index_b=$(".section").length+1; | |
51 | + var question_num=SectionToChinese($(".section").length+1); | |
52 | + switch(type){ | |
53 | + case 1: //单选题 | |
54 | + //alert(typeof(index_s_2)); | |
55 | + $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</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>'); | |
56 | + for(i=index_s_2;i<=index_e_2;i++){ | |
57 | + $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
58 | + for(var j=0;j<a_num;j++){ | |
59 | + option=String.fromCharCode(0x41+j); | |
60 | + $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
61 | + } | |
62 | + } | |
63 | + break; | |
64 | + case 2: //完形填空 | |
65 | + $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</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>'); | |
66 | + for(var i=index_s_2;i<=index_e_2;i++){ | |
67 | + $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
68 | + for(var j=0;j<a_num;j++){ | |
69 | + option=String.fromCharCode(0x41+j); | |
70 | + $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
71 | + } | |
72 | + } | |
73 | + break; | |
74 | + case 3: //阅读理解 | |
75 | + $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</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>'); | |
76 | + for(var i=index_s_2;i<=index_e_2;i++){ | |
77 | + $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
78 | + for(var j=0;j<a_num;j++){ | |
79 | + option=String.fromCharCode(0x41+j); | |
80 | + $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
81 | + } | |
82 | + } | |
83 | + break; | |
84 | + case 4: //判断题 | |
85 | + $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</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>'); | |
86 | + for(var i=index_s_2;i<=index_e_2;i++){ | |
87 | + $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
88 | + for(var j=0;j<a_num;j++){ | |
89 | + if(j%2==0) | |
90 | + option="√"; | |
91 | + else | |
92 | + option="×"; | |
93 | + $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
94 | + } | |
95 | + } | |
96 | + break; | |
97 | + case 5: //多选题 | |
98 | + $(".content").append('<div class="section section-'+answer_index_b+' check" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</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>'); | |
99 | + for(var i=index_s_2;i<=index_e_2;i++){ | |
100 | + $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
101 | + for(var j=0;j<a_num;j++){ | |
102 | + option=String.fromCharCode(0x41+j); | |
103 | + $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
104 | + } | |
105 | + } | |
106 | + break; | |
107 | + } | |
108 | + $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); | |
109 | + } | |
110 | + | |
111 | + $(document).on('click','.remove',function(){ //删除按钮 | |
112 | + $(this).parent().parent(".section").remove(); | |
113 | + }) | |
114 | + | |
115 | + $("#fast_submit").click(function(){ //点击确定,创建答案列表 | |
116 | + $("#addQuestion").attr("disabled","disabled"); | |
117 | + var answer=$("#answer").val(); | |
118 | + var num_ans=$("#num_ans").val(); | |
119 | + var fraction=$("#fraction").val(); | |
120 | + if(answer==''){ | |
121 | + alert("请输入题目答案,以分号隔开"); | |
122 | + return; | |
123 | + }else if(fraction==''){ | |
124 | + alert("请输入题目分数"); | |
125 | + return; | |
126 | + } | |
127 | + $('.fast').modal('hide'); | |
128 | + //score += parseInt(fraction)*answer.split(",").length; | |
129 | + creat(answer,num_ans,fraction); | |
130 | + }) | |
131 | + | |
132 | + /*添加试题的确定按钮*/ | |
133 | + $("#addQuestion_submit").click(function(){ | |
134 | + $("#fast").attr("disabled","disabled"); | |
135 | + var type_2=parseInt($("#type").val()); | |
136 | + var index_s_2=parseInt($("#index_s_2").val()); | |
137 | + var index_e_2=parseInt($("#index_e_2").val()); | |
138 | + //var answer_2=$("#answer_2").val(); | |
139 | + var num_ans_2=$("#num_ans_2").val(); | |
140 | + var fraction2=parseInt($("#fraction2").val()); | |
141 | + if(index_s_2==''){ | |
142 | + alert("请输入题目开始序号"); | |
143 | + return; | |
144 | + }else if(index_e_2==''){ | |
145 | + alert("请输入题目结束序号"); | |
146 | + return; | |
147 | + } | |
148 | + //console.log(typeof(type_2)); | |
149 | + addQuestion(type_2,num_ans_2,index_s_2,index_e_2,fraction2); | |
150 | + $('.addQuestion').modal('hide'); | |
151 | + }) | |
152 | + $("#type").change(function(){ | |
153 | + if($("#type").val()==4){ | |
154 | + $("#num_ans_2").val(2); | |
155 | + $("#num_ans_2").attr("disabled","disabled"); | |
156 | + }else{ | |
157 | + $("#num_ans_2").removeAttr("disabled"); | |
158 | + $("#num_ans_2").val(4); | |
159 | + | |
160 | + } | |
161 | + }) | |
162 | + /*更改考试时长*/ | |
163 | + $("#time_submit").click(function(){ | |
164 | + var test_time=$("#enter_time").val(); | |
165 | + if(test_time==''){ | |
166 | + alert("请输入考试时间"); | |
167 | + return; | |
168 | + } | |
169 | + $("#time").html(test_time); | |
170 | + $('.test_time').modal('hide'); | |
171 | + }) | |
172 | + /*更改单选答案*/ | |
173 | + $(document).on('click','.single li',function(){ | |
174 | + $(this).siblings().removeClass("on"); | |
175 | + $(this).addClass("on"); | |
176 | + }) | |
177 | + /*更改多选答案*/ | |
178 | + $(document).on('click','.check li',function(){ | |
179 | + //$(this).siblings().removeClass("on"); | |
180 | + $(this).addClass("on"); | |
181 | + }) | |
182 | + /*提交保存数据*/ | |
183 | + $("#save").click(function(){ | |
184 | + var url=URL; | |
185 | + for(i=0;i<$(".section").length;i++){ | |
186 | + score+=parseInt($(".section").eq(i).attr("data-score")); | |
187 | + } | |
188 | + var data={ | |
189 | + title: $(".header_box h1").text(), | |
190 | + exam_time: parseInt($("#time").text()), | |
191 | + paper_type: testData.paper_type, | |
192 | + subject_id: testData.subject_id, | |
193 | + grade_id: testData.grade_id, | |
194 | + user_id: testData.user_id, | |
195 | + score:score, | |
196 | + questions:[] | |
197 | + } | |
198 | + | |
199 | + if($(".section").length>0){ | |
200 | + var rank=0 | |
201 | + for(i=0;i<$(".section").length;i++){ | |
202 | + rank++; | |
203 | + data.questions[i]={ | |
204 | + chapter_id: "0", | |
205 | + problem_type_id: "0", | |
206 | + knowledge_id: "0", | |
207 | + content: $(".section").eq(i).find(".que_name").text(), | |
208 | + option_num: "", | |
209 | + option_content: "", | |
210 | + answer: "", | |
211 | + difficulty: "", | |
212 | + analysis: "", | |
213 | + question_from: "", | |
214 | + score:parseInt($(".section").eq(i).attr("data-fraction")), | |
215 | + part_score: "", | |
216 | + remark: "", | |
217 | + rank: rank, | |
218 | + no_name: $(".section").eq(i).find(".que_num").text(), | |
219 | + questions:[] | |
220 | + } | |
221 | + for(j=0;j<$(".section").eq(i).find(".question_list").children(".question").length;j++){ | |
222 | + rank++; | |
223 | + var on_num=$(".section").eq(i).find(".question").eq(j).find(".on").length; | |
224 | + var answer=""; | |
225 | + for(k=0;k<on_num;k++){ | |
226 | + answer+=$(".section").eq(i).find(".question").eq(j).find(".on").eq(k).text(); | |
227 | + //console.log(answer); | |
228 | + } | |
229 | + data.questions[i].questions[j]={ | |
230 | + chapter_id: "0", | |
231 | + problem_type_id: "0", | |
232 | + knowledge_id: "0", | |
233 | + content: "", | |
234 | + option_num: $(".section").eq(i).find(".question").eq(j).find("li").length, | |
235 | + option_content: "", | |
236 | + answer: answer, | |
237 | + difficulty: "0", | |
238 | + analysis: "", | |
239 | + question_from: "1", | |
240 | + score: parseInt($(".section").eq(i).attr("data-fraction")), | |
241 | + part_score: "0", | |
242 | + remark: "", | |
243 | + rank: rank, | |
244 | + no_name: (i+1)+'.'+(j+1), | |
245 | + } | |
246 | + } | |
247 | + } | |
248 | + } | |
249 | + | |
250 | + if(data.questions.length>0){ | |
251 | + data=JSON.stringify(data); | |
252 | + dataJson={"json":data}; | |
253 | + console.log(data); | |
254 | + ajax_submit(url,dataJson); | |
255 | + } | |
256 | + else | |
257 | + alert("请添加试题"); | |
258 | + }) | |
259 | +}) | |
260 | + | |
261 | + | |
262 | + | |
263 | + | |
264 | +/*ajax封装函数*/ | |
265 | +function ajax_submit(url,data){ | |
266 | + $(".loading").css("display","block"); | |
267 | + | |
268 | + $.ajax({ | |
269 | + url:url, | |
270 | + type:"POST", | |
271 | + data:data, | |
272 | + dataType:"json", | |
273 | + success:function(data){ | |
274 | + $(".loading").css("display","none"); | |
275 | + window.location.href = JUMP_URL ; | |
276 | + } | |
277 | + }) | |
278 | +} | |
279 | +function fastSort(array,head,tail){ | |
280 | + //考虑到给每个分区操作的时候都是在原有的数组中进行操作的,所以这里head,tail来确定分片的位置 | |
281 | + /*生成随机项*/ | |
282 | + var randomnum = parseInt((head + tail) / 2 ); | |
283 | + var random = array[randomnum]; | |
284 | + /*将小于random的项放置在其左边 策略就是通过一个临时的数组来储存分好区的结果,再到原数组中替换*/ | |
285 | + var arrayTemp = []; | |
286 | + var unshiftHead = 0; | |
287 | + for(var i = head;i <= tail;i++){ | |
288 | + if(parseInt(array[i].rank)<parseInt(random.rank)){ | |
289 | + arrayTemp.unshift(array[i]); | |
290 | + unshiftHead++; | |
291 | + }else if(parseInt(array[i].rank)>parseInt(random.rank)){ | |
292 | + arrayTemp.push(array[i]); | |
293 | + } | |
294 | + /*当它等于的时候放哪,这里我想选择放到队列的前面,也就是从unshift后的第一个位置放置*/ | |
295 | + if(parseInt(array[i].rank)===parseInt(random.rank)){ | |
296 | + arrayTemp.splice(unshiftHead,0,array[i]); | |
297 | + } | |
298 | + } | |
299 | + /*将对应项覆盖原来的记录*/ | |
300 | + for(var j = head , u=0;j <= tail;j++,u++){ | |
301 | + array.splice(j,1,arrayTemp[u]); | |
302 | + } | |
303 | + /*寻找中间项所在的index*/ | |
304 | + var nowIndex = array.indexOf(random); | |
305 | + | |
306 | + /*设置出口,当要放进去的片段只有2项的时候就可以收工了*/ | |
307 | + if(arrayTemp.length <= 2){ | |
308 | + return; | |
309 | + } | |
310 | + /*递归,同时应用其左右两个区域*/ | |
311 | + fastSort(array,head,nowIndex); | |
312 | + fastSort(array,nowIndex+1,tail); | |
313 | + } | |
314 | +if(testData.questions.length > 0){ | |
315 | + fastSort(testData.questions,0,testData.questions.length-1); | |
316 | + for(var i = 0 ; i < testData.questions.length;i++){ | |
317 | + if(testData.questions[0].questions.length > 1){ | |
318 | + fastSort(testData.questions[i].questions,0,testData.questions[i].questions.length-1); | |
319 | + } | |
320 | + } | |
321 | + | |
322 | +} | |
323 | +creatHtml(testData); | |
324 | +function creatHtml(data){ | |
325 | + console.log(data); | |
326 | + $(".header_box h1").html(data.title); | |
327 | + $("#time").html(data.exam_time); | |
328 | + for(var i=0;i<data.questions.length;i++){ | |
329 | + $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'"> <h3><span class="que_num">'+data.questions[i].no_name+'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> <div class="question_list"></div></div>') | |
330 | + if(data.questions.length>0){ | |
331 | + $(".time").removeAttr("data-target"); | |
332 | + $(".remove").remove(); | |
333 | + $(".btn_box").remove(); | |
334 | + } | |
335 | + for(var j=0;j<data.questions[i].questions.length;j++){ | |
336 | + $(".section-"+i).find(".question_list").append('<div class="question question'+(j+1)+'"><span>'+(j+1)+'、</span><ul></ul></div>'); | |
337 | + if($(".section-"+i).find(".que_name").text()=="判断题"){ | |
338 | + for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){ | |
339 | + str_temp=data.questions[i].questions[j].answer; | |
340 | + if(k%2==0){ | |
341 | + $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">√</li>'); | |
342 | + }else if(k%2==1){ | |
343 | + $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">×</li>'); | |
344 | + } | |
345 | + | |
346 | + if(str_temp=="√") | |
347 | + $(".section-"+i).find(".question"+(j+1)+' ul li').eq(0).attr("class","btn btn-default on"); | |
348 | + else | |
349 | + $(".section-"+i).find(".question"+(j+1)+' ul li').eq(1).attr("class","btn btn-default on"); | |
350 | + } | |
351 | + }else{ | |
352 | + for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){ | |
353 | + str_temp=data.questions[i].questions[j].answer; | |
354 | + $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">'+String.fromCharCode(0x41+k)+'</li>'); | |
355 | + for(var l=0;l<str_temp.length;l++){ | |
356 | + str_temp_arry=str_temp.split(''); | |
357 | + code=str_temp_arry[l].charCodeAt(); | |
358 | + on_index=code-65; | |
359 | + if(on_index==k){ | |
360 | + $(".section-"+i).find(".question"+(j+1)+' ul li').eq(on_index).attr("class","btn btn-default on"); | |
361 | + } | |
362 | + } | |
363 | + } | |
364 | + } | |
365 | + } | |
366 | + } | |
367 | + } | |
368 | +/*快速建题中,每输入五个答案就加一个空格*/ | |
369 | +$("#answer").on("input propertychange",function(){ | |
370 | + if($("#answer").val().length%5==0) | |
371 | + $("#answer").val($("#answer").val()+" "); | |
372 | +}) | |
373 | + | |
374 | +/*数字转汉字数字*/ | |
375 | +var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"]; | |
376 | + var chnUnitSection = ["","万","亿","万亿","亿亿"]; | |
377 | + var chnUnitChar = ["","十","百","千"]; | |
378 | + | |
379 | + function SectionToChinese(section){ | |
380 | + var strIns = '', chnStr = ''; | |
381 | + var unitPos = 0; | |
382 | + var zero = true; | |
383 | + while(section > 0){ | |
384 | + var v = section % 10; | |
385 | + if(v === 0){ | |
386 | + if(!zero){ | |
387 | + zero = true; | |
388 | + chnStr = chnNumChar[v] + chnStr; | |
389 | + } | |
390 | + }else{ | |
391 | + zero = false; | |
392 | + strIns = chnNumChar[v]; | |
393 | + strIns += chnUnitChar[unitPos]; | |
394 | + chnStr = strIns + chnStr; | |
395 | + } | |
396 | + unitPos++; | |
397 | + section = Math.floor(section / 10); | |
398 | + } | |
399 | + return chnStr; | |
400 | + } | |
401 | + | |
402 | + | |
403 | + | |
404 | + | |
405 | + | ... | ... |
src/com/fh/controller/sunvote/coursemanagement/CourseManagementController.java
... | ... | @@ -30,6 +30,7 @@ import com.fh.service.sunvote.coursemanagement.CourseManagementManager; |
30 | 30 | import com.fh.service.sunvote.sclass.SClassManager; |
31 | 31 | import com.fh.service.sunvote.subject.SubjectManager; |
32 | 32 | import com.fh.service.sunvote.teacher.TeacherManager; |
33 | +import com.fh.service.sunvote.term.TermManager; | |
33 | 34 | |
34 | 35 | /** |
35 | 36 | * 说明:任课管理 |
... | ... | @@ -53,6 +54,9 @@ public class CourseManagementController extends BaseController { |
53 | 54 | @Resource(name="subjectService") |
54 | 55 | private SubjectManager subjectService; |
55 | 56 | |
57 | + @Resource(name="termService") | |
58 | + private TermManager termService; | |
59 | + | |
56 | 60 | /**保存 |
57 | 61 | * @param |
58 | 62 | * @throws Exception |
... | ... | @@ -96,6 +100,7 @@ public class CourseManagementController extends BaseController { |
96 | 100 | ModelAndView mv = this.getModelAndView(); |
97 | 101 | PageData pd = new PageData(); |
98 | 102 | pd = this.getPageData(); |
103 | + | |
99 | 104 | coursemanagementService.edit(pd); |
100 | 105 | mv.addObject("msg","success"); |
101 | 106 | mv.setViewName("save_result"); |
... | ... | @@ -144,6 +149,9 @@ public class CourseManagementController extends BaseController { |
144 | 149 | List<PageData> subjects = subjectService.listAll(pd); |
145 | 150 | mv.addObject("subjects", subjects); |
146 | 151 | |
152 | + List<PageData> terms = termService.listAll(pd); | |
153 | + mv.addObject("terms", terms); | |
154 | + | |
147 | 155 | mv.addObject("msg", "save"); |
148 | 156 | mv.addObject("pd", pd); |
149 | 157 | return mv; |
... | ... | @@ -166,6 +174,8 @@ public class CourseManagementController extends BaseController { |
166 | 174 | mv.addObject("classs",classs); |
167 | 175 | List<PageData> subjects = subjectService.listAll(pd); |
168 | 176 | mv.addObject("subjects", subjects); |
177 | + List<PageData> terms = termService.listAll(pd); | |
178 | + mv.addObject("terms", terms); | |
169 | 179 | |
170 | 180 | mv.addObject("msg", "edit"); |
171 | 181 | mv.addObject("pd", pd); | ... | ... |