Browse Source

修改bug24787

namejr 4 years ago
parent
commit
b0311e7b4e
3 changed files with 18 additions and 6 deletions
  1. 2 1
      EBook.Web/Common/tasklib_book.css
  2. 14 5
      EBook.Web/Common/tasklib_book.js
  3. 2 0
      EBook.Web/EBook.Web.csproj

+ 2 - 1
EBook.Web/Common/tasklib_book.css

@@ -147,7 +147,8 @@ p .answer-body:first-child{
     z-index: 3;
     border-radius:3px;
 }
-.TableContainer[data-isaflag='1'] td{
+/*不全为多选框*/
+.TableContainer[data-isaflag='1'][data-allcb='0'] td{
     min-width:205px !important;
 }
 td p{

+ 14 - 5
EBook.Web/Common/tasklib_book.js

@@ -155,6 +155,14 @@ var removeHtmlFunc = function (htmlStr, TdWidthVal) {
             }
         }
     }
+    // 去除多空格
+    while (htmlStr.match(/\s\s/g)) {
+        htmlStr = htmlStr.replace(/\s\s/g, " ");
+    }
+    while (htmlStr.indexOf("  ")>-1) {
+        htmlStr = htmlStr.replace("  ", " ");
+    }
+
     ReArr.TextStr = htmlStr;
     return ReArr;
 };
@@ -232,6 +240,7 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
             // 判断是否存在答题点
             NewAStatus = $(item).find(".yaoshi").length > 0 ? 1 : 0;
         }
+        var CheckBoxFlag = $(item).find(".boxQue").length > 0 && $(item).find(".boxQue").length == $(item).find(".yaoshi").length;  // 判断是否是只存在多选框,定位对应的列
         $.each($(item).find("tr"), function (trIndex, trItem) {
             $.each($(trItem).find("td"), function (tdIndex, tdItem) {
                 var RowSpanNum = parseInt($(tdItem).attr("rowspan"));
@@ -262,10 +271,10 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
                     tdWidthVal = ScreenWidth;
                 }
                 // 判断是否需要设置最小宽度
-                if (tdWidthVal < TempMinWidth && NewAStatus == 1) {
+                if (tdWidthVal < TempMinWidth && NewAStatus == 1 && !CheckBoxFlag) {
                     tdWidthVal = TempMinWidth;
                 }
-                if (tdWidthVal < 100 && NewAStatus == 1) {
+                if (tdWidthVal < 100 && NewAStatus == 1 && !CheckBoxFlag) {
                     tdWidthVal = 100;
                 }
                 if (ArrMaxLen.length < tdIndex + 1) {
@@ -314,11 +323,11 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
             for (var i = 0; i < ArrMaxLen.length; i++) {
                 if (ArrMaxLen[i] != undefined && ($(item).find("td").length > 1 || $(item).find("tr").length > 1) && RuleFlag) {
                     if (i < ArrMaxLen.length - 1) {
-                        $(item).find("tr").eq(0).find("td").eq(i).css("width", ArrMaxLen[i] + "px");
+                        $(item).find("tr").find("td").eq(i).css("width", ArrMaxLen[i] + "px");
                         TableWidth += ArrMaxLen[i];
                     }
                     else {
-                        $(item).find("tr").eq(0).find("td").eq(i).css("width", (ArrMaxLen[i] - 10) + "px");
+                        $(item).find("tr").find("td").eq(i).css("width", (ArrMaxLen[i] - 10) + "px");
                         TableWidth += (ArrMaxLen[i] - 10);
                     }
                 }
@@ -353,7 +362,7 @@ var AdjustTableFunc = function (sWidthVal, isAStatus) {
         }
         // 替换HTML
         var ChildhtmlStr = $(item).prop("outerHTML");
-        var htmlStr = "<div class='TableContainer TContain_" + index + "' data-isaflag='" + NewAStatus + "'></div>";
+        var htmlStr = "<div class='TableContainer TContain_" + index + "' data-isaflag='" + NewAStatus + "' data-allcb='" + (CheckBoxFlag ? 1 : 0) + "'></div>";
         $(item).after(htmlStr);
         $(item).remove();
         var JqStr = ".TContain_" + index;

+ 2 - 0
EBook.Web/EBook.Web.csproj

@@ -63,7 +63,9 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="698.html" />
+    <Content Include="AnsText\12.txt" />
     <Content Include="AnsText\2021412高亮.txt" />
+    <Content Include="AnsText\2021416.txt" />
     <Content Include="AnsText\20578.txt" />
     <Content Include="AnsText\20799.txt" />
     <None Include="AnsText\21255.json" />