Browse Source

上传处理新结构

namejr 4 years ago
parent
commit
b3be74b8fa
2 changed files with 29 additions and 32 deletions
  1. 24 29
      EBook.Web/Common/tasklib_book.js
  2. 5 3
      EBook.Web/EBook.Web.csproj

+ 24 - 29
EBook.Web/Common/tasklib_book.js

@@ -910,13 +910,13 @@ var dealAnswerFunc = function (NodeHandle, OCFlag, ThProFlag) {
 function showHideAnswer(flag) {
     if (flag) {
         $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
-        $.each($(".underlineContent"), function (index, item) {
+        $.each($(".underlineContent").not(".noKey"), function (index, item) {
             dealAnswerFunc(item, true, false);
         });
     }
     else {
         $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
-        $.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
+        $.each($(".underlineContent,.underlineContent.no-answer").not(".noKey"), function (index, item) {
             dealAnswerFunc(item, false, false);
         });
     }
@@ -931,14 +931,14 @@ function showHideAnswerEx(isShowYX, isShowAS) {
         $(".yaoshi").hide();
     }
     if (isShowAS) {
-        $.each($(".underlineContent"), function (index, item) {
+        $.each($(".underlineContent").not(".noKey"), function (index, item) {
             dealAnswerFunc(item, true, false);
         });
         $(".yaoshi").attr("data-status", "1");
         $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
     }
     else {
-        $.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
+        $.each($(".underlineContent,.underlineContent.no-answer").not(".noKey"), function (index, item) {
             dealAnswerFunc(item, false, false);
         });
         $(".yaoshi").attr("data-status", "0");
@@ -1045,7 +1045,7 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus) {
                 $.each($(this).parents().find(".yaoshi[parent-anid='" + parentAnid + "']"), function (index, item) {
                     $(item).attr("data-status", "1");
                     $(item).attr("src", PicInfo.yaoshiShowImgUrl);
-                    $.each($(item).parent().find(".underlineContent"), function (cIndex, cItem) {
+                    $.each($(item).parent().find(".underlineContent").not(".noKey"), function (cIndex, cItem) {
                         dealAnswerFunc(cItem, true, false);
                     });
                 });
@@ -1053,7 +1053,7 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus) {
             else {
                 $(this).attr("data-status", "1");
                 $(this).attr("src", PicInfo.yaoshiShowImgUrl);
-                $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
+                $.each($(this).nextUntil(".yaoshi").find(".underlineContent").not(".noKey"), function (index, item) {
                     dealAnswerFunc(item, true, false);
                 });
             }
@@ -1069,7 +1069,7 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus) {
                 $.each($(this).parents().find(".yaoshi[parent-anid='" + parentAnid + "']"), function (index, item) {
                     $(item).attr("data-status", "0");
                     $(item).attr("src", PicInfo.yaoshiHideImgUrl);
-                    $.each($(item).parent().find(".underlineContent"), function (cIndex, cItem) {
+                    $.each($(item).parent().find(".underlineContent").not(".noKey"), function (cIndex, cItem) {
                         dealAnswerFunc(cItem, false, false);
                     });
                 });
@@ -1077,7 +1077,7 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus) {
             else {
                 $(this).attr("data-status", "0");
                 $(this).attr("src", PicInfo.yaoshiHideImgUrl);
-                $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
+                $.each($(this).nextUntil(".yaoshi").find(".underlineContent").not(".noKey"), function (index, item) {
                     dealAnswerFunc(item, false, false);
                 });
             }
@@ -1184,7 +1184,7 @@ function bindEventYS(sWidthVal, isAStatus) {
                 $.each($(this).parents().find(".yaoshi[parent-anid='" + parentAnid + "']"), function (index, fItem) {
                     $(fItem).attr("data-status", "1");
                     $(fItem).attr("src", PicInfo.yaoshiShowImgUrl);
-                    $.each($(fItem).parent().find(".underlineContent"), function (index, item) {
+                    $.each($(fItem).parent().find(".underlineContent").not(".noKey"), function (index, item) {
                         dealAnswerFunc(item, true, false);
                     });
                 });
@@ -1193,7 +1193,7 @@ function bindEventYS(sWidthVal, isAStatus) {
                 $(this).attr("data-status", "1");
                 $(this).attr("src", PicInfo.yaoshiShowImgUrl);
                 //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
-                $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
+                $.each($(this).nextUntil(".yaoshi").filter(".underlineContent").not(".noKey"), function (index, item) {
                     dealAnswerFunc(item, true, false);
                 });
             }
@@ -1209,7 +1209,7 @@ function bindEventYS(sWidthVal, isAStatus) {
                 $.each($(this).parents().find(".yaoshi[parent-anid='" + parentAnid + "']"), function (index, fItem) {
                     $(fItem).attr("data-status", "0");
                     $(fItem).attr("src", PicInfo.yaoshiHideImgUrl);
-                    $.each($(fItem).parent().find(".underlineContent"), function (index, item) {
+                    $.each($(fItem).parent().find(".underlineContent").not(".noKey"), function (index, item) {
                         dealAnswerFunc(item, false, false);
                     });
                 });
@@ -1218,7 +1218,7 @@ function bindEventYS(sWidthVal, isAStatus) {
                 $(this).attr("data-status", "0");
                 $(this).attr("src", PicInfo.yaoshiHideImgUrl);
                 //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
-                $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
+                $.each($(this).nextUntil(".yaoshi").filter(".underlineContent").not(".noKey"), function (index, item) {
                     dealAnswerFunc(item, false, false);
                 });
             }
@@ -1282,7 +1282,7 @@ function dealSULContentFunc(item, Id, pId) {
     var uLCClsName = $(item).attr("class");
     var nItem = $(item).next();
     var pItem = $(item).parent();
-    if (uLCClsName != undefined && uLCClsName.indexOf("underlineContent") > -1) {
+    if (uLCClsName != undefined && uLCClsName.indexOf("underlineContent") > -1 && uLCClsName.indexOf("noKey") == -1) {
         // 直接等于
         var info = new Object();
         info.Id = Id;
@@ -1311,7 +1311,7 @@ function dealSULContentFunc(item, Id, pId) {
         }
         else {
             // 查找子节点的underlineContent
-            $.each($(item).find(".underlineContent"), function (iIndex, iItem) {
+            $.each($(item).find(".underlineContent").not(".noKey"), function (iIndex, iItem) {
                 var info = new Object();
                 info.Id = Id;
                 info.pId = pId;
@@ -1323,7 +1323,7 @@ function dealSULContentFunc(item, Id, pId) {
                 reInfosArr.push(info);
                 info = null;
             });
-            $(item).find(".underlineContent").remove();
+            $(item).find(".underlineContent").not(".noKey").remove();
         }
     }
     if (nItem.length > 0) {
@@ -1518,16 +1518,6 @@ function handleAnswerRange() {
         for (var i = 0; i < tInfos.length; i++) {
             tempJson.push(tInfos[i]);
         }
-        //var prev = $(item).prev();
-        //if (!$(prev).hasClass("checkbox")) {
-        //    if (prev.length == 0 || $(prev).attr("class") != "tag-span") {
-        //        //替换答案
-        //        $(item).prop("outerHTML", "<span answer-id='" + info.Id + "' class='tag-span' answer-isky='0'>_</span>");
-        //    }
-        //    else {
-        //        $(item).remove();
-        //    }
-        //}
     });
     $.each($(".yaoshi"), function (index, item) {
         var Id = $(item).attr("answer-id");
@@ -1617,14 +1607,12 @@ function handleAnswerRange() {
             }
         }
     }
-
     //添加答题点的点击UI及交互
     $.each($(".tag-span"), function (index, item) {
         var answerText = "";
         var parentId = "";
         var isky = $(item).attr('answer-isky');
         var answerid = $(item).attr('answer-id');
-
         for (var i = 0; i < answerData.length; i++) {
             if (answerid == answerData[i].Id) {
                 parentId = answerData[i].pId;
@@ -1632,7 +1620,14 @@ function handleAnswerRange() {
                 break;
             }
         }
-        $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' parent-anid='" + parentId + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "' answer-showanswer='0' data-astatus='0' data-errstatus='0' onclick='ClickRecFunc(" + parentId + ")'><div class='answer-audio-range'><img class='nextpic' src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range'><div class='answer-point-range-div'><img class='nextpic' src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div></div><buttom class='answer-text'></buttom></div>");
+        // 删除多选框后面的答题点
+        prev = $(item).prev();
+        if ($(prev).hasClass("checkbox")) {
+            $(item).remove();
+        }
+        else {
+            $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' parent-anid='" + parentId + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "' answer-showanswer='0' data-astatus='0' data-errstatus='0' onclick='ClickRecFunc(" + parentId + ")'><div class='answer-audio-range'><img class='nextpic' src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range'><div class='answer-point-range-div'><img class='nextpic' src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div></div><buttom class='answer-text'></buttom></div>");
+        }
         //删除钥匙节点
         var prev = $("img[answer-id='" + answerid + "']");
         if (prev.length > 0) {
@@ -2447,7 +2442,7 @@ function showGLWorld(wordFlag, phraseFlag, sentenceFlag) {
     styleWPSContrl.wordFlag = wordFlag;
     styleWPSContrl.phraseFlag = phraseFlag;
     styleWPSContrl.sentenceFlag = sentenceFlag;
-    $.each($(".underlineContent").find("u[hitstyle='wordStyle'],span[hitstyle='wordStyle'],p[hitstyle='wordStyle'],u[hitstyle='phraseStyle'],span[hitstyle='phraseStyle'],p[hitstyle='phraseStyle'],u[hitstyle='sentenceStyle'],span[hitstyle='sentenceStyle'],p[hitstyle='sentenceStyle']"), function (index, element) {
+    $.each($(".underlineContent").find("u[hitstyle='wordStyle'],span[hitstyle='wordStyle'],p[hitstyle='wordStyle'],u[hitstyle='phraseStyle'],span[hitstyle='phraseStyle'],p[hitstyle='phraseStyle'],u[hitstyle='sentenceStyle'],span[hitstyle='sentenceStyle'],p[hitstyle='sentenceStyle']").not(".noKey"), function (index, element) {
         dealAnswerFunc(element, true, true);
     });
 }

+ 5 - 3
EBook.Web/EBook.Web.csproj

@@ -70,7 +70,6 @@
     <Content Include="AnsText\anstext.txt" />
     <Content Include="AnsText\answer.txt" />
     <Content Include="AnsText\21985.json" />
-    <Content Include="AnsText\data20210301.txt" />
     <Content Include="AnsText\GCZD.json" />
     <Content Include="AnsText\22034.json" />
     <Content Include="AnsText\220341.json" />
@@ -152,8 +151,11 @@
     <Content Include="Lghp\22788.lghp" />
     <Content Include="Lghp\data2021232037.lghp" />
     <Content Include="Lghp\bug22018.lghp" />
-    <Content Include="Lghp\data20210301.lghp" />
-    <Content Include="Lghp\data311940.lghp" />
+    <Content Include="Lghp\data2021311.lghp" />
+    <Content Include="Lghp\22081.lghp" />
+    <Content Include="Lghp\data2021311950.lghp" />
+    <Content Include="Lghp\data2021311956.lghp" />
+    <Content Include="Lghp\data3111343.lghp" />
     <None Include="Lghp\gaicuo.lghp" />
     <None Include="Lghp\TS.lghp" />
     <Content Include="NK\tasklib_book.css" />