|
|
@@ -1003,9 +1003,9 @@ function ChangeSpaceStr(DataStr) {
|
|
|
if (DataStr == undefined || DataStr == null) {
|
|
|
return "";
|
|
|
}
|
|
|
- var TDataStr = encodeURI(DataStr);
|
|
|
+ var TDataStr = escape(DataStr); // encodeURI
|
|
|
if (TDataStr.indexOf("%C2%A0") > -1) {
|
|
|
- DataStr = encodeURI(DataStr);
|
|
|
+ DataStr = escape(DataStr);
|
|
|
var DataArr = DataStr.split("%C2%A0");
|
|
|
DataStr = "";
|
|
|
for (var i = 0; i < DataArr.length; i++) {
|
|
|
@@ -1017,6 +1017,19 @@ function ChangeSpaceStr(DataStr) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (TDataStr.indexOf("%A0") > -1) {
|
|
|
+ DataStr = escape(DataStr);
|
|
|
+ var DataArr = DataStr.split("%A0");
|
|
|
+ DataStr = "";
|
|
|
+ for (var i = 0; i < DataArr.length; i++) {
|
|
|
+ if (DataStr == "") {
|
|
|
+ DataStr += DataArr[i];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DataStr += " " + DataArr[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (DataStr.indexOf("%20") > -1) {
|
|
|
while (DataStr.indexOf("%20") > -1) {
|
|
|
DataStr = DataStr.replace("%20", " ");
|
|
|
@@ -1033,7 +1046,8 @@ function ChangeCheckFlag(DataStr, AnswerStr) {
|
|
|
}
|
|
|
if (AnswerStr.indexOf(DataStr) > -1) {
|
|
|
// 直接等价
|
|
|
- ReStr = AnswerStr.substring(0, (AnswerStr.indexOf(DataStr) + DataStr.length));
|
|
|
+ //ReStr = AnswerStr.substring(0, (AnswerStr.indexOf(DataStr) + DataStr.length));
|
|
|
+ ReStr = DataStr;
|
|
|
}
|
|
|
else if (DataStr.indexOf("'") > -1) {
|
|
|
// 模糊匹配
|
|
|
@@ -1041,7 +1055,7 @@ function ChangeCheckFlag(DataStr, AnswerStr) {
|
|
|
var pattWStr = "";
|
|
|
for (var i = 0; i < DataArr.length; i++) {
|
|
|
if (pattWStr != "") {
|
|
|
- pattWStr += ".*" + DataArr[i];
|
|
|
+ pattWStr += ".*?" + DataArr[i];
|
|
|
}
|
|
|
else {
|
|
|
pattWStr += DataArr[i];
|
|
|
@@ -1049,14 +1063,15 @@ function ChangeCheckFlag(DataStr, AnswerStr) {
|
|
|
}
|
|
|
var matchesWArr = AnswerStr.match(new RegExp(pattWStr, "ig"));
|
|
|
if (matchesWArr != null && matchesWArr.length > 0) {
|
|
|
- DataStr = matchesWArr[0];
|
|
|
- ReStr = AnswerStr.substring(0, (AnswerStr.indexOf(DataStr) + DataStr.length));
|
|
|
+ //DataStr = matchesWArr[0];
|
|
|
+ //ReStr = AnswerStr.substring(0, (AnswerStr.indexOf(DataStr) + DataStr.length));
|
|
|
+ ReStr = matchesWArr[0];
|
|
|
}
|
|
|
}
|
|
|
return ReStr;
|
|
|
}
|
|
|
|
|
|
-// 划分用户答案处理。待重构,将其划分写入(暂未处理)
|
|
|
+// 划分用户答案处理。待重构,将其划分写入(暂未处理)。AllAnswer所有的子span、mytext用户作答
|
|
|
function SplitUserAnswer(AllAnswer, mytext) {
|
|
|
var ReArr = [];
|
|
|
if (AllAnswer == undefined || AllAnswer == null || AllAnswer.length == 0) {
|
|
|
@@ -1067,19 +1082,23 @@ function SplitUserAnswer(AllAnswer, mytext) {
|
|
|
// 先将答案进行切割
|
|
|
var ReStr = ChangeCheckFlag(AllAnswer[i].Val, mytext);
|
|
|
if (ReStr != null && ReStr != "" && i != (AllAnswer.length - 1)) {
|
|
|
- var IndexVal = ReStr.length + AllAnswer[i].Val.length;
|
|
|
- mytext = mytext.replace(ReStr, "");
|
|
|
+ var RemoveStr = mytext.substring(0, (mytext.indexOf(ReStr) + ReStr.length)); // 匹配到的整句话
|
|
|
+ var PrevReStr = mytext.substring(0, mytext.indexOf(ReStr)); // 匹配到的前半部分(无适配/多余)
|
|
|
+ mytext = mytext.replace(RemoveStr, "");
|
|
|
if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "sentence") {
|
|
|
- // 检查是否属于高亮,存在需要恢复显示高亮(加class)
|
|
|
- ReStr = '<img src="' + PicInfo.sentenceIcoUrl + '" class="sentImagcs" data-lstatus="3" data-setstatus="1"><span id="' + AllAnswer[i].ID + '" name="S' + AllAnswer[i].ID + '" flag="sentence" class="sentenceStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
+ // 检查是否属于高亮,存在需要恢复显示高亮
|
|
|
+ ReStr = PrevReStr + '<img src="' + PicInfo.sentenceIcoUrl + '" class="sentImagcs" data-lstatus="3" data-setstatus="1"><span id="' + AllAnswer[i].ID + '" name="S' + AllAnswer[i].ID + '" flag="sentence" class="sentenceStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
}
|
|
|
else if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "phrase") {
|
|
|
// 检查是否属于高亮,存在需要恢复显示高亮(加class)
|
|
|
- ReStr = '<span id="' + AllAnswer[i].ID + '" name="P' + AllAnswer[i].ID + '" flag="phrase" class="phraseStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
+ ReStr = PrevReStr + '<span id="' + AllAnswer[i].ID + '" name="P' + AllAnswer[i].ID + '" flag="phrase" class="phraseStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
}
|
|
|
else if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "word") {
|
|
|
// 检查是否属于高亮,存在需要恢复显示高亮(加class)
|
|
|
- ReStr = '<span id="' + AllAnswer[i].ID + '" name="W' + AllAnswer[i].ID + '" flag="word" class="wordStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
+ ReStr = PrevReStr + '<span id="' + AllAnswer[i].ID + '" name="W' + AllAnswer[i].ID + '" flag="word" class="wordStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>';
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ReStr = PrevReStr + ReStr;
|
|
|
}
|
|
|
ReArr.push(ReStr);
|
|
|
}
|
|
|
@@ -1087,6 +1106,18 @@ function SplitUserAnswer(AllAnswer, mytext) {
|
|
|
ReArr.push("");
|
|
|
}
|
|
|
else {
|
|
|
+ if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "sentence") {
|
|
|
+ // 检查是否属于高亮,存在需要恢复显示高亮
|
|
|
+ mytext = mytextArr[0] + '<img src="' + PicInfo.sentenceIcoUrl + '" class="sentImagcs" data-lstatus="3" data-setstatus="1"><span id="' + AllAnswer[i].ID + '" name="S' + AllAnswer[i].ID + '" flag="sentence" class="sentenceStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>' + mytextArr[1];
|
|
|
+ }
|
|
|
+ else if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "phrase") {
|
|
|
+ // 检查是否属于高亮,存在需要恢复显示高亮(加class)
|
|
|
+ mytext = mytextArr[0] + '<span id="' + AllAnswer[i].ID + '" name="P' + AllAnswer[i].ID + '" flag="phrase" class="phraseStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>' + mytextArr[1];
|
|
|
+ }
|
|
|
+ else if (checkStrFunc(AllAnswer[i].ID) && AllAnswer[i].Type == "word") {
|
|
|
+ // 检查是否属于高亮,存在需要恢复显示高亮(加class)
|
|
|
+ mytext = mytextArr[0] + '<span id="' + AllAnswer[i].ID + '" name="W' + AllAnswer[i].ID + '" flag="word" class="wordStyle" data-setstatus="1" data-lstatus="1" kcode="' + AllAnswer[i].kcode + '" hitcode="' + AllAnswer[i].hitcode + '">' + ReStr + '</span>' + mytextArr[1];
|
|
|
+ }
|
|
|
ReArr.push(mytext);
|
|
|
}
|
|
|
}
|
|
|
@@ -1399,8 +1430,8 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
}
|
|
|
//音频节点
|
|
|
$(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
- $(item).attr("answer-url", answerList[index].AudioUrl);
|
|
|
- $(item).attr("answer-audiolength", answerList[index].AudioLength);
|
|
|
+ $(item).children(".answer-audio-range").attr("answer-url", answerList[index].AudioUrl);
|
|
|
+ $(item).children(".answer-audio-range").attr("answer-audiolength", answerList[index].AudioLength);
|
|
|
$(item).children(".answer-audio-range").attr("play-status", "0");
|
|
|
$(item).attr("data-astatus", "3");
|
|
|
}
|
|
|
@@ -1484,7 +1515,7 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
var hasAudio = false;
|
|
|
if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
hasAudio = true;
|
|
|
- var HtmlStr = '<div class="answer-audio-range" play-status="0" style="display:inline-block;"><img class="nextpic" src="' + PicInfo.recordPlayImgUrl + '" answer-audiolength="' + answerList[index].AudioLength + '" answer-url="' + answerList[index].AudioUrl + '"><span class="answer-audio-text">作答音频(' + answerList[index].AudioLength + 's)</span></div><span class="answer-audio-range-child"></span>';
|
|
|
+ var HtmlStr = '<div class="answer-audio-range" play-status="0" style="display:inline-block;" answer-audiolength="' + answerList[index].AudioLength + '" answer-url="' + answerList[index].AudioUrl + '"><img class="nextpic" src="' + PicInfo.recordPlayImgUrl + '"><span class="answer-audio-text">作答音频(' + answerList[index].AudioLength + 's)</span></div><span class="answer-audio-range-child"></span>';
|
|
|
$(".underlineContent[yaoshi-flag='" + answerid + "']").eq(0).html(HtmlStr);
|
|
|
}
|
|
|
//填充作答内容
|
|
|
@@ -1591,9 +1622,11 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
else {
|
|
|
var AllAnswer = []; // 记录所有标准答案
|
|
|
$.each($(".underlineContent[yaoshi-flag='" + answerid + "']"), function (tIndex, tItem) {
|
|
|
- var TVal = ChangeSpaceStr($(tItem).text());
|
|
|
- var infos = { ID: $(tItem).attr("id"), Type: $(tItem).attr("flag"), Val: TVal, kcode: $(tItem).attr("kcode"), hitcode: $(tItem).attr("hitcode") };
|
|
|
- AllAnswer.push(infos);
|
|
|
+ $.each($(tItem).find("span"), function (oIndex, oItem) {
|
|
|
+ var TVal = ChangeSpaceStr($(oItem).text());
|
|
|
+ var infos = { ID: $(oItem).attr("id"), Type: $(oItem).attr("flag"), Val: TVal, kcode: $(oItem).attr("kcode"), hitcode: $(oItem).attr("hitcode") };
|
|
|
+ AllAnswer.push(infos);
|
|
|
+ });
|
|
|
});
|
|
|
mytext = ChangeSpaceStr(mytext);
|
|
|
var ReArr = SplitUserAnswer(AllAnswer, mytext);
|
|
|
@@ -1669,6 +1702,8 @@ function AddClickEvent() {
|
|
|
$(".audioImg").unbind("click");
|
|
|
//点击播放事件,视频播放
|
|
|
$(".videoImg").unbind("click");
|
|
|
+ //作答录音播放按钮点击事件
|
|
|
+ $(".answer-audio-range").unbind("click");
|
|
|
// 重新绑定
|
|
|
// 绑定答题点
|
|
|
$(".answer-body").on("click", function () {
|
|
|
@@ -1748,13 +1783,16 @@ function AddClickEvent() {
|
|
|
}
|
|
|
else {
|
|
|
$(".underlineContent[parent-anid=" + curObj.pId + "]").parent(".ULCBGUse").attr("data-select", WType);
|
|
|
- if ($(".underlineContent[parent-anid=" + curObj.pId + "]").length > 1) {
|
|
|
- $(".underlineContent[parent-anid=" + curObj.pId + "]").first().parent(".ULCBGUse").css("border-radius", "5px 0px 0px 5px");
|
|
|
- $(".underlineContent[parent-anid=" + curObj.pId + "]").last().parent(".ULCBGUse").css("border-radius", "0px 5px 5px 0px");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(".underlineContent[parent-anid=" + curObj.pId + "]").parent(".ULCBGUse").css("border-radius", "5px");
|
|
|
- }
|
|
|
+ $.each($(".underlineContent[parent-anid=" + curObj.pId + "]"), 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");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}, 100);
|
|
|
//已作答,弹出作答答案
|
|
|
@@ -1838,6 +1876,13 @@ function AddClickEvent() {
|
|
|
var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
});
|
|
|
+ //作答录音播放按钮点击事件
|
|
|
+ $(".answer-audio-range").on("click", function () {
|
|
|
+ $(".select-answer").removeClass("select-answer");
|
|
|
+ var AudioID= $(this).parent(".underlineContent").attr("yaoshi-flag");
|
|
|
+ var AudioUrl= $(this).attr("answer-url");
|
|
|
+ recordAudioClick(this, AudioID, AudioUrl);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1848,19 +1893,6 @@ function AddClickEvent() {
|
|
|
// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
// data高亮知识点
|
|
|
function stuEntryFunc(sWidthVal, isAStatus, isMAStatus, data) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $("#STIDStr").remove();
|
|
|
- //$(this).after('<div id="STIDStr" style="position:fixed;top:100px;left:10px;width:200px;height:20px;background-color:yellow;color:#000;">display:' + $(this).css("display") + "=>showflag:" + $(this).attr("showflag") + '</div>');
|
|
|
- $(".yaoshi").eq(0).after('<div id="STIDStr" style="position:fixed;top:100px;left:10px;width:350px;height:auto;background-color:yellow;color:#000;"></div>');
|
|
|
- var TStr = $("#STIDStr").text() + "=>stuEntryFunc";
|
|
|
- $("#STIDStr").text(TStr);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
bindEventYS(sWidthVal, isAStatus, isMAStatus);
|
|
|
if (cTTypeFunc == 2) {
|
|
|
TFillData = JSON.parse(data);
|
|
|
@@ -2127,4 +2159,60 @@ function hitCodeFunc(code) {
|
|
|
// 设置离焦事件
|
|
|
function resetPressFlag() {
|
|
|
pressTableFlag = false;
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+//作答录音播放按钮点击事件
|
|
|
+function recordAudioClick(myobj, id, url) {
|
|
|
+ $(".select-answer").removeClass("select-answer");
|
|
|
+ $(".ULCBGUse").attr("data-select", "0");
|
|
|
+ $(myobj).parent(".underlineContent").parent(".ULCBGUse").attr("data-select", "1");
|
|
|
+ $(myobj).parent().parent("answer-body").addClass("select-answer");
|
|
|
+ //处理当前按钮的状态
|
|
|
+ if ($(myobj).attr("play-status") == "0") {
|
|
|
+ //停止其他作答音频播放
|
|
|
+ var isRecordPlaying = $(".answer-audio-range[play-status='1']");
|
|
|
+ if (isRecordPlaying.length > 0) {
|
|
|
+ $(isRecordPlaying).attr("play-status", "0");
|
|
|
+ $(isRecordPlaying).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+ //停止其他原文音频播放
|
|
|
+ var audioPlaying = $(".audioImg[play-status='1']");
|
|
|
+ if (audioPlaying.length > 0) {
|
|
|
+ $(audioPlaying).attr("play-status", "0");
|
|
|
+ $(audioPlaying).attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地 喇叭 路径替换
|
|
|
+ }
|
|
|
+ //设置播放状态
|
|
|
+ $(myobj).attr("play-status", "1");
|
|
|
+ $(myobj).find("img").attr("src", PicInfo.recordPauseImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(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));
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function Running() {
|
|
|
+ window.setTimeout(function () {
|
|
|
+ $("#STIDStr").remove();
|
|
|
+ //$(this).after('<div id="STIDStr" style="position:fixed;top:100px;left:10px;width:200px;height:20px;background-color:yellow;color:#000;">display:' + $(this).css("display") + "=>showflag:" + $(this).attr("showflag") + '</div>');
|
|
|
+ $("p").eq(0).after('<div id="STIDStr" style="position:fixed;top:100px;left:10px;width:350px;height:auto;background-color:yellow;color:#000;overflow:hidden;"></div>');
|
|
|
+ var TStr = $("#STIDStr").text() + "=>Running";
|
|
|
+ $("#STIDStr").text(TStr);
|
|
|
+ }, 500);
|
|
|
+}
|
|
|
+Running();
|