Sfoglia il codice sorgente

Merge branch 'PCAssist' of CallPro/EBook into master

陆剑鸿 4 anni fa
parent
commit
a7becf8586
2 ha cambiato i file con 32 aggiunte e 5 eliminazioni
  1. 4 1
      EBook.Web/Common/tasklib_book.css
  2. 28 4
      EBook.Web/Common/tasklib_book.js

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

@@ -91,7 +91,7 @@ p .answer-body:first-child{
     line-height: 5px;
     position: relative;
     left: 0px;
-    bottom: 0px;
+    bottom: -1px;
     background-color: #eee;
     z-index: 2;
     overflow:hidden;
@@ -107,4 +107,7 @@ p .answer-body:first-child{
 }
 .TableContainer td{
     min-width:135px !important;
+}
+td p{
+    line-height: 25px !important;
 }

+ 28 - 4
EBook.Web/Common/tasklib_book.js

@@ -36,11 +36,37 @@ var GetPadVal = function () {
     }
 };
 var AdjustTableFunc = function () {
+    // 添加宽度处理
+    $("td").attr("style", "");
+    $(document.body).append('<span id="pContrainId"></span>');
     var Index = 0;
     $.each($("table"), function (index, item) {
-        var TableWidth = isNaN(parseFloat($(item).width())) ? 0 : parseFloat($(item).width());  // 表格宽度
+        // 处理表格总宽度
+        var ArrMaxLen = [];
+        var TableWidth = 0;
+        $.each($(item).find("tr"), function (trIndex, trItem) {
+            $.each($(trItem).find("td"), function (tdIndex, tdItem) {
+                $("#pContrainId").text($(tdItem).text());
+                var tdWidthVal = $("#pContrainId").width();
+                if (trIndex == 0) {
+                    ArrMaxLen.push(tdWidthVal);
+                }
+                else {
+                    if (ArrMaxLen[tdIndex] < tdWidthVal) {
+                        ArrMaxLen[tdIndex] = tdWidthVal;
+                    }
+                }
+            });
+        });
+        for (var i = 0; i < ArrMaxLen.length; i++) {
+            if (ArrMaxLen[i] != undefined) {
+                $(item).find("tr").eq(0).find("td").eq(i).prop("style", "width:" + ArrMaxLen[i] + "px;");
+                TableWidth += ArrMaxLen[i];
+            }
+        }
+        $(item).css("width", TableWidth + "px");
         // 替换HTML
-        var ChildHtmlStr = $(item).prop("outerHTML")
+        var ChildHtmlStr = $(item).prop("outerHTML");
         var HtmlStr = "<div class='TableContainer TContain_" + Index + "'></div>";
         $(item).after(HtmlStr);
         $(item).remove();
@@ -471,7 +497,6 @@ function bindEventTeaOrignalYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
-    $("td").attr("style", "");
 }
 
 //页面加载完,课件 绑定事件
@@ -707,7 +732,6 @@ function bindEventYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
-    $("td").attr("style", "");
 }
 // 移动端使用,true:表示点击表格且正在移动,需阻止模块切换
 function getPressFlag() {