Explorar el Código

Merge branch 'master' of http://192.168.3.18:3000/CallPro/EBook

pengmi hace 4 años
padre
commit
426b2fab29

+ 0 - 7
EBook.Web/Common/tasklib_book.css

@@ -78,11 +78,4 @@ p .answer-body:first-child{
 .underlineContentShow[data-status='1']{
     display:inline-block;
     border-bottom:1px solid rgb(151, 151, 151);
-}
-.container-table{
-    overflow-x:auto !important;
-    overflow-y:hidden !important;
-}
-.container-table td{
-    min-width:135px;
 }

+ 57 - 55
EBook.Web/Common/tasklib_book.js

@@ -1,5 +1,5 @@
 //播放音频图片地址
-var PicInfo = {
+var PicInfo1 = {
     answerPointImgUrl: "file:///android_asset/js/update-answer.png",
     yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
     yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
@@ -10,7 +10,7 @@ var PicInfo = {
 }
 
 //本地调用用的资源
-var PicInfo1 = {
+var PicInfo = {
     answerPointImgUrl: "../Images/update-answer.png",
     yaoshiShowImgUrl: "../Images/yaoshi-show.png",
     yaoshiHideImgUrl: "../Images/yaoshi-hide.png",
@@ -383,32 +383,33 @@ function bindEventTeaOrignalYS() {
     });
     $("td").attr("style", "");
     //处理表格样式
-    $(".container-table").each(function (index, item) {
-        var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
-        var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
-        var HWidth = parseFloat(TableWidth) -parseFloat(bodyWidth);
-        var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
-        var SSWidth = bodyWidth - HWidth * HRate;  // 显示滚动条宽度
-        if (TableWidth > bodyWidth) {
-            var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;border-radius:2px;'><div class='ShowSBarC' style='width:" +SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" +ScrollLeft + "px;bottom:0px;z-index:3;border-radius:2px;'></div></div>";
-            $(item).after(HtmlStr);
-            }
-            });
-    $(".container-table").on("touchstart", function () {
-        var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0: parseFloat($(this).find("table").css("width"));
-        if (TableWidth > bodyWidth) {
-            pressTableFlag = true;
-        }
-        }).on("touchmove", function () {
-        var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0: parseFloat($(this).find("table").css("width"));
-        var ScrollLeft = isNaN(parseFloat($(this).scrollLeft())) ? 0: parseFloat($(this).scrollLeft());
-        var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
-        var ShowSBarName = $(this).next().attr("class");
-        if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
-                // 有滚动条的进行移动
-            $(this).next().find(".ShowSBarC").css("left", (ScrollLeft*HRate) + "px");
-                }
-    });
+    //$(".container-table").each(function (index, item) {
+    //    var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
+    //    var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
+    //    var HWidth = parseFloat(TableWidth) -parseFloat(bodyWidth);
+    //    var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
+    //    var SSWidth = bodyWidth - HWidth * HRate;  // 显示滚动条宽度
+    //    if (TableWidth > bodyWidth) {
+    //        var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;border-radius:2px;'><div class='ShowSBarC' style='width:" +SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" +ScrollLeft + "px;bottom:0px;z-index:3;border-radius:2px;'></div></div>";
+    //        $(item).after(HtmlStr);
+    //        }
+    //        });
+    //$(".container-table").on("touchstart", function () {
+    //    var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0: parseFloat($(this).find("table").css("width"));
+    //    if (TableWidth > bodyWidth) {
+    //        pressTableFlag = true;
+    //    }
+    //    }).on("touchmove", function () {
+    //    var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0: parseFloat($(this).find("table").css("width"));
+    //    var ScrollLeft = isNaN(parseFloat($(this).scrollLeft())) ? 0: parseFloat($(this).scrollLeft());
+    //    var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
+    //    var ShowSBarName = $(this).next().attr("class");
+    //    if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
+    //            // 有滚动条的进行移动
+    //        $(this).next().find(".ShowSBarC").css("left", (ScrollLeft * HRate) + "px");
+    //    }
+    //});
+    AdjustTableFunc();
 }
 
 //页面加载完,课件 绑定事件
@@ -638,32 +639,33 @@ function bindEventYS() {
     });
     $("td").attr("style", "");
     //处理表格样式
-    $(".container-table").each(function (index, item) {
-        var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
-        var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
-        var HWidth = parseFloat(TableWidth) - parseFloat(bodyWidth);
-        var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
-        var SSWidth = bodyWidth - HWidth * HRate;  // 显示滚动条宽度
-        if (TableWidth > bodyWidth) {
-            var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;border-radius:2px;'><div class='ShowSBarC' style='width:" + SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" + ScrollLeft + "px;bottom:0px;z-index:3;border-radius:2px;'></div></div>";
-            $(item).after(HtmlStr);
-        }
-    });
-    $(".container-table").on("touchstart", function () {
-        var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
-        if (TableWidth > bodyWidth) {
-            pressTableFlag = true;
-        }
-    }).on("touchmove", function () {
-        var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
-        var ScrollLeft = isNaN(parseFloat($(this).scrollLeft())) ? 0 : parseFloat($(this).scrollLeft());
-        var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
-        var ShowSBarName = $(this).next().attr("class");
-        if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
-            // 有滚动条的进行移动
-            $(this).next().find(".ShowSBarC").css("left", (ScrollLeft*HRate) + "px");
-        }
-    });
+    //$(".container-table").each(function (index, item) {
+    //    var TableWidth = isNaN(parseFloat($(item).find("table").css("width"))) ? 0 : parseFloat($(item).find("table").css("width"));
+    //    var ScrollLeft = isNaN(parseFloat($(item).scrollLeft())) ? 0 : parseFloat($(item).scrollLeft());
+    //    var HWidth = parseFloat(TableWidth) - parseFloat(bodyWidth);
+    //    var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
+    //    var SSWidth = bodyWidth - HWidth * HRate;  // 显示滚动条宽度
+    //    if (TableWidth > bodyWidth) {
+    //        var HtmlStr = "<div class='ShowSBar' style='width:" + bodyWidth + "px;height:5px;background-color:#eee;position:relative;left:0px;bottom:3px;z-index:2;border-radius:2px;'><div class='ShowSBarC' style='width:" + SSWidth + "px;height:5px;background-color:#ccc;position:absolute;left:" + ScrollLeft + "px;bottom:0px;z-index:3;border-radius:2px;'></div></div>";
+    //        $(item).after(HtmlStr);
+    //    }
+    //});
+    //$(".container-table").on("touchstart", function () {
+    //    var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
+    //    if (TableWidth > bodyWidth) {
+    //        pressTableFlag = true;
+    //    }
+    //}).on("touchmove", function () {
+    //    var TableWidth = isNaN(parseFloat($(this).find("table").css("width"))) ? 0 : parseFloat($(this).find("table").css("width"));
+    //    var ScrollLeft = isNaN(parseFloat($(this).scrollLeft())) ? 0 : parseFloat($(this).scrollLeft());
+    //    var HRate = parseFloat(bodyWidth) / parseFloat(TableWidth);
+    //    var ShowSBarName = $(this).next().attr("class");
+    //    if (ScrollLeft >= 0 && ShowSBarName == "ShowSBar" && $(this).next().find(".ShowSBarC").length > 0) {
+    //        // 有滚动条的进行移动
+    //        $(this).next().find(".ShowSBarC").css("left", (ScrollLeft*HRate) + "px");
+    //    }
+    //});
+    AdjustTableFunc();
 }
 var pressTableFlag = false;
 // 移动端使用,true:表示点击表格且正在移动,需阻止模块切换
@@ -1503,7 +1505,7 @@ var answerData = new Array();
     }
 }
 
-    function getSelectedText(title) {
+function getSelectedText(title) {
     var txt;
     if (window.getSelection) {
         txt = window.getSelection().toString();

+ 28 - 0
EBook.Web/EditTable/EditTable.css

@@ -0,0 +1,28 @@
+.TableContainer{
+    width: 100px;
+    height: auto;
+    overflow-x:auto !important;
+    overflow-y:hidden !important;
+}
+.PSBar{
+    height: 5px;
+    line-height: 5px;
+    position: relative;
+    left: 0px;
+    bottom: 0px;
+    background-color: #eee;
+    z-index: 2;
+    overflow:hidden;
+}
+.CSBar{
+    height: 5px;
+    line-height: 5px;
+    position: relative;
+    left: 0px;
+    bottom: 0px;
+    background-color: #ccc;
+    z-index: 3;
+}
+.TableContainer td{
+    min-width:135px !important;
+}

+ 31 - 7
EBook.Web/EditTable/EditTable.js

@@ -1,23 +1,31 @@
-$(function () {
+var AdjustTableFunc = function () {
     var TriggerFlag = false;  // 触发标志
     var Index = 0;
     $.each($("table"), function (index, item) {
         var TableWidth = isNaN(parseFloat($(item).width())) ? 0 : parseFloat($(item).width());  // 表格宽度
         // 替换HTML
         var ChildHtmlStr = $(item).prop("outerHTML")
-        var HtmlStr = "<div class='TableContainer TContain_" + Index + "' style='width: 0px;height: auto;overflow-x: auto;overflow-y: hidden;'></div>";
+        var HtmlStr = "<div class='TableContainer TContain_" + Index + "'></div>";
         $(item).after(HtmlStr);
         $(item).remove();
         var JqStr = ".TContain_" + Index;
-        var BodyWidth = isNaN(parseFloat($(document).width())) ? 0 : parseFloat($(document).width());;  // 界面宽度
-        $(JqStr).css("width", BodyWidth + "px").append(ChildHtmlStr);
+        $(JqStr).append(ChildHtmlStr);
+        Index += 1;
+    });
+    var Index = 0;
+    $.each($("table"), function (index, item) {
+        var TableWidth = isNaN(parseFloat($(item).width())) ? 0 : parseFloat($(item).width());  // 表格宽度
+        // 替换HTML
+        var JqStr = ".TContain_" + Index;
+        var BodyWidth = isNaN(parseFloat($(document).width())) ? 0 : parseFloat($(document).width());  // 界面宽度
+        $(JqStr).css("width", BodyWidth + "px");
         if (TableWidth > BodyWidth) {
             // 额外显示滚动条
-            var SHtmlStr = "<div class='PSBar' style='width: " + BodyWidth + "px;height: 5px;line-height: 5px;position: relative;left: 0px;bottom: 0px;background-color: #eee;z-index: 2;overflow:hidden;'></div>";
+            var SHtmlStr = "<div class='PSBar' style='width: " + BodyWidth + "px;'></div>";
             $(JqStr).after(SHtmlStr);
             var HiddenRate = BodyWidth / TableWidth;  // 滚动条比率
             var HiddenWidth = BodyWidth - (TableWidth - BodyWidth) * HiddenRate;  // 现滚动条大小
-            var CSHtmlStr = "<div class='CSBar' style='width: " + HiddenWidth + "px;height: 5px;line-height: 5px;position: relative;left: 0px;bottom: 0px;background-color: #ccc;z-index: 3;'></div>";
+            var CSHtmlStr = "<div class='CSBar' style='width: " + HiddenWidth + "px;'></div>";
             $(JqStr).next().append(CSHtmlStr);
         }
         Index += 1;
@@ -36,4 +44,20 @@
             $(this).next().find(".CSBar").css("left", SLeftWdith + "px");
         }
     });
-});
+    window.addEventListener("scroll", function (event) {
+        var ClsName = event.target.className;
+        if (ClsName == undefined) {
+            return;
+        }
+        ClsName = ClsName.replace("TableContainer ", ".");
+        var TableWidth = isNaN(parseFloat($(ClsName).find("table").width())) ? 0 : parseFloat($(ClsName).find("table").width());  // 表格宽度
+        var BodyWidth = isNaN(parseFloat($(document).width())) ? 0 : parseFloat($(document).width());  // 界面宽度
+        var HiddenRate = BodyWidth / TableWidth;  // 滚动条比率
+        var SLeftWdith = isNaN(parseFloat($(ClsName)[0].scrollLeft)) ? 0 : parseFloat($(ClsName)[0].scrollLeft);
+        SLeftWdith *= HiddenRate;
+        var NextClsName = $(ClsName).next().attr("class");
+        if (NextClsName == "PSBar") {
+            $(ClsName).next().find(".CSBar").css("left", SLeftWdith + "px");
+        }
+    }, true);
+};