浏览代码

提交处理显示隐藏答案

namejr 4 年之前
父节点
当前提交
d5b872d0bb
共有 4 个文件被更改,包括 24 次插入11 次删除
  1. 14 7
      EBook.Web/Common/mtm_temp.js
  2. 7 2
      EBook.Web/Common/tasklib_book.js
  3. 3 2
      EBook.Web/Test.html
  4. 0 0
      EBook.Web/lghp/jieduan.lghp

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

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

+ 7 - 2
EBook.Web/Common/tasklib_book.js

@@ -259,7 +259,7 @@ var isGCFunc = function (NodeHandle) {
 var dealAnswerFunc = function (NodeHandle, OCFlag, ThProFlag) {
     if (OCFlag) {
         if ($(NodeHandle).attr("ulflag") == 1) {
-            if (!ThProFlag || (ThProFlag&&$(NodeHandle).attr("showflag") == 1)) {
+            if (!ThProFlag || (ThProFlag && $(NodeHandle).attr("showflag") == 1)) {
                 if ($(NodeHandle).text() == "暂无参考答案") {
                     $(NodeHandle).css("color", "#989898").attr("shcode", 1).attr("showflag", "1");
                 }
@@ -1543,7 +1543,12 @@ function showGLWorld(wordFlag, phraseFlag, sentenceFlag) {
     styleWPSContrl.wordFlag = wordFlag;
     styleWPSContrl.phraseFlag = phraseFlag;
     styleWPSContrl.sentenceFlag = sentenceFlag;
-    dealAnswerFunc(document, true, true);
+    $.each($(document.body).find(".wordStyle[hitstyle='wordStyle'],.phraseStyle[hitstyle='phraseStyle'],.sentenceStyle[hitstyle='sentenceStyle']"), function (index,element) {
+        dealAnswerFunc(element, true, true);
+        $.each($(element).find("u,span,p"), function (oindex,oelement) {
+            dealAnswerFunc(oelement, true, true);
+        });
+    });
 }
 function playVisiableAudioCallBack(type, url) {
     //console.log(url);

+ 3 - 2
EBook.Web/Test.html

@@ -53,11 +53,12 @@
         //加载听说课文
         $("#load-text").on("click", function () {
             var data = $.ajax({ url: "lghp/data202116.lghp", async: false }).responseText;
+            //var data = $.ajax({ url: "lghp/jieduan.lghp", async: false }).responseText;
             $("#data").html(data);
 
-            //Fill(JSON.parse(hightcodejson));
-            bindEventYS();
             Fill(JSON.parse(hightcodejson));
+            bindEventYS();
+            //Fill(JSON.parse(hightcodejson));
             //bindCoursewareEvent();
 
             var ResInfo = {

文件差异内容过多而无法显示
+ 0 - 0
EBook.Web/lghp/jieduan.lghp


部分文件因为文件数量过多而无法显示