Browse Source

Merge branch 'master' into android

pengmi 4 years ago
parent
commit
604eb49088
2 changed files with 223 additions and 58 deletions
  1. 218 58
      EBook.Web/Common/new_tasklib_book.js
  2. 5 0
      EBook.Web/EBook.Web.csproj

+ 218 - 58
EBook.Web/Common/new_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",
@@ -9,6 +9,20 @@ var PicInfo = {
     audioPauseImgUrl: "file:///android_asset/js/dynaiselaba.png",
     sentenceIcoUrl: "file:///android_asset/js/sentenceIco.png"
 }
+//播放音频图片地址(iOS)
+var PicInfo = {
+    yaoshiShowImgUrl: "yaoshi-show.png",
+    yaoshiHideImgUrl: "yaoshi-hide.png",
+    answerPointImgUrl: "update-answer.png",
+    recordPlayImgUrl: "play.png",
+    recordPauseImgUrl: "pause.png",
+    audioPlayImgUrl: "dynaiselaba.gif",
+    audioPauseImgUrl: "dynaiselaba.png",
+    speechAnswerImgUrl: "title_speech.png",
+    videoPlayImgUrl: "title_video.png",
+    KouYuTagImgUrl: "KY.png",
+    sentenceIcoUrl: "sentenceIco.png"
+}
 
 //本地调用用的资源
 var PicInfo1 = {
@@ -27,18 +41,18 @@ var PicInfo1 = {
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // 公用方法
 // 检测安卓和ios
-var cTTypeFunc = function () {
-    return 1;  // 按1处理
-    var u = navigator.userAgent;
-    //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
-    //var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
-    if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
-        return 1;
-    }
-    else {
-        return 2;
-    }
-}();
+var cTTypeFunc = 2;  // 安卓为1,iOS为2
+//var cTTypeFunc = function () {
+//    var u = navigator.userAgent;
+//    //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
+//    //var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+//    if (u.indexOf('Android') > -1 || u.indexOf('Adr') > -1) {
+//        return 1;
+//    }
+//    else {
+//        return 2;
+//    }
+//}();
 
 // 删除叼毛题库原先附加无用属性
 function dealUnderLineFunc() {
@@ -757,11 +771,18 @@ function audioPlayClick(myobj) {
         $(myobj).attr("play-status", "1");
         $(myobj).attr("src", PicInfo.audioPlayImgUrl);//移动端要根据本地 喇叭 路径替换
     }
-    var info = new Object();
-    info.Id = $(myobj).attr("audio-id");
-    info.AudioUrl = curAlt;
-    //移动端添加外部处理
-    playVisiableAudioCallBack(1, JSON.stringify(info));
+    if (cTTypeFunc == 1) {
+        //移动端添加外部处理(安卓)
+        var info = new Object();
+        info.Id = $(myobj).attr("audio-id");
+        info.AudioUrl = curAlt;
+        playVisiableAudioCallBack(1, JSON.stringify(info));
+    }
+    else {
+        //移动端添加外部处理(iOS)
+        cancelBubble();
+        alert("media:" + "0" + "℡№℡" + curId + "℡№℡" + curAlt);
+    }
 }
 
 //#endregion
@@ -1099,15 +1120,18 @@ function bindEventYS(sWidthVal, isAStatus, isMAStatus) {
     });
     //给音频绑定一个ID(未处理)
     $.each($(".audioImg"), function (index, item) {
+        $(item).attr("src", PicInfo.audioPauseImgUrl);
         $(item).attr("audiourl", "");
         $(item).attr('audio-id', index);
     });
     //给视频图标处理(未处理)
     $.each($(".videoImg"), function (index, item) {
+        $(item).attr("src", PicInfo.videoPlayImgUrl);
         $(item).attr("audiourl", "");
     });
     //给口语图标处理(未处理)
     $.each($(".oralLanguageImg"), function (index, item) {
+        $(item).attr("src", PicInfo.speechAnswerImgUrl);
         $(item).attr("audiourl", "");
     });
     //处理口语试题
@@ -1194,15 +1218,18 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus, isMAStatus) {
     });
     //给音频绑定一个ID(未处理)
     $.each($(".audioImg"), function (index, item) {
+        $(item).attr("src", PicInfo.audioPauseImgUrl);
         $(item).attr("audiourl", "");
         $(item).attr('audio-id', index);
     });
     //给视频图标处理(未处理)
     $.each($(".videoImg"), function (index, item) {
+        $(item).attr("src", PicInfo.videoPlayImgUrl);
         $(item).attr("audiourl", "");
     });
     //给口语图标处理(未处理)
     $.each($(".oralLanguageImg"), function (index, item) {
+        $(item).attr("src", PicInfo.speechAnswerImgUrl);
         $(item).attr("audiourl", "");
     });
     //一题多空的答题点标注
@@ -1246,9 +1273,6 @@ function bindEventTeaOrignalYS(sWidthVal, isAStatus, isMAStatus) {
 // 学生端 处理作答区域     answer-isky 是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
 var answerData = new Array();
 function handleAnswerRange() {
-    // 隐藏答案划线
-    //$(".underlineContentShow").attr("data-status", "0");
-    //规范文本格式
     var answerId = "";
     var tempJson = new Array();
     //先处理一题多空的情况,获取两个之间的答题点
@@ -1267,13 +1291,27 @@ function handleAnswerRange() {
         $.each($(".underlineContent[yaoshi-flag='" + AnswerID + "']"), function (index, tItem) {
             TAnsText += " " + $(tItem).text();
         });
+        var ClsName = $(item).next().attr("class");
         // 添加答题点
-        if (AnswerIsky == 2) {
-            $(item).after("<div class='cBoxClsBg' data-select='0'><div class='cBoxCls cBoxCls_" + AnswerID + "' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' data-status='0' onclick='clickCheckBox(" + AnswerID + ")' answer-anstext='" + TAnsText + "'></div></div>");
+        if (AnswerIsky == 2){
+            // 防止重复添加
+            if (cTTypeFunc == 2 && ClsName != "cBoxClsBg") {
+                $(item).after("<div class='cBoxClsBg' data-select='0'><div class='cBoxCls cBoxCls_" + AnswerID + "' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' data-status='0' onclick='clickCheckBox(" + AnswerID + ")' answer-anstext='" + TAnsText + "'></div></div>");
+            }
+            else if (ClsName != "cBoxClsBg") {
+                $(item).after("<div class='cBoxClsBg' data-select='0'><div class='cBoxCls cBoxCls_" + AnswerID + "' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' data-status='0' onclick='clickCheckBox(" + AnswerID + ")' answer-anstext='" + TAnsText + "'></div></div>");
+            }
         }
         else {
-            // data-astatus控制作答样式(0表示未提交,1表示提交,2表示回显);data-errstatus判断是否作答(1表示未作答)
-            $(item).after("<div class='answer-body' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' answer-isky='" + AnswerIsky + "' answer-showanswer='0' data-astatus='0' data-errstatus='0' mobile-type='" + cTTypeFunc + "' onclick='ClickRecFunc(" + AnswerPID + ")' answer-anstext='" + TAnsText + "'><div class='answer-audio-range'><img class='nextpic' src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' mobile-type='" + cTTypeFunc + "'><div class='answer-point-range-div' mobile-type='" + cTTypeFunc + "'><img class='nextpic' src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div></div><buttom class='answer-text' data-astatus='0'></buttom></div>");
+            // 防止重复添加
+            if (cTTypeFunc == 2 && ClsName != "answer-body") {
+                // data-astatus控制作答样式(0表示未提交,1表示提交,2表示回显);data-errstatus判断是否作答(1表示未作答)
+                $(item).after("<div class='answer-body' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' answer-isky='" + AnswerIsky + "' answer-showanswer='0' data-astatus='0' data-errstatus='0' mobile-type='" + cTTypeFunc + "' onclick='ClickRecFunc(" + AnswerPID + ")' answer-anstext='" + TAnsText + "'><div class='answer-audio-range'><img class='nextpic' src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' mobile-type='" + cTTypeFunc + "'><div class='answer-point-range-div' mobile-type='" + cTTypeFunc + "'><img class='nextpic' src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div></div><buttom class='answer-text' data-astatus='0'></buttom></div>");
+            }
+            else if (ClsName != "answer-body") {
+                // data-astatus控制作答样式(0表示未提交,1表示提交,2表示回显);data-errstatus判断是否作答(1表示未作答)
+                $(item).after("<div class='answer-body' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' answer-isky='" + AnswerIsky + "' answer-showanswer='0' data-astatus='0' data-errstatus='0' mobile-type='" + cTTypeFunc + "' onclick='ClickRecFunc(" + AnswerPID + ")' answer-anstext='" + TAnsText + "'><div class='answer-audio-range'><img class='nextpic' src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' mobile-type='" + cTTypeFunc + "'><div class='answer-point-range-div' mobile-type='" + cTTypeFunc + "'><img class='nextpic' src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div></div><buttom class='answer-text' data-astatus='0'></buttom></div>");
+            }
         }
         var info = new Object();
         info.Id = AnswerID;
@@ -1285,7 +1323,12 @@ function handleAnswerRange() {
         $(item).attr("showflag", "0").css("display", "none").attr("data-status", "0").attr("src", PicInfo.yaoshiHideImgUrl);  // 隐藏钥匙
         $(".underlineContent[yaoshi-flag='" + AnswerID + "']").not(".noKey").css("display", "none");  // 隐藏答案(这种是连下划线删除的)
     });
-    return answerData;
+    if (cTTypeFunc == 1) {
+        return answerData;
+    }
+    else {
+        return JSON.stringify(answerData);
+    }
 }
 
 //提交,获取所有作答答案及参考答案(未处理)
@@ -1422,6 +1465,7 @@ function backupAllAnswer(answerJson, statusType) {
                 }
                 //提交直接还原作答现场
                 var mytext = answerList[index].Text;//我的答案
+                mytext = (mytext == undefined || mytext == null) ? "" : mytext;
                 var CheckFlag = (mytext.indexOf("√") > -1) ? true : false;
                 // 恢复多选处理
                 if (CheckFlag) {
@@ -1525,6 +1569,7 @@ function backupAllAnswer(answerJson, statusType) {
                 }
                 //提交直接还原作答现场
                 var mytext = answerList[index].Text;//我的答案
+                mytext = (mytext == undefined || mytext == null) ? "" : mytext;
                 var CheckFlag = (mytext.indexOf("√") > -1) ? true : false;
                 $(item).attr("answer-score", answerList[index].Score);  //作答评分
                 $(item).attr("answer-text", mytext);  // 作答内容
@@ -1971,6 +2016,9 @@ function AddClickEvent() {
         curObj.AnsText = answerAnstext;//参考答案
         curObj.Comment = answerComment;//评语
         // 选中样式渲染
+        while (answerText.indexOf("未作答") > -1) {
+            answerText = answerText.replace("未作答", "")
+        }
         var WType = "0";
         if (answerText == "未作答" || answerText.length == 0) {
             WType = "2";
@@ -2110,7 +2158,12 @@ function AddClickEvent() {
         $(this).attr("audiourl", "");
         var curHtml = $(this).parent().find(".videoUrl").html();
         var curAlt = $(this).attr("alt");//播放视频地址
-        playVisiableAudioCallBack(2, $(this).attr("alt"));
+        if (cTTypeFunc == 1) {
+            playVisiableAudioCallBack(2, $(this).attr("alt"));
+        }
+        else {
+            videoAudioClick("media:" + curAlt);
+        }
     });
     //作答录音播放按钮点击事件
     $(".answer-audio-range").on("click", function () {
@@ -2142,10 +2195,10 @@ function stuEntryFunc(sWidthVal, isAStatus, isMAStatus, data) {
     if (typeof (Fill) == "function") {
         Fill(TFillData);
     }
-    // 最终样式渲染
-    DealCssHiddenFunc();
-    // 点击事件补充
-    AddClickEvent();
+        // 最终样式渲染
+        DealCssHiddenFunc();
+        // 点击事件补充
+        AddClickEvent();
     return ReData;
 }
 
@@ -2251,15 +2304,37 @@ function mobileTEFunc(ID) {
     var CurrentTime = parseInt($(".LDFPWhite_" + ID).attr("data-ctime"));  // 当前滑动的时间进度
     var jQStr = ".LDFPlayS_" + ID;
     var AudioUrl = $(jQStr).parent().prev(".LDivTop").find(".LDivTItem[data-selected='1']").attr("data-auduourl");  // 路径
-    // 移动端回调处理
-    plugin.onSeekBarUp(ID, CurrentTime, AudioUrl);  // 安卓
+    if (cTTypeFunc == 1) {
+        // 移动端回调处理(安卓)
+        plugin.onSeekBarUp(ID, CurrentTime, AudioUrl);
+    }
+    else {
+        // 移动端回调处理(iOS)
+        var curObj = new Object();
+        curObj.Id = ID;//答题点ID
+        curObj.State = 1;
+        curObj.AudioUrl = AudioUrl;
+        curObj.CurrentTime = CurrentTime;
+        cancelBubble();
+        alert("jsSlider:" + JSON.stringify(curObj));
+    }
 }
 
 // 音频进度条按下回调
 function mobileTSFunc(ID) {
     pressTableFlag = true;
-    // 移动端回调处理
-    plugin.onSeekBarDown(ID); // 安卓
+    if (cTTypeFunc == 1) {
+        // 移动端回调处理(安卓)
+        plugin.onSeekBarDown(ID);
+    }
+    else {
+        // 移动端回调处理(iOS)
+        var curObj = new Object();
+        curObj.Id = ID;//答题点ID
+        curObj.State = 0;
+        cancelBubble();
+        alert("jsSlider:" + JSON.stringify(curObj));
+    }
 }
 
 // 控制字体大小
@@ -2274,27 +2349,46 @@ function adjustFontSize(FontSize) {
 function playVisiableAudioCallBack(type, url) {
     //console.log(url);
     cancelBubble();
-    plugin.startPlay(type, url);
+    if (cTTypeFunc == 1) {
+        plugin.startPlay(type, url);
+    }
+    else {
+        alert("jsmedia:" + url);
+    }
 }
 
 // 答题点选择调移动端接口
 function onClickAnswerPoint(data) {
-    //alert(JSON.stringify(data));
-    console.log(JSON.stringify(data));
-    //cancelBubble();
-    plugin.onClickAnswerPoint(data);
+    if (cTTypeFunc == 1) {
+        //alert(JSON.stringify(data));
+        console.log(JSON.stringify(data));
+        //cancelBubble();
+        plugin.onClickAnswerPoint(data);
+    }
+    else {
+        cancelBubble();
+        alert(data);
+    }
 }
 
 function onClickKeyHide() {
-    //alert(JSON.stringify(data));
     cancelBubble();
-    plugin.onClickKeyHide();
+    if (cTTypeFunc == 1) {
+        plugin.onClickKeyHide();
+    }
+    else {
+        alert("yaoshi-control-hide");
+    }
 }
 
 function onClickKeyShow() {
-    //alert(JSON.stringify(data));
     cancelBubble();
-    plugin.onClickKeyShow();
+    if (cTTypeFunc == 1) {
+        plugin.onClickKeyShow();
+    }
+    else {
+        alert("yaoshi-control-show");
+    }
 }
 
 function cancelBubble(e) {
@@ -2355,6 +2449,16 @@ function playRecordAudio(answerid, isPlay) {
             $(playing).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
         }
     }
+    else {
+        if (isPlay == "1") {
+            $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range").attr("play-status", "1");
+            $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range").find("img").attr("src", PicInfo.recordPauseImgUrl);//移动端要根据本地路径替换
+        }
+        else {
+            $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range").attr("play-status", "0");
+            $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range").find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
+        }
+    }
 }
 
 //滚动到相应DIV
@@ -2372,8 +2476,10 @@ function scrollAnswer(answerid) {
             $.each($(".underlineContent[parent-anid=" + answerid + "]"), function () {
                 TanswerText += $(this).text();
             });
+            while (TanswerText.indexOf("未作答") > -1) {
+                TanswerText = TanswerText.replace("未作答", "")
+            }
             var WType = "0";
-            console.log(TanswerText);
             if (TanswerText == "未作答" || TanswerText.length == 0) {
                 WType = "2";
             }
@@ -2381,12 +2487,26 @@ function scrollAnswer(answerid) {
                 WType = "1";
             }
             $(".underlineContent[parent-anid=" + answerid + "]").parent(".ULCBGUse").attr("data-select", WType);
-            if ($(".underlineContent[parent-anid=" + answerid + "]").length > 1) {
-                $(".underlineContent[parent-anid=" + answerid + "]").first().parent(".ULCBGUse").css("border-radius", "5px 0px 0px 5px");
-                $(".underlineContent[parent-anid=" + answerid + "]").last().parent(".ULCBGUse").css("border-radius", "0px 5px 5px 0px");
+            if ($(ansDom).length==1) {
+                if ($(".underlineContent[yaoshi-flag=" + answerid + "]").length > 1) {
+                    $(".underlineContent[yaoshi-flag=" + answerid + "]").first().parent(".ULCBGUse").css("border-radius", "5px 0px 0px 5px");
+                    $(".underlineContent[yaoshi-flag=" + answerid + "]").last().parent(".ULCBGUse").css("border-radius", "0px 5px 5px 0px");
+                }
+                else {
+                    $(".underlineContent[yaoshi-flag=" + answerid + "]").parent(".ULCBGUse").css("border-radius", "5px");
+                }
             }
             else {
-                $(".underlineContent[parent-anid=" + answerid + "]").parent(".ULCBGUse").css("border-radius", "5px");
+                $.each($(".underlineContent[parent-anid=" + answerid + "]"), function () {
+                    var iAnswerID = $(this).attr("yaoshi-flag");
+                    if ($(".underlineContent[yaoshi-flag=" + iAnswerID + "]").length > 1) {
+                        $(".underlineContent[yaoshi-flag=" + iAnswerID + "]").first().parent(".ULCBGUse").css("border-radius", "5px 0px 0px 5px");
+                        $(".underlineContent[yaoshi-flag=" + iAnswerID + "]").last().parent(".ULCBGUse").css("border-radius", "0px 5px 5px 0px");
+                    }
+                    else {
+                        $(".underlineContent[yaoshi-flag=" + iAnswerID + "]").parent(".ULCBGUse").css("border-radius", "5px");
+                    }
+                });
             }
         }
         else {
@@ -2416,11 +2536,23 @@ function pauseTextAudio(audioid) {
     }
 }
 
+function playTextAudio(audioID) {
+    //获取其他正在播放的音频
+    var playing = $(".audioImg[audio-id='" + audioID + "']");
+    if (playing.length > 0) {
+        $(playing).attr("play-status", "1");
+        $(playing).attr("src", PicInfo.audioPlayImgUrl);//移动端要根据本地 喇叭 路径替换
+    }
+}
 // 点击高亮调移动端
 function hitCodeFunc(code) {
-    //alert(code);
     //cancelBubble();
-    plugin.call(code);
+    if (cTTypeFunc == 1) {
+        plugin.call(code);
+    }
+    else {
+        alert(code);
+    }
 }
 
 // 设置离焦事件
@@ -2456,18 +2588,46 @@ function recordAudioClick(myobj, id, url) {
         $(myobj).attr("play-status", "0");
         $(myobj).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
     }
-    //移动端添加外部处理,播放录音
-    var info = new Object();
-    info.Id = id;
-    info.AudioUrl = url;
-    //移动端添加外部处理,播放录音
-    playVisiableAudioCallBack(3, JSON.stringify(info));
+    if (cTTypeFunc == 1) {
+        //移动端添加外部处理,播放录音(安卓)
+        var info = new Object();
+        info.Id = id;
+        info.AudioUrl = url;
+        //移动端添加外部处理,播放录音
+        playVisiableAudioCallBack(3, JSON.stringify(info));
+    }
+    else {
+        //移动端添加外部处理,播放录音(iOS)
+        cancelBubble();
+        alert("media:" + "1" + "℡№℡" + id + "℡№℡" + url);
+    }
 }
 
 
+function videoAudioClick(data) {
+    cancelBubble();
+    alert(data);
+}
 
+function topHeight(id) {
+    var _top = 0;
+    var input = document.getElementById(id); // 根据ID取得元素对象
+    while (input != null) {
+        _top += input.offsetTop;
+        input = input.offsetParent;
+    }
+    return _top;
+}
 
+function showStyleColor(index) {
+    var node = document.getElementById(index);
+    node.style = "color:rgba(0,153,0,1)";
+}
 
+function hideStyleColor(index) {
+    var node = document.getElementById(index);
+    node.style = "color:rgba(0,153,0,0)";
+}
 
 
 

+ 5 - 0
EBook.Web/EBook.Web.csproj

@@ -94,6 +94,8 @@
     <Content Include="AnsText\bug27745高亮json.txt" />
     <Content Include="AnsText\bug28011.txt" />
     <Content Include="AnsText\bug280112.txt" />
+    <Content Include="AnsText\bug28020主.txt" />
+    <Content Include="AnsText\bug28020主答.txt" />
     <Content Include="AnsText\data202141.txt" />
     <Content Include="AnsText\data2021411高亮.txt" />
     <Content Include="AnsText\data20214121828.txt" />
@@ -107,6 +109,8 @@
     <Content Include="AnsText\220341.json" />
     <Content Include="AnsText\220342.json" />
     <Content Include="AnsText\err.json" />
+    <Content Include="AnsText\cpu-z_1.85-cn%281%29.zip" />
+    <Content Include="AnsText\data20210813.lghp" />
     <None Include="AnsText\TGX.json" />
     <Content Include="AnsText\html.txt" />
     <Content Include="AnsText\高亮混排.txt" />
@@ -209,6 +213,7 @@
     <Content Include="Lghp\data2021411.lghp" />
     <Content Include="Lghp\data20214121828.lghp" />
     <Content Include="Lghp\data2021520.lghp" />
+    <Content Include="Lghp\data20210813.lghp" />
     <None Include="Lghp\gaicuo.lghp" />
     <None Include="Lghp\TS.lghp" />
     <Content Include="NK\tasklib_book.css" />