Browse Source

修正错误显示

namejr 4 years ago
parent
commit
841045e3ff
3 changed files with 34 additions and 12 deletions
  1. 32 5
      EBook.Web/Common/mtm_temp.js
  2. 0 4
      EBook.Web/Common/tasklib_book.js
  3. 2 3
      EBook.Web/Test.html

+ 32 - 5
EBook.Web/Common/mtm_temp.js

@@ -60,14 +60,41 @@ function Fill(data) {
     });
     // °ó¶¨ºáÏßÄÚ´¦Àí
     $.each($(document).find(".wordStyle,.phraseStyle,.sentenceStyle,u,span,p"), function (Iindex, Iitem) {
-        if ($(Iitem).attr("ulflag") == undefined) {
+        if ($(Iitem).attr("ulflag") == undefined || $(Iitem).attr("shcode") == undefined || $(Iitem).attr("showflag") == undefined) {
             var ClsName = $(Iitem).attr("class");
-            $(Iitem).attr("ulflag", "0").attr("shcode", 1).attr("showflag", "1");
+            if ($(Iitem).attr("ulflag") == undefined) {
+                $(Iitem).attr("ulflag", "0");
+            }
+            else if ($(Iitem).attr("shcode") == undefined) {
+                $(Iitem).attr("shcode", 1);
+            }
+            else if ($(Iitem).attr("showflag") == undefined) {
+                $(Iitem).attr("showflag", "1");
+            }
             if (ClsName != undefined && ClsName.indexOf("underlineContent") > -1) {
-                $(Iitem).attr("shcode", 1).attr("ulflag", "1").attr("showflag", "1");
+                if ($(Iitem).attr("ulflag") == undefined || $(Iitem).attr("shcode") == undefined || $(Iitem).attr("showflag") == undefined) {
+                    var ClsName = $(Iitem).attr("class");
+                    if ($(Iitem).attr("ulflag") == undefined) {
+                        $(Iitem).attr("ulflag", "1");
+                    }
+                    else if ($(Iitem).attr("shcode") == undefined) {
+                        $(Iitem).attr("shcode", 1);
+                    }
+                    else if ($(Iitem).attr("showflag") == undefined) {
+                        $(Iitem).attr("showflag", "1");
+                    }
+                }
                 $.each($(Iitem).find(".wordStyle,.phraseStyle,.sentenceStyle,u,span,p"), function (index, element) {
-                    if ($(element).attr("ulflag") == undefined) {
-                        $(element).attr("shcode", 1).attr("ulflag", "1").attr("showflag", "1");
+                    if ($(element).attr("ulflag") == undefined || $(element).attr("shcode") == undefined || $(element).attr("showflag") == undefined) {
+                        if ($(element).attr("ulflag") == undefined) {
+                            $(element).attr("ulflag", "1");
+                        }
+                        else if ($(element).attr("shcode") == undefined) {
+                            $(element).attr("shcode", 1);
+                        }
+                        else if ($(element).attr("showflag") == undefined) {
+                            $(element).attr("showflag", "1");
+                        }
                     }
                 });
             }

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

@@ -257,7 +257,6 @@ var isGCFunc = function (NodeHandle) {
 //(shcode是否可点击1可点击;ulflag判断是否存在横线内1表示在;showflag是否显示1显示)
 // 处理显示或隐藏答案
 var dealAnswerFunc = function (NodeHandle, OCFlag, ThProFlag) {
-    //var timestamp = new Date().getTime();//返回数值单位是毫秒;
     if (OCFlag) {
         var showflagS = $(NodeHandle).attr("showflag");
         if ($(NodeHandle).attr("ulflag") == 1) {
@@ -399,7 +398,6 @@ var dealAnswerFunc = function (NodeHandle, OCFlag, ThProFlag) {
             $(NodeHandle).parent().find(".checkbox").find("input").prop('checked', false);
         }
     }
-    //console.log("时间1:" + (new Date().getTime() - timestamp));
 };
 
 //显示、隐藏答案
@@ -1549,11 +1547,9 @@ function showGLWorld(wordFlag, phraseFlag, sentenceFlag) {
     styleWPSContrl.wordFlag = wordFlag;
     styleWPSContrl.phraseFlag = phraseFlag;
     styleWPSContrl.sentenceFlag = sentenceFlag;
-    //var timestamp = new Date().getTime();//返回数值单位是毫秒;
     $.each($(document.body).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) {
         dealAnswerFunc(element, true, true);
     });
-    //console.log("时间2:" + (new Date().getTime() - timestamp));
 }
 function playVisiableAudioCallBack(type, url) {
     //console.log(url);

+ 2 - 3
EBook.Web/Test.html

@@ -61,10 +61,9 @@
             var data = $.ajax({ url: "lghp/data202116.lghp", async: false }).responseText;
             //var data = $.ajax({ url: "lghp/jieduan.lghp", async: false }).responseText;
             $("#data").html(data);
-            console.log(hightcodejson);
-            Fill(hightcodejson);
             bindEventYS();
-            //Fill(JSON.parse(hightcodejson));
+            showHideAnswerEx(true, false);
+            Fill(hightcodejson);
             //bindCoursewareEvent();
 
             var ResInfo = {