소스 검색

恢复叼毛编译器乱删拉取代码

namejr 4 년 전
부모
커밋
d243084d68
1개의 변경된 파일32개의 추가작업 그리고 0개의 파일을 삭제
  1. 32 0
      EBook.Web/Common/tasklib_book.js

+ 32 - 0
EBook.Web/Common/tasklib_book.js

@@ -178,8 +178,24 @@ function bindEventYS() {
     //不存在underline 属性下有内容,所以全部隐藏,若有就是源头数据有问题
     $('.underline').css("display", "none");
     //给每个答题点加上ID
+    var headid = -1;//基序号
     $.each($(".yaoshi"), function (index, item) {
         $(item).attr('answer-id', index);
+        //如果是打勾题、或纠错题,加上辅助头ID
+        var parent = $(item).parent();
+        if ($(parent).hasClass('correntQue') || $(parent).hasClass('boxQue')) {
+            if(headid != -1) {
+                var gid = $(parent).attr('class').replace(/.*group(\d+).*/g, "$1");//相当于偏移序号
+                $(item).attr('parent-anid', headid +Number(gid) -1);
+            }
+            else {
+                headid = index;
+                $(item).attr('parent-anid', headid);
+            }
+        }
+        else {
+            headid = - 1;
+        }
     });
     //给音频绑定一个ID
     $.each($(".audioImg"), function (index, item) {
@@ -230,9 +246,11 @@ function bindEventYS() {
         checkId = $(item).find('.yaoshi').attr("answer-id");
         var index = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
         var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
+        //勾选题
         if ($(item).hasClass('boxQue')) {
             $(item).find('.yaoshi').after("<div class='checkbox'><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
             $(item).find('input').prop('checked', ischecked);
+            $(item).find('.underlineContent').hide();
         }
     });
 
@@ -476,6 +494,20 @@ function handleAnswerRange() {
         }
     }
 
+    //获取两个之间的答题点
+    var index = 1;
+    var checkId = 0;
+    $.each($(".multipleStart").nextUntil(".multipleEnd").filter("[class*='group']"), function (index, item) {
+        checkId = $(item).find('.yaoshi').attr("answer-id") ;
+        var index = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
+        var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
+            //勾选题
+        if ($(item).hasClass('boxQue')) {
+            $(item).find('.yaoshi').after("<div class='checkbox'><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
+            $(item).find('input').prop('checked', ischecked);
+            $(item).find('.underlineContent').hide();
+        }
+    });
     //添加答题点的点击UI及交互
     $.each($(".tag-span"), function (index, item) {
         var answerText = "";