瀏覽代碼

。。。。

lujianhong 4 年之前
父節點
當前提交
c417809ce1
共有 1 個文件被更改,包括 9 次插入17 次删除
  1. 9 17
      EBook.Web/Common/tasklib_book.js

+ 9 - 17
EBook.Web/Common/tasklib_book.js

@@ -181,21 +181,6 @@ function bindEventYS() {
     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) {
@@ -240,11 +225,18 @@ function bindEventYS() {
         $(item).css("width", bodyWidth + "px");
     });
     //获取两个之间的答题点
-    var index = 1;
     var checkId = 0;
+    var headid = -1;
+    var groupId = -1;
     $.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 gid = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
+        if (index == 0 || groupId != gid) {
+            groupId = gid;
+            headid = checkId;
+        }
+        $(item).find('.yaoshi').attr('parent-anid', headid);
+
         var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
         //勾选题
         if ($(item).hasClass('boxQue')) {