Commit d8d825b795011555a2d323cce6de9fae50f6a0ec

Authored by 孙向锦
1 parent 90d4858f

修复2个bug 点击同步教材 卡死 英语试题没用下划线

WebRoot/WEB-INF/jsp/sunvote/teacher/set_question.jsp
@@ -102,5 +102,5 @@ @@ -102,5 +102,5 @@
102 </script> 102 </script>
103 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script> 103 <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
104 <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 104 <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
105 - <script src="../static/js/set_question.js?a=1"></script> 105 + <script src="../static/js/set_question.js?a=0"></script>
106 </html> 106 </html>
107 \ No newline at end of file 107 \ No newline at end of file
WebRoot/static/js/set_question.js
@@ -131,12 +131,14 @@ var url=&quot;&quot;; @@ -131,12 +131,14 @@ var url=&quot;&quot;;
131 console.log(data); 131 console.log(data);
132 if(data.data.length>0){ 132 if(data.data.length>0){
133 for(var i=0;i<data.data.length;i++){ 133 for(var i=0;i<data.data.length;i++){
  134 +
134 _html += '<li data-id="'+data.data[i].QUESTION_ID+'" data-knowledge="' + knowledge_id + '"><div class="content"></div><div class="option"><ul></ul></div><div class="resolve"><div class="resolve_box"><p><span>【答案】</span> '+data.data[i].ANSWER+'</p><p><span>【解析】</span>'+data.data[i].ANALYSIS+'</p></div></div><div class="star_box"><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a><div class="check_box"></div></div></div><div class="clearfix"></div></div></li>'; 135 _html += '<li data-id="'+data.data[i].QUESTION_ID+'" data-knowledge="' + knowledge_id + '"><div class="content"></div><div class="option"><ul></ul></div><div class="resolve"><div class="resolve_box"><p><span>【答案】</span> '+data.data[i].ANSWER+'</p><p><span>【解析】</span>'+data.data[i].ANALYSIS+'</p></div></div><div class="star_box"><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a onclick="slide($(this))">查看解析</a><div class="check_box"></div></div></div><div class="clearfix"></div></div></li>';
135 } 136 }
136 $(".question_box").children("ul").append(_html); 137 $(".question_box").children("ul").append(_html);
137 console.log(5*(pageNum-1)); 138 console.log(5*(pageNum-1));
138 for(var j=5*(pageNum-1);j<(data.data.length+5*(pageNum-1));j++){ 139 for(var j=5*(pageNum-1);j<(data.data.length+5*(pageNum-1));j++){
139 var option_html=""; 140 var option_html="";
  141 + data.data[j-5*(pageNum-1)].CONTENT = data.data[j-5*(pageNum-1)].CONTENT.replace('<fill></fill>','______');
140 $(".question_box li .content").eq(j).append('<span>'+(j+1)+'、</span>'+data.data[j-5*(pageNum-1)].CONTENT); 142 $(".question_box li .content").eq(j).append('<span>'+(j+1)+'、</span>'+data.data[j-5*(pageNum-1)].CONTENT);
141 var arry_option=data.data[j-5*(pageNum-1)].OPTION_CONTENT; 143 var arry_option=data.data[j-5*(pageNum-1)].OPTION_CONTENT;
142 if(question_box.indexOf(data.data[j-5*(pageNum-1)].QUESTION_ID)>=0){ 144 if(question_box.indexOf(data.data[j-5*(pageNum-1)].QUESTION_ID)>=0){
@@ -186,37 +188,49 @@ var url=&quot;&quot;; @@ -186,37 +188,49 @@ var url=&quot;&quot;;
186 data:{subject_id:subject_id}, 188 data:{subject_id:subject_id},
187 success:function(data){ 189 success:function(data){
188 console.log(data); 190 console.log(data);
189 - if(data.data.length>0){  
190 - var teach_html="";  
191 -  
192 -  
193 - for(var i=0;i<data.data.length;i++){  
194 - teach_html += '<li data-id="'+data.data[i].ID+'" class="li_name"><p class="name">'+data.data[i].NAME+'</p><img src="../static/images/arrow_right.png" /><div class="clearfix"></div></li>';  
195 - }  
196 - $(".book_box ul").html(teach_html);  
197 - var li_length=$(".book_box ul li").length;  
198 - for(var k=0;k<li_length;k++){  
199 - var books=[];  
200 - var book_html="";  
201 - var book_id=$(".book_box ul").children("li").eq(k).attr("data-id");  
202 -  
203 - if(textBook(book_id).length>0){  
204 -  
205 - books=textBook($(".book_box ul li").eq(k).attr("data-id"));  
206 - $(".book_box ul li").eq(k).append('<div class="float_box"><ul><div class="clearfix"></div></ul></div>');  
207 -  
208 - for(var j=0;j<books.length;j++){  
209 - console.log("j:"+j);  
210 - book_html += '<li data-id='+books[j].id+'>'+books[j].name+'</li>'; 191 + if (data.data.length > 0) {
  192 + var teach_html = "";
  193 + for (var i = 0; i < data.data.length; i++) {
  194 + teach_html += '<li data-id="'
  195 + + data.data[i].ID
  196 + + '" class="li_name"><p class="name">'
  197 + + data.data[i].NAME
  198 + + '</p><img src="../static/images/arrow_right.png" /><div class="clearfix"></div></li>';
  199 + }
  200 + $(".book_box ul").html(teach_html);
  201 + var li_length = $(".book_box ul li").length;
  202 + for (var k = 0; k < li_length; k++) {
  203 + var books = [];
  204 + var book_html = "";
  205 + var book_id = $(".book_box ul").children("li")
  206 + .eq(k).attr("data-id");
  207 +
  208 + if (textBook(book_id).length > 0) {
  209 +
  210 + books = textBook($(".book_box ul li").eq(k)
  211 + .attr("data-id"));
  212 + $(".book_box ul li").eq(k).append('<div class="float_box"><ul><div class="clearfix"></div></ul></div>');
  213 +
  214 + for (var j = 0; j < books.length; j++) {
  215 + console.log("j:" + j);
  216 + book_html += '<li data-id=' + books[j].id
  217 + + '>' + books[j].name + '</li>';
  218 + }
  219 + $(".float_box").eq(k).children("ul").find(
  220 + ".clearfix").before(book_html);
  221 + TEXTBOOK_ID = books[0].id;
211 } 222 }
212 - $(".float_box").eq(k).children("ul").find(".clearfix").before(book_html);  
213 - TEXTBOOK_ID=books[0].id; 223 +
214 } 224 }
215 - 225 + getChapter(TEXTBOOK_ID);
  226 + $("#book_name").text(
  227 + $(".name").eq(0).text()
  228 + + "/"
  229 + + $(".float_box").eq(0).find('li')
  230 + .eq(0).text());
  231 + }else{
  232 + window.top.loading.remove();
216 } 233 }
217 - getChapter(TEXTBOOK_ID);  
218 - $("#book_name").text($(".name").eq(0).text()+"/"+$(".float_box").eq(0).find('li').eq(0).text());  
219 - }  
220 234
221 }, 235 },
222 error: function (XMLHttpRequest, textStatus, errorThrown) { 236 error: function (XMLHttpRequest, textStatus, errorThrown) {