Browse Source

提交处理

namejr 4 years ago
parent
commit
206020c3d4
2 changed files with 21 additions and 21 deletions
  1. 11 7
      EBook.Web/Common/mtm_temp.js
  2. 10 14
      EBook.Web/Common/tasklib_book.js

+ 11 - 7
EBook.Web/Common/mtm_temp.js

@@ -1,9 +1,11 @@
 /*高亮文本标注*/
 function Fill(data) {
     var highlightArr = [];
+    if ($(document.body).find(".wordStyle,.phraseStyle,.phraseStyle").length > 0) {
+        dealAnswerFunc(document.body, false);
+    }
     clearHighlight();
     $.each(data, function (i, item) {
-
         if (typeof (item.HightCode) != 'undefined' && item.HightCode != null && item.HightCode != "") {
             var highlightItem = $('span[id=' + item.HightCode + ']').eq(0);
             if (highlightItem.length > 0) {
@@ -13,7 +15,7 @@ function Fill(data) {
                 }
                 else {
                     highlightItem.attr('hitCode', item.SourceCode);
-                }
+            }
 
                 highlightArr.push(highlightItem);
             }
@@ -27,13 +29,11 @@ function Fill(data) {
                 }
                 else {
                     highlightItem.attr('hitCode', item.SourceCode);
-                }
+            }
 
                 highlightArr.push(highlightItem);
             }
         }
-
-
         $.each(highlightArr, function (i, item) {
             if (item.attr('flag') == 'word') {
                 bindEvent(item.attr('iskeyklg', 'true').addClass('wordStyle'), true);
@@ -46,7 +46,7 @@ function Fill(data) {
                 else {
                     bindEvent(item.attr('iskeyklg', 'true').addClass('phraseStyle'), true);
                     if ($(item).parent().attr('iskeyklg') == 'true' && $(item).parent().attr('flag') == 'phrase') $(item).addClass('border1')
-                }
+            }
             }
             else if (item.attr('flag') == 'sentence') {
                 if (item.attr('iskeyklg') == 'true') return;
@@ -54,7 +54,11 @@ function Fill(data) {
                     .before('<img src="file:///android_asset/js/sentenceIco.png" class="sentImagcs">'), true);
             }
         });
-    });
+        // 绑定横线内处理
+        $(document).find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("uLFlag", "0").attr("shcode", 0).attr("showFlag", "1");
+        $(document).find(".underlineContent").attr("shcode", 0).attr("uLFlag", "1").attr("showFlag", "1");
+        $(document).find(".underlineContent").find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("shcode", 0).attr("uLFlag", "1").attr("showFlag", "1");
+});
 }
 
 function clearHighlight() {

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

@@ -259,8 +259,6 @@ var isGCFunc = function (NodeHandle) {
 var dealGLShowFunc = function (NodeHandle) {
     $.each($(NodeHandle).find(".wordStyle"), function (index, element) {
         var showFlagS = $(element).attr("showFlag");
-        $("#spanshowf").remove();
-        $("#showtext").append("<span id='spanshowf'>sentenceFlag:" + styleWPSContrl.sentenceFlag + ",phraseFlag:" + styleWPSContrl.phraseFlag + ",wordFlag:" + styleWPSContrl.wordFlag + ",showFlagS:" + showFlagS + "</span>");
         if (styleWPSContrl.wordFlag && showFlagS == "1") {
             $(element).css("color", "#db5d00");
         }
@@ -294,7 +292,7 @@ var dealGLShowFunc = function (NodeHandle) {
     });
 };
 
-// 处理显示或隐藏答案(shcode是否可点击,uLFlag判断是否存在横线内,showFlag是否显示)
+// 处理显示或隐藏答案(shcode是否可点击1可点击;uLFlag判断是否存在横线内1表示在;showFlag是否显示1显示)
 var dealAnswerFunc = function (NodeHandle, OCFlag) {
     if (OCFlag) {
         $(NodeHandle).css("color", "#92D050").css("border-bottom", "1px solid #979797").css("background-color", "transparent").attr("shcode", 0).attr("showFlag", "1");
@@ -303,8 +301,15 @@ var dealAnswerFunc = function (NodeHandle, OCFlag) {
         dealGLShowFunc(NodeHandle);
     }
     else {
+        var uLFlag = $(NodeHandle).attr("uLFlag");
+        if (uLFlag == "1") {
+            $(NodeHandle).css("color", "#ffffff").css("border-bottom", "1px solid #979797").css("background-color", "#ffffff").attr("shcode", 1).attr("showFlag", "0");
+        }
+        else {
+            $(NodeHandle).css("color", "#ffffff").css("border-bottom", "1px solid #979797").css("background-color", "#ffffff").attr("shcode", 0).attr("showFlag", "0");
+        }
         $.each($(NodeHandle).find(".wordStyle,.phraseStyle,.phraseStyle,u,span"),function(index,element){
-            var uLFlag = $(element).attr("uLFlag");
+            uLFlag = $(element).attr("uLFlag");
             if (uLFlag == "1") {
                 $(element).css("color", "#ffffff").css("border-bottom", "1px solid #979797").css("background-color", "#ffffff").attr("shcode", 1).attr("showFlag", "0");
                 $(element).find(".wordStyle,.phraseStyle,.phraseStyle,u,span").css("color", "#ffffff").css("border-bottom", "1px solid #979797").css("background-color", "#ffffff").attr("shcode", 1).attr("showFlag", "0");
@@ -316,7 +321,7 @@ var dealAnswerFunc = function (NodeHandle, OCFlag) {
         });
     }
     var underlineContentText = $(NodeHandle).text();  // 获取文本内容
-    if (underlineContentText.indexOf("√") > -1) {
+    if (underlineContentText != undefined && underlineContentText.indexOf("√") > -1) {
         if (OCFlag) {
             $(NodeHandle).parent().find(".checkbox").find("input").prop('checked', true);
         }
@@ -501,10 +506,6 @@ function bindEventTeaOrignalYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
-    // 绑定横线内处理
-    $(document).find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("uLFlag", "0").attr("shcode", 0).attr("showFlag", "1");
-    $(document).find(".underlineContent").find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("shcode", 0).attr("uLFlag", "1").attr("showFlag", "1");
-    $(document.body).append("<div id='showtext' style='width:300px;height:50px;overflow-y:auto;position:fixed;left:20px;top:100px;background-color:yellow;'></div>");
 }
 
 //页面加载完,课件 绑定事件
@@ -639,10 +640,6 @@ function bindEventYS() {
         var curAlt = $(this).attr("alt");//播放视频地址
         playVisiableAudioCallBack(2, $(this).attr("alt"));
     });
-    // 绑定横线内处理
-    $(document).find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("uLFlag", "0").attr("shcode", 0).attr("showFlag", "1");
-    $(document).find(".underlineContent").find(".wordStyle,.phraseStyle,.phraseStyle,u,span").attr("shcode", 0).attr("uLFlag", "1").attr("showFlag", "1");
-    $(document.body).append("<div id='showtext' style='width:300px;height:50px;overflow-y:auto;position:fixed;left:20px;top:100px;background-color:yellow;'></div>");
 }
 
 // 移动端使用,true:表示点击表格且正在移动,需阻止模块切换
@@ -1484,7 +1481,6 @@ function showGLWorld(wordFlag, phraseFlag, sentenceFlag) {
     // 卡控调用隐藏状态下不处理
     dealGLShowFunc(document);
 }
-
 function playVisiableAudioCallBack(type, url) {
     //console.log(url);
     cancelBubble();