|
|
@@ -0,0 +1,2234 @@
|
|
|
+//播放音频图片地址
|
|
|
+var PicInfo = {
|
|
|
+ answerPointImgUrl: "file:///android_asset/js/update-answer.png",
|
|
|
+ yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
|
|
|
+ yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
|
|
|
+ recordPlayImgUrl: "file:///android_asset/js/play.png",
|
|
|
+ recordPauseImgUrl: "file:///android_asset/js/pause.png",
|
|
|
+ audioPlayImgUrl: "file:///android_asset/js/dynaiselaba.gif",
|
|
|
+ audioPauseImgUrl: "file:///android_asset/js/dynaiselaba.png",
|
|
|
+ sentenceIcoUrl: "file:///android_asset/js/sentenceIco.png"
|
|
|
+}
|
|
|
+
|
|
|
+//本地调用用的资源
|
|
|
+var PicInfo1 = {
|
|
|
+ answerPointImgUrl: "../Images/update-answer.png",
|
|
|
+ yaoshiShowImgUrl: "../Images/yaoshi-show.png",
|
|
|
+ yaoshiHideImgUrl: "../Images/yaoshi-hide.png",
|
|
|
+ KouYuTagImgUrl: "../Images/KY.png",
|
|
|
+ recordPlayImgUrl: "../Images/play.png",
|
|
|
+ recordPauseImgUrl: "../Images/pause.png",
|
|
|
+ audioPlayImgUrl: "../Images/dynaiselaba.gif",
|
|
|
+ audioPauseImgUrl: "../Images/dynaiselaba.png",
|
|
|
+ sentenceIcoUrl: "../Images/sentenceIco.png"
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+// 公用方法
|
|
|
+// 检测安卓和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;
|
|
|
+ }
|
|
|
+}();
|
|
|
+
|
|
|
+// 删除叼毛题库原先附加无用属性
|
|
|
+function dealUnderLineFunc() {
|
|
|
+ // 打理干净underline
|
|
|
+ $.each($('.underline').not(".underlineContent"), function () {
|
|
|
+ if ($(this).find(".underlineContent").length > 0) {
|
|
|
+ var ClsNmae = $(this).attr("class");
|
|
|
+ ClsNmae = ClsNmae.replace("underline", "").replace(" ", " ");
|
|
|
+ $(this).attr("class", ClsNmae);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(this).remove(); // 删除全部
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 删除全部underlineContent的颜色
|
|
|
+ $(".underlineContent").css("color", "");
|
|
|
+ // 删除要是的display
|
|
|
+ $.each($('.yaoshi'), function () {
|
|
|
+ var StyleStr = $(this).attr("style");
|
|
|
+ if (StyleStr == undefined || StyleStr == null || StyleStr == "") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var StyleArr = StyleStr.split(";");
|
|
|
+ StyleStr = "";
|
|
|
+ for (var i = 0; i < StyleArr.length; i++) {
|
|
|
+ if (StyleArr[i].indexOf("display") == -1 && StyleStr == "") {
|
|
|
+ StyleStr += StyleArr[i];
|
|
|
+ }
|
|
|
+ else if (StyleArr[i].indexOf("display") == -1 && StyleStr != "") {
|
|
|
+ StyleStr += ";" + StyleArr[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(this).attr("style", StyleStr);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 查找该img下的underlinecontent
|
|
|
+function selectImgULContent(item, Id) {
|
|
|
+ var uLCClsName = item.attr("class");
|
|
|
+ var nItem = item.next();
|
|
|
+ var pItem = item.parent();
|
|
|
+ if (uLCClsName != undefined && uLCClsName.indexOf("yaoshi") > -1) {
|
|
|
+ // 到达下一个钥匙的位置了,终止
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (uLCClsName != undefined && uLCClsName.indexOf("underlineContent") > -1 && uLCClsName.indexOf("noKey") == -1) {
|
|
|
+ // 如果为答题点
|
|
|
+ item.attr("yaoshi-flag", Id).attr("showflag", "1");
|
|
|
+ }
|
|
|
+ // 判断子节点是否存在钥匙标签
|
|
|
+ if (item.find(".yaoshi").length == 0) {
|
|
|
+ $.each(item.find(".underlineContent").not(".noKey"), function (iIndex, iItem) {
|
|
|
+ $(iItem).attr("yaoshi-flag", Id).attr("showflag", "1");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return selectImgULContent(item.children(":first"), Id); // 获取第一个子节点
|
|
|
+ }
|
|
|
+ if (nItem.length > 0) {
|
|
|
+ return selectImgULContent(nItem, Id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (pItem[0] == undefined || pItem[0].tagName.toUpperCase() == "BODY") {
|
|
|
+ // 到达网页根节点,终止
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return selectImgULContent(pItem.next(), Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 点击事件样式渲染
|
|
|
+var ClickRecFunc = function (pID) {
|
|
|
+ if (pID == undefined || pID == null || pID == "") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ var jqStr = ".answer-body[parent-anid='" + pID + "']";
|
|
|
+ $(jqStr).addClass("select-answer");
|
|
|
+ if ($(jqStr).attr("data-astatus") == "1") {
|
|
|
+ var curObj = new Object();
|
|
|
+ curObj.Id = $(jqStr).attr("answer-id");//答题点ID
|
|
|
+ curObj.pId = $(jqStr).attr("parent-anid");//答题点ID
|
|
|
+ curObj.IsKY = $(jqStr).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ curObj.AnsText = $(jqStr).attr("answer-anstext");//参考答案
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// #region 表格处理
|
|
|
+var pressTableFlag = false;
|
|
|
+// 处理表格内的图片宽度
|
|
|
+var DealImageWFunc = function (Item, WidthVal) {
|
|
|
+ var pattWStr = new RegExp(/width\s?:\s?[0-9]+%;/ig);
|
|
|
+ var pattWStr2 = new RegExp(/width\s?=\s?["|'|0-9]+%/ig);
|
|
|
+ $.each($(Item).find("img").not(".nextpic"), function (index, iItem) {
|
|
|
+ var HtmlStr = $(iItem).prop("outerHTML");
|
|
|
+ var matchesWArr = HtmlStr.match(pattWStr);
|
|
|
+ if (matchesWArr != null && matchesWArr.length > 0) {
|
|
|
+ if (matchesWArr[0].indexOf("%") > -1) {
|
|
|
+ var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", ""));
|
|
|
+ $(this).css("width", (WidthVal * TWidthVal / 100) + "px");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var matchesWArr = HtmlStr.match(pattWStr2);
|
|
|
+ if (matchesWArr != null && matchesWArr.length > 0) {
|
|
|
+ if (matchesWArr[0].indexOf("%") > -1) {
|
|
|
+ var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("\"", "").replace("width=", ""));
|
|
|
+ $(this).css("width", (WidthVal * TWidthVal / 100) + "px");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+// 获取最大字符长度的字符串(起决定宽度的字符串/将字符去除HTML标签)
|
|
|
+var removeHtmlFunc = function (htmlStr, TdWidthVal) {
|
|
|
+ var ReArr = {
|
|
|
+ TextStr: "",
|
|
|
+ WidthVal: 0,
|
|
|
+ ImgFlag: false,
|
|
|
+ };
|
|
|
+ // 清除非长度标签
|
|
|
+ var pattStr = new RegExp(/<(img){1}.*?>/ig);
|
|
|
+ var matchesArr = htmlStr.match(pattStr);
|
|
|
+ if (matchesArr != null && (matchesArr != undefined && matchesArr.length > 0)) {
|
|
|
+ for (var i = 0; i < matchesArr.length; i++) {
|
|
|
+ if (matchesArr[i].indexOf("nextpic") == -1) {
|
|
|
+ var TempWidthVal = 0;
|
|
|
+ var pattWStr = new RegExp(/width\s?:\s?[0-9|p|x|%]+;/ig);
|
|
|
+ var matchesWArr = matchesArr[i].match(pattWStr);
|
|
|
+ if (matchesWArr != null && matchesWArr.length > 0) {
|
|
|
+ if (matchesWArr[0].indexOf("%") > -1) {
|
|
|
+ var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", ""));
|
|
|
+ TempWidthVal += TdWidthVal * TWidthVal;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width:", "").replace("px", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pattWStr = new RegExp(/width\s?=\s?["|'|0-9|p|x|%]+/ig);
|
|
|
+ matchesWArr = matchesArr[i].match(pattWStr);
|
|
|
+ if (matchesWArr != null && matchesWArr.length > 0) {
|
|
|
+ if (matchesWArr[0].indexOf("%") > -1) {
|
|
|
+ var TWidthVal = parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", ""));
|
|
|
+ TempWidthVal += TdWidthVal * TWidthVal;
|
|
|
+ } else {
|
|
|
+ TempWidthVal += parseFloat(matchesWArr[0].replace(/\s/g, "").replace("width=", "").replace("px", ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ReArr.WidthVal = TempWidthVal > ReArr.WidthVal ? TempWidthVal : ReArr.WidthVal;
|
|
|
+ if (ReArr.WidthVal != 0) {
|
|
|
+ ReArr.ImgFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ htmlStr = htmlStr.replace(matchesArr[i], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 其他处理
|
|
|
+ pattStr = new RegExp(/(<(p){1}.*?>).*?(<\/\2>)/ig);
|
|
|
+ matchesArr = htmlStr.match(pattStr);
|
|
|
+ if (matchesArr != undefined && matchesArr.length > 0) {
|
|
|
+ // 清除匹配的P标签
|
|
|
+ for (var i = 0; i < matchesArr.length; i++) {
|
|
|
+ // 去除多标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}.*?>).*?(<\/\2>)/i);
|
|
|
+ var NewhtmlStr = matchesArr[i];
|
|
|
+ while (pattStr.test(NewhtmlStr)) {
|
|
|
+ var tTmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ NewhtmlStr = NewhtmlStr.replace(tTmatchesArr[1], "").replace(tTmatchesArr[3], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去除单标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}\\s*\/\\s*>)/i);
|
|
|
+ while (pattStr.test(NewhtmlStr)) {
|
|
|
+ var tTmatchesArr = NewhtmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ NewhtmlStr = NewhtmlStr.replace(tTmatchesArr[1], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (i == 0 || (htmlStr.length < NewhtmlStr.length)) {
|
|
|
+ htmlStr = NewhtmlStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}.*?>).*?(<\/\2>)/i); // 去除多标签
|
|
|
+ while (pattStr.test(htmlStr)) {
|
|
|
+ var tTmatchesArr = htmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ htmlStr = htmlStr.replace(tTmatchesArr[1], "").replace(tTmatchesArr[3], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去除单标签
|
|
|
+ pattStr = new RegExp(/(<([a-z|A-Z]+){1}\\s*\/\\s*>)/i);
|
|
|
+ while (pattStr.test(htmlStr)) {
|
|
|
+ var tTmatchesArr = htmlStr.match(pattStr);
|
|
|
+ if (tTmatchesArr.length > 0) {
|
|
|
+ // 存在P标签
|
|
|
+ htmlStr = htmlStr.replace(tTmatchesArr[1], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去除多空格
|
|
|
+ while (htmlStr.match(/\s\s/g)) {
|
|
|
+ htmlStr = htmlStr.replace(/\s\s/g, " ");
|
|
|
+ }
|
|
|
+ while (htmlStr.indexOf(" ") > -1) {
|
|
|
+ htmlStr = htmlStr.replace(" ", " ");
|
|
|
+ }
|
|
|
+
|
|
|
+ ReArr.TextStr = htmlStr;
|
|
|
+ return ReArr;
|
|
|
+};
|
|
|
+// 计算存在padding的表格
|
|
|
+function GetPadVal(THandel) {
|
|
|
+ // 判断是否存在border
|
|
|
+ var BorderVal = 0;
|
|
|
+ var BorderStr = $(THandel).css("border-right-width");
|
|
|
+ if (BorderStr != null && BorderStr != "") {
|
|
|
+ BorderVal = parseFloat(BorderStr.replace("px").replace("PX"));
|
|
|
+ }
|
|
|
+ BorderStr = $(THandel).css("border-right-width");
|
|
|
+ if (BorderStr != null && BorderStr != "") {
|
|
|
+ BorderVal += parseFloat(BorderStr.replace("px").replace("PX"));
|
|
|
+ }
|
|
|
+ // 判断是否存在padding
|
|
|
+ var PaddingVal = $(THandel).css("padding");
|
|
|
+ if (PaddingVal == null || PaddingVal == "") {
|
|
|
+ PaddingVal = parseFloat($(THandel).css("padding-left")) + parseFloat($(THandel).css("padding-right"));
|
|
|
+ if (PaddingVal == null || PaddingVal == "") {
|
|
|
+ return BorderVal;
|
|
|
+ }
|
|
|
+ return BorderVal + PaddingVal;
|
|
|
+ }
|
|
|
+ var PadValArr = PaddingVal.split(" ");
|
|
|
+ if (PadValArr.length > 2) {
|
|
|
+ return BorderVal + parseFloat(PadValArr[1]) + parseFloat(PadValArr[3]);
|
|
|
+ }
|
|
|
+ else if (PadValArr.length > 1) {
|
|
|
+ return BorderVal + parseFloat(PadValArr[1]) * 2;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return BorderVal + parseFloat(PadValArr[0]) * 2;
|
|
|
+ }
|
|
|
+};
|
|
|
+// 动态获取表格最小宽度设置(最小宽度165px)
|
|
|
+var GetMinTableVal = function (TSWidth) {
|
|
|
+ if (TSWidth > 320) {
|
|
|
+ return 165 + (TSWidth - 320) * 0.09;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return 165;
|
|
|
+ }
|
|
|
+};
|
|
|
+var AdjustTableFunc = function (sWidthVal, isAStatus) {
|
|
|
+ if ($("table").length == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 添加宽度处理
|
|
|
+ var ScreenWidth = sWidthVal;
|
|
|
+ var TempMinWidth = GetMinTableVal(ScreenWidth);
|
|
|
+ $(document.body).append('<span id="pContrainId"></span>');
|
|
|
+ $("table").find(".yaoshi").addClass("nextpic");
|
|
|
+ $.each($("table"), function (index, item) {
|
|
|
+ // 处理表格总宽度
|
|
|
+ var ArrMaxLen = [];
|
|
|
+ var FJArrMaxLen = [];
|
|
|
+ var TableWidth = 0;
|
|
|
+ var TotalMaxLen = 0;
|
|
|
+ var RuleFlag = true; // 表示规则
|
|
|
+ var HasIndex = 0;
|
|
|
+ RSArrs = [];
|
|
|
+ var NewAStatus = (isAStatus == "undefined" || isAStatus == undefined || isAStatus == null) ? 0 : parseInt(isAStatus);
|
|
|
+ if (NewAStatus == 1) {
|
|
|
+ // 判断是否存在答题点
|
|
|
+ NewAStatus = $(item).find(".yaoshi").length > 0 ? 1 : 0;
|
|
|
+ }
|
|
|
+ var CheckBoxFlag = $(item).find(".boxQue").length > 0 && $(item).find(".boxQue").length == $(item).find(".yaoshi").length; // 判断是否是只存在多选框,定位对应的列
|
|
|
+ $.each($(item).find("tr"), function (trIndex, trItem) {
|
|
|
+ $.each($(trItem).find("td"), function (tdIndex, tdItem) {
|
|
|
+ var RowSpanNum = parseInt($(tdItem).attr("rowspan"));
|
|
|
+ var ColSpanNum = parseInt($(tdItem).attr("colspan"));
|
|
|
+ RowSpanNum = (RowSpanNum == 0 || isNaN(RowSpanNum)) ? 1 : RowSpanNum;
|
|
|
+ ColSpanNum = (ColSpanNum == 0 || isNaN(ColSpanNum)) ? 1 : ColSpanNum;
|
|
|
+ if (ColSpanNum > 1) {
|
|
|
+ RuleFlag = false;
|
|
|
+ }
|
|
|
+ if (RowSpanNum > 1) {
|
|
|
+ var RSArr = {
|
|
|
+ RSIndex: HasIndex,
|
|
|
+ RSNumber: RowSpanNum,
|
|
|
+ RSXIndex: tdIndex,
|
|
|
+ RSYIndex: trIndex
|
|
|
+ };
|
|
|
+ HasIndex += 1;
|
|
|
+ RSArrs.push(RSArr);
|
|
|
+ }
|
|
|
+ var WidthVal = $(tdItem).css("width").replace("px", "");
|
|
|
+ var RemoveHtmlArr = removeHtmlFunc($(tdItem).html(), WidthVal);
|
|
|
+ // 附加处理图片宽度
|
|
|
+ DealImageWFunc(trItem, WidthVal);
|
|
|
+ $("#pContrainId").text(RemoveHtmlArr.TextStr);
|
|
|
+ var tdWidthVal = $("#pContrainId").width() + parseFloat(RemoveHtmlArr.WidthVal); // 获取文字宽度
|
|
|
+ tdWidthVal += GetPadVal($(tdItem)) + 10;
|
|
|
+ if (!RemoveHtmlArr.ImgFlag && (tdWidthVal > ScreenWidth)) {
|
|
|
+ tdWidthVal = ScreenWidth;
|
|
|
+ }
|
|
|
+ // 判断是否需要设置最小宽度
|
|
|
+ if (tdWidthVal < TempMinWidth && NewAStatus == 1 && !CheckBoxFlag) {
|
|
|
+ tdWidthVal = TempMinWidth;
|
|
|
+ }
|
|
|
+ if (tdWidthVal < 100 && NewAStatus == 1 && !CheckBoxFlag) {
|
|
|
+ tdWidthVal = 100;
|
|
|
+ }
|
|
|
+ if (ArrMaxLen.length < tdIndex + 1) {
|
|
|
+ ArrMaxLen.push(0);
|
|
|
+ }
|
|
|
+ if (RSArrs.length > 0) {
|
|
|
+ for (var i = 0; i < RSArrs.length; i++) {
|
|
|
+ if (RSArrs[i].RSNumber > 1 && RSArrs[i].RSYIndex == trIndex) {
|
|
|
+ if (ArrMaxLen[tdIndex] < tdWidthVal && ColSpanNum == 1) {
|
|
|
+ TotalMaxLen += tdWidthVal - ArrMaxLen[tdIndex];
|
|
|
+ ArrMaxLen[tdIndex] = tdWidthVal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (ArrMaxLen[tdIndex] < tdWidthVal && ColSpanNum == 1) {
|
|
|
+ TotalMaxLen += tdWidthVal - ArrMaxLen[tdIndex];
|
|
|
+ ArrMaxLen[tdIndex] = tdWidthVal;
|
|
|
+ }
|
|
|
+ else if (ColSpanNum > 1) {
|
|
|
+ var AddFlag = true;
|
|
|
+ for (var i = 0; i < FJArrMaxLen.length; i++) {
|
|
|
+ if (FJArrMaxLen[i].tdIndex == tdIndex) {
|
|
|
+ if (FJArrMaxLen[i].WidthVal < tdWidthVal) {
|
|
|
+ FJArrMaxLen[i].WidthVal = tdWidthVal;
|
|
|
+ AddFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (AddFlag) {
|
|
|
+ FJArrMaxLen.push({ trIndex: trIndex, tdIndex: tdIndex, WidthVal: tdWidthVal });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (var i = 0; i < RSArrs.length; i++) {
|
|
|
+ if (RSArrs[i].RSNumber > 1) {
|
|
|
+ RSArrs[i].RSNumber -= 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ RSArrs.splice(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (var i = 0; i < FJArrMaxLen.length; i++) {
|
|
|
+ for (var j = 0; j < ArrMaxLen.length; j++) {
|
|
|
+ if (ArrMaxLen[j] == 0 && FJArrMaxLen[i].tdIndex == j) {
|
|
|
+ ArrMaxLen[j] = FJArrMaxLen[i].WidthVal;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断表格是否只有一行
|
|
|
+ if ($(item).find("tr").length == 1 && $(item).find("td").length == 1) {
|
|
|
+ $(item).find("tr").eq(0).find("td").eq(0).css("width", ScreenWidth + "px");
|
|
|
+ $(item).css("width", ScreenWidth + "px");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (TotalMaxLen < ScreenWidth) {
|
|
|
+ var AddPx = (ScreenWidth - TotalMaxLen) / ArrMaxLen.length;
|
|
|
+ AddPx = AddPx > 2 ? AddPx - 2 : AddPx;
|
|
|
+ for (var i = 0; i < ArrMaxLen.length; i++) {
|
|
|
+ ArrMaxLen[i] += AddPx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var OneFlag = false;
|
|
|
+ for (var i = 0; i < ArrMaxLen.length; i++) {
|
|
|
+ if (ArrMaxLen[i] != undefined && ($(item).find("td").length > 1 || $(item).find("tr").length > 1) && RuleFlag) {
|
|
|
+ if (i < ArrMaxLen.length - 1) {
|
|
|
+ $(item).find("tr").find("td").eq(i).css("width", ArrMaxLen[i] + "px");
|
|
|
+ TableWidth += ArrMaxLen[i];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).find("tr").find("td").eq(i).css("width", (ArrMaxLen[i] - 10) + "px");
|
|
|
+ TableWidth += (ArrMaxLen[i] - 10);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (ArrMaxLen[i] != undefined && $(item).find("tr").length == 1 && $(item).find("td").length == 1) {
|
|
|
+ OneFlag = true;
|
|
|
+ if (ArrMaxLen.length - 1 == i) {
|
|
|
+ TableWidth += ArrMaxLen[i] - 10;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TableWidth += ArrMaxLen[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ArrMaxLen != undefined && ($(item).find("td").length > 1 || $(item).find("tr").length > 1) && !RuleFlag) {
|
|
|
+ var TWAFlag = true;
|
|
|
+ $.each($(item).find("tr"), function (trIndex, trItem) {
|
|
|
+ if ($(trItem).find("td").length == ArrMaxLen.length) {
|
|
|
+ $.each($(trItem).find("td"), function (tdIndex, tdItem) {
|
|
|
+ if (TWAFlag) {
|
|
|
+ TableWidth += ArrMaxLen[tdIndex];
|
|
|
+ }
|
|
|
+ $(tdItem).css("width", ArrMaxLen[tdIndex] + "px");
|
|
|
+ });
|
|
|
+ TWAFlag = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (OneFlag) {
|
|
|
+ $(item).find("tr").eq(0).find("td").eq(0).css("width", TableWidth + "px");
|
|
|
+ }
|
|
|
+ $(item).css("width", TableWidth + "px");
|
|
|
+ }
|
|
|
+ // 替换HTML
|
|
|
+ var ChildhtmlStr = $(item).prop("outerHTML");
|
|
|
+ var htmlStr = "<div class='TableContainer TContain_" + index + "' data-isaflag='" + NewAStatus + "' data-allcb='" + (CheckBoxFlag ? 1 : 0) + "' data-mtype='" + cTTypeFunc + "' data-fsFlag='100'></div>";
|
|
|
+ $(item).after(htmlStr);
|
|
|
+ $(item).remove();
|
|
|
+ var JqStr = ".TContain_" + index;
|
|
|
+ $(JqStr).append(ChildhtmlStr);
|
|
|
+ });
|
|
|
+ var BodyWidth = isNaN(parseFloat(ScreenWidth)) ? 0 : parseFloat(ScreenWidth); // 界面宽度
|
|
|
+ $.each($("table"), function (index, item) {
|
|
|
+ var TableWidth = isNaN(parseFloat($(item).width())) ? 0 : parseFloat($(item).width()); // 表格宽度
|
|
|
+ // 替换HTML
|
|
|
+ var JqStr = ".TContain_" + index;
|
|
|
+ $(JqStr).css("width", BodyWidth + "px");
|
|
|
+ if (TableWidth > BodyWidth) {
|
|
|
+ // 额外显示滚动条
|
|
|
+ var ShtmlStr = "<div class='PSBar' style='width: " + BodyWidth + "px;'></div>";
|
|
|
+ $(JqStr).after(ShtmlStr);
|
|
|
+ var HiddenRate = BodyWidth / TableWidth; // 滚动条比率
|
|
|
+ var HiddenWidth = BodyWidth - (TableWidth - BodyWidth) * HiddenRate; // 现滚动条大小
|
|
|
+ var CShtmlStr = "<div class='CSBar' style='width: " + HiddenWidth + "px;'></div>";
|
|
|
+ $(JqStr).next().append(CShtmlStr);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(JqStr).css("margin-bottom", "15px");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $.each($(".container-table"), function (index, item) {
|
|
|
+ $(item).css("width", BodyWidth + "px");
|
|
|
+ });
|
|
|
+ // 滚动条事件
|
|
|
+ $(".TableContainer").on("touchstart", function () {
|
|
|
+ pressTableFlag = true;
|
|
|
+ }).on("touchmove", function () {
|
|
|
+ var TableWidth = isNaN(parseFloat($(this).find("table").width())) ? 0 : parseFloat($(this).find("table").width()); // 表格宽度
|
|
|
+ var HiddenRate = BodyWidth / TableWidth; // 滚动条比率
|
|
|
+ var SLeftWdith = isNaN(parseFloat($(this)[0].scrollLeft)) ? 0 : parseFloat($(this)[0].scrollLeft);
|
|
|
+ SLeftWdith *= HiddenRate;
|
|
|
+ var NextClsName = $(this).next().attr("class");
|
|
|
+ if (NextClsName == "PSBar") {
|
|
|
+ $(this).next().find(".CSBar").css("left", SLeftWdith + "px");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ window.addEventListener("scroll", function (event) {
|
|
|
+ var ClsName = event.target.className;
|
|
|
+ if (ClsName == undefined) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ClsName = ClsName.replace("TableContainer ", ".");
|
|
|
+ var TableWidth = isNaN(parseFloat($(ClsName).find("table").width())) ? 0 : parseFloat($(ClsName).find("table").width()); // 表格宽度
|
|
|
+ var HiddenRate = BodyWidth / TableWidth; // 滚动条比率
|
|
|
+ var SLeftWdith = isNaN(parseFloat($(ClsName)[0].scrollLeft)) ? 0 : parseFloat($(ClsName)[0].scrollLeft);
|
|
|
+ SLeftWdith *= HiddenRate;
|
|
|
+ var NextClsName = $(ClsName).next().attr("class");
|
|
|
+ if (NextClsName == "PSBar") {
|
|
|
+ $(ClsName).next().find(".CSBar").css("left", SLeftWdith + "px");
|
|
|
+ }
|
|
|
+ }, true);
|
|
|
+ $("#pContrainId").remove();
|
|
|
+};
|
|
|
+// #endregion
|
|
|
+
|
|
|
+//#region 听力音频处理
|
|
|
+var LimitPreFlag = false; // 限制点击过宽
|
|
|
+var AddListenDiv = function (NodeHandle, NIndex, sWidthVal) {
|
|
|
+ var UrlStr = $(NodeHandle).attr("alt");
|
|
|
+ var ListenDivWidth = sWidthVal;
|
|
|
+ ListenDivWidth = (ListenDivWidth > 414 ? 414 : ListenDivWidth);
|
|
|
+ if (UrlStr != null && UrlStr.indexOf("|") > -1) {
|
|
|
+ var UrlArr = UrlStr.split("|");
|
|
|
+ var UrlArrLen = UrlArr.length;
|
|
|
+ var htmlStr = '<div class="ListenDiv" data-status="1" style="width:' + ListenDivWidth + 'px;"><div class="LDivTop">';
|
|
|
+ var MaxLeftVal = (ListenDivWidth - 295) / 2; // 自动调整宽度
|
|
|
+ var selectIndex = 0;
|
|
|
+ for (var i = 0; i < UrlArr.length; i++) {
|
|
|
+ var SelectedN = (i == 0 ? 1 : 0);
|
|
|
+ if (SelectedN) {
|
|
|
+ selectIndex = i;
|
|
|
+ }
|
|
|
+ htmlStr += '<div class="LDivTItem LDivTItem_' + NIndex + ' LDivTItem_' + NIndex + '_' + i + '" data-selected="' + SelectedN + '" onclick="cLSourceFunc(' + NIndex + ',' + i + ')" data-auduourl="' + UrlArr[i] + '" style="margin-left:' + MaxLeftVal + 'px;">听力材料' + (i + 1) + '</div>';
|
|
|
+ }
|
|
|
+ htmlStr += '</div><div class="LDivFooter"><div class="LDFPlayS LDFPlayS_' + NIndex + '" data-playstatus="0" onclick="playMusicFunc(' + NIndex + ')"></div><div class="LDFPauseS LDFPauseS_' + NIndex + '" onclick="pauseMusicFunc(' + NIndex + ')"></div><div class="LDFProcS"><div class="LDFPWhite LDFPWhite_' + NIndex + '"></div><div class="LDFProcImg LDFProcImg_' + NIndex + '"></div></div><div class="LDFTimerS" data-mtype="' + cTTypeFunc + '" data-fsFlag="100" data-ismaflag="' + IsZTKEStatus + '"><span class="RunTime RunTime_' + NIndex + '">00:00</span><span>/</span><span class="RunAllTime RunAllTime_' + NIndex + '">00:00</span></div></div><div class="SImg SImg_' + NIndex + '" data-urlindex="' + selectIndex + '" data-urllen="' + UrlArrLen + '" data-mlval="' + MaxLeftVal + '"></div></div>';
|
|
|
+ }
|
|
|
+ else if (UrlStr != null) {
|
|
|
+ var htmlStr = '<div class="ListenDiv" data-status="0" style="width:' + ListenDivWidth + 'px;"><div class="LDivTop" style="width:1px;height:0px;overflow:hidden;"><div class="LDivTItem LDivTItem_' + NIndex + ' LDivTItem_' + NIndex + '_0" data-selected="1" onclick="cLSourceFunc(' + NIndex + ',0)" data-selected="1" data-auduourl="' + UrlStr + '"></div></div><div class="LDivFooter"><div class="LDFPlayS LDFPlayS_' + NIndex + '" data-playstatus="0" onclick="playMusicFunc(' + NIndex + ')"></div><div class="LDFPauseS LDFPauseS_' + NIndex + '" onclick="pauseMusicFunc(' + NIndex + ')"></div><div class="LDFProcS"><div class="LDFPWhite LDFPWhite_' + NIndex + '"></div><div class="LDFProcImg LDFProcImg_' + NIndex + '"></div></div><div class="LDFTimerS" data-mtype="' + cTTypeFunc + '" data-fsFlag="100" data-ismaflag="' + IsZTKEStatus + '"><span class="RunTime RunTime_' + NIndex + '">00:00</span><span>/</span><span class="RunAllTime RunAllTime_' + NIndex + '">00:00</span></div></div></div>';
|
|
|
+ }
|
|
|
+ $(NodeHandle).css("width", "1px").css("height", "1px").css("overflow", "hidden").after(htmlStr);
|
|
|
+ // 添加滑块事件
|
|
|
+ $(".LDFProcImg")[NIndex].addEventListener("touchstart", TouchStartFunc, false);
|
|
|
+ $(".LDFProcImg")[NIndex].addEventListener("touchmove", TouchMoveFunc, false);
|
|
|
+ $(".LDFProcImg")[NIndex].addEventListener("touchend", TouchEndFunc, false);
|
|
|
+}
|
|
|
+// 切换听力材料
|
|
|
+var cLSourceFunc = function (iIndex, oIndex) {
|
|
|
+ pauseMusicFunc(iIndex);
|
|
|
+ var jQIStr = ".LDivTItem_" + iIndex;
|
|
|
+ var jQIOStr = ".LDivTItem_" + iIndex + '_' + oIndex;
|
|
|
+ $(jQIStr).attr("data-selected", 0);
|
|
|
+ $(jQIOStr).attr("data-selected", 1);
|
|
|
+ jQIStr = ".SImg_" + iIndex;
|
|
|
+ //var dataUrlLen = $(jQIStr).attr("data-urllen");
|
|
|
+ var LeftPx = 0;
|
|
|
+ var MLValStr = $(jQIStr).attr("data-mlval");
|
|
|
+ LeftPx = 50 + oIndex * (85 + parseInt(MLValStr));
|
|
|
+ $(jQIStr).css("left", LeftPx + "px");
|
|
|
+}
|
|
|
+// 暂停播放处理
|
|
|
+var playMusicFunc = function (iIndex) {
|
|
|
+ if (LimitPreFlag) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ LimitPreFlag = true;
|
|
|
+ window.setTimeout(function () {
|
|
|
+ LimitPreFlag = false;
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ $(".select-answer").removeClass("select-answer");
|
|
|
+ var jQStr = ".LDFPlayS_" + iIndex;
|
|
|
+ var playStatus = $(jQStr).attr("data-playstatus"); // 检测当前状态,0表示暂停
|
|
|
+ var AudioUrl = $(jQStr).parent().prev(".LDivTop").find(".LDivTItem[data-selected='1']").attr("data-auduourl");
|
|
|
+ var AStatus = 0;
|
|
|
+ if (playStatus == "0") {
|
|
|
+ StopAllCss();
|
|
|
+ $(jQStr).attr("data-playstatus", 1);
|
|
|
+ AStatus = 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(jQStr).attr("data-playstatus", 0);
|
|
|
+ AStatus = 2;
|
|
|
+ }
|
|
|
+ var info = {
|
|
|
+ Id: iIndex, // 第几个
|
|
|
+ AudioUrl: AudioUrl, // 音频
|
|
|
+ AStatus: AStatus, // 播放状态:0表示重置,1表示播放,2表示暂停
|
|
|
+ }
|
|
|
+ playVisiableAudioCallBack(1, JSON.stringify(info));
|
|
|
+}
|
|
|
+// 重置播放处理
|
|
|
+var pauseMusicFunc = function (iIndex) {
|
|
|
+ $(".select-answer").removeClass("select-answer");
|
|
|
+ var jQStr = ".LDFPlayS_" + iIndex;
|
|
|
+ $(jQStr).attr("data-playstatus", 0);
|
|
|
+ var jQStr = ".LDFPWhite_" + iIndex;
|
|
|
+ var TTimeNum = parseInt($(jQStr).attr("data-alltime"));
|
|
|
+ var AudioUrl = $(jQStr).parent().prev(".LDivTop").find(".LDivTItem[data-selected='1']").attr("data-auduourl");
|
|
|
+ var info = {
|
|
|
+ Id: iIndex, // 第几个
|
|
|
+ AudioUrl: AudioUrl, // 音频
|
|
|
+ AStatus: 0, // 播放状态:0表示重置,1表示播放,2表示暂停
|
|
|
+ }
|
|
|
+ playVisiableAudioCallBack(1, JSON.stringify(info));
|
|
|
+}
|
|
|
+// 设置滑块的位置
|
|
|
+var playImageFunc = function (iIndex, leftVal, allTimes) {
|
|
|
+ var jQStr = ".LDFProcImg_" + iIndex;
|
|
|
+ var PWidthVal = $(jQStr).parent().css("width");
|
|
|
+ // 兼容单位
|
|
|
+ var PUint = "";
|
|
|
+ if (PWidthVal.indexOf("px") > -1) {
|
|
|
+ PUint = "px";
|
|
|
+ PWidthVal = PWidthVal.replace(PUint, "");
|
|
|
+ }
|
|
|
+ else if (PWidthVal.indexOf("pt") > -1) {
|
|
|
+ PUint = "pt";
|
|
|
+ PWidthVal = PWidthVal.replace(PUint, "");
|
|
|
+ }
|
|
|
+ else if (PWidthVal.indexOf("em") > -1) {
|
|
|
+ PUint = "em";
|
|
|
+ PWidthVal = PWidthVal.replace(PUint, "");
|
|
|
+ }
|
|
|
+ if (allTimes <= 0) {
|
|
|
+ $(jQStr).css("left", "-15px"); // 设置滑块滚动
|
|
|
+ jQStr = ".LDFPWhite_" + iIndex;
|
|
|
+ $(jQStr).css("width", "0px").attr("data-ctime", "0").attr("data-alltime", "0"); // 白色背景
|
|
|
+ jQStr = ".RunTime_" + iIndex;
|
|
|
+ $(jQStr).text(timeToStrFunc(0)); // 设置文字显示
|
|
|
+ jQStr = ".RunAllTime_" + iIndex;
|
|
|
+ $(jQStr).text(timeToStrFunc(0)); // 设置文字显示
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var LeftPx = (leftVal * parseFloat(PWidthVal)) / allTimes;
|
|
|
+ $(jQStr).css("left", (LeftPx - 15) + PUint); // 设置滑块滚动
|
|
|
+ jQStr = ".LDFPWhite_" + iIndex;
|
|
|
+ $(jQStr).css("width", LeftPx + PUint).attr("data-ctime", leftVal).attr("data-alltime", allTimes); // 白色背景
|
|
|
+ jQStr = ".RunTime_" + iIndex;
|
|
|
+ $(jQStr).text(timeToStrFunc((leftVal / 1000))); // 设置文字显示
|
|
|
+ jQStr = ".RunAllTime_" + iIndex;
|
|
|
+ $(jQStr).text(timeToStrFunc((allTimes / 1000))); // 设置文字显示
|
|
|
+ }
|
|
|
+};
|
|
|
+// 时间转换
|
|
|
+var timeToStrFunc = function (timerNumber) {
|
|
|
+ timerNumber = Math.floor(timerNumber);
|
|
|
+ var ReStr = "";
|
|
|
+ var TempData = 0;
|
|
|
+ if (isNaN(timerNumber) || timerNumber == "") {
|
|
|
+ return "00:00";
|
|
|
+ }
|
|
|
+ if (timerNumber >= 3600) {
|
|
|
+ TempData = Math.floor(timerNumber / 3600);
|
|
|
+ timerNumber -= TempData * 3600;
|
|
|
+ ReStr += (TempData < 10 ? ("0" + TempData) : TempData) + ":";
|
|
|
+ }
|
|
|
+ if (timerNumber >= 60) {
|
|
|
+ var TempData = Math.floor(timerNumber / 60);
|
|
|
+ timerNumber -= TempData * 60;
|
|
|
+ ReStr += (TempData < 10 ? ("0" + TempData) : TempData) + ":";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ReStr += "00:";
|
|
|
+ }
|
|
|
+ if (timerNumber < 10) {
|
|
|
+ ReStr += "0" + timerNumber;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ReStr += timerNumber;
|
|
|
+ }
|
|
|
+ return ReStr;
|
|
|
+};
|
|
|
+var TouchStartX = 0;
|
|
|
+var TouchMoveX = 0;
|
|
|
+var TouchIndex = -1; // 位置标识
|
|
|
+var TallTimeNum = 0; // 总时间
|
|
|
+var LeftTimeNum = 0; // 总时间
|
|
|
+var PWidthValNum = 0; // 总宽度
|
|
|
+// 滑块滑动控制(按下去)
|
|
|
+function TouchStartFunc(event) {
|
|
|
+ TouchStartX = event.touches[0].pageX;
|
|
|
+ TouchMoveX = TouchStartX;
|
|
|
+ TouchIndex = parseInt($(event.target).attr("class").replace("LDFProcImg LDFProcImg_", ""));
|
|
|
+ var jQStr = ".LDFPWhite_" + TouchIndex;
|
|
|
+ TallTimeNum = parseInt($(jQStr).attr("data-alltime"));
|
|
|
+ LeftTimeNum = parseInt($(".LDFPWhite_" + TouchIndex).attr("data-ctime"));
|
|
|
+ PWidthValNum = parseFloat($(jQStr).parent().css("width")); // 总宽度
|
|
|
+ if (TallTimeNum > 0) {
|
|
|
+ mobileTSFunc(TouchIndex);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 滑块滑动
|
|
|
+function TouchMoveFunc(event) {
|
|
|
+ TouchMoveX = event.touches[0].pageX;
|
|
|
+ TouchMoveY = event.touches[0].pageY;
|
|
|
+ var TLeftTimeNumber = Math.ceil(TallTimeNum * Math.abs(TouchMoveX - TouchStartX) / PWidthValNum);
|
|
|
+ if (TouchStartX > TouchMoveX) {
|
|
|
+ // 左移
|
|
|
+ if ((LeftTimeNum - TLeftTimeNumber) < 0) {
|
|
|
+ TLeftTimeNumber = 0;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TLeftTimeNumber = LeftTimeNum - TLeftTimeNumber;
|
|
|
+ }
|
|
|
+ playImageFunc(TouchIndex, TLeftTimeNumber, TallTimeNum);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 右移
|
|
|
+ if ((LeftTimeNum + TLeftTimeNumber) > TallTimeNum) {
|
|
|
+ TLeftTimeNumber = TallTimeNum;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TLeftTimeNumber = LeftTimeNum + TLeftTimeNumber;
|
|
|
+ }
|
|
|
+ playImageFunc(TouchIndex, TLeftTimeNumber, TallTimeNum);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 滑块滑动控制(抬起来)
|
|
|
+function TouchEndFunc(event) {
|
|
|
+ mobileTEFunc(TouchIndex);
|
|
|
+}
|
|
|
+
|
|
|
+//原文音频播放按钮点击事件
|
|
|
+function audioPlayClick(myobj) {
|
|
|
+ var curHtml = $(myobj).parent().find(".audioUrl").html();
|
|
|
+ var curAlt = $(myobj).attr("alt");
|
|
|
+ //处理当前按钮的状
|
|
|
+ if ($(myobj).attr("play-status") == "1") {
|
|
|
+ $(myobj).attr("play-status", "0");
|
|
|
+ $(myobj).attr("src", PicInfo.audioPauseImgUrl);//移动端要根据本地 喇叭 路径替换
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //停止其他作答音频播放
|
|
|
+ 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.audioPauseImgUrl);//移动端要根据本地 喇叭 路径替换
|
|
|
+ }
|
|
|
+ //设置播放状态
|
|
|
+ $(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));
|
|
|
+}
|
|
|
+
|
|
|
+//#endregion
|
|
|
+
|
|
|
+// #region 多选框处理
|
|
|
+// 多选点击(多选框是否可选)
|
|
|
+var ControlFlag = true;
|
|
|
+var clickCheckBox = function (inputId) {
|
|
|
+ if (!ControlFlag) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var BoxJqStr = ".cBoxCls_" + inputId;
|
|
|
+ if ($(BoxJqStr).attr("data-status") == "1") {
|
|
|
+ $(BoxJqStr).attr("data-status", "0");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(BoxJqStr).attr("data-status", "1");
|
|
|
+ }
|
|
|
+ $("#" + inputId).click();
|
|
|
+ // 变动同一个答题点的颜色修改
|
|
|
+ var JqStr = ".checkbox[answer-id='" + inputId + "']";
|
|
|
+ var parentAnID = $(JqStr).attr("parent-anid");
|
|
|
+ JqStr = ".checkbox[parent-anid='" + parentAnID + "']";
|
|
|
+ $(JqStr).addClass("select-answer");
|
|
|
+}
|
|
|
+// #endregion
|
|
|
+
|
|
|
+// #region 高亮处理
|
|
|
+var TFillData = [];
|
|
|
+/*高亮文本标注*/
|
|
|
+function Fill(data) {
|
|
|
+ // 清空原有高亮渲染
|
|
|
+ $.each($(".wordStyle,.phraseStyle,.sentenceStyle"), function (i, item) {
|
|
|
+ $(item).attr("data-setstatus", "0").attr("data-lstatus", "0").removeClass("wordStyle").removeClass("phraseStyle").removeClass("sentenceStyle");
|
|
|
+ $(".sentImagcs").remove();
|
|
|
+ });
|
|
|
+ // 重新渲染
|
|
|
+ $.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) {
|
|
|
+ // data-scolor显示的颜色等级卡控,data-setstatus高亮是否处于显示状态,data-lstatus:卡控是否能点击(1单词,2短语,3句型)
|
|
|
+ var FlagName = $('span[id=' + item.HightCode + ']').eq(0).attr("flag");
|
|
|
+ var ClsName = "";
|
|
|
+ var LClick = "0";
|
|
|
+ if (FlagName == "word") {
|
|
|
+ ClsName = "wordStyle";
|
|
|
+ LClick = "1";
|
|
|
+ }
|
|
|
+ else if (FlagName == "phrase") {
|
|
|
+ ClsName = "phraseStyle";
|
|
|
+ LClick = "2";
|
|
|
+ }
|
|
|
+ else if (FlagName == "sentence") {
|
|
|
+ ClsName = "sentenceStyle";
|
|
|
+ LClick = "3";
|
|
|
+ }
|
|
|
+ var hitCode = highlightItem.attr('hitCode');
|
|
|
+ var ThitCode = "";
|
|
|
+ if (hitCode) {
|
|
|
+ ThitCode = hitCode + "|" + item.SourceCode;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ThitCode = item.SourceCode;
|
|
|
+ }
|
|
|
+ $('span[id=' + item.HightCode + ']').eq(0).addClass(ClsName).attr("data-setstatus", "1").attr("data-lstatus", LClick).attr("hitCode", ThitCode);
|
|
|
+ if (ClsName == "sentenceStyle") {
|
|
|
+ $('span[id=' + item.HightCode + ']').eq(0).before('<img src="' + PicInfo.sentenceIcoUrl + '" class="sentImagcs" data-lstatus="3" data-setstatus="1">');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (typeof (item.SourceCode) == 'undefined' || item.SourceCode == null || item.SourceCode != "") {
|
|
|
+ var highlightItem = $('span[kcode*=' + item.SourceCode + ']:first');
|
|
|
+ if (highlightItem.length > 0) {
|
|
|
+ // data-scolor显示的颜色等级卡控,data-setstatus高亮是否处于显示状态,data-lstatus:卡控是否能点击(1单词,2短语,3句型)
|
|
|
+ var FlagName = $('span[id=' + item.HightCode + ']').eq(0).attr("flag");
|
|
|
+ var ClsName = "";
|
|
|
+ var LClick = "0";
|
|
|
+ if (FlagName == "word") {
|
|
|
+ ClsName = "wordStyle";
|
|
|
+ LClick = "1";
|
|
|
+ }
|
|
|
+ else if (FlagName == "phrase") {
|
|
|
+ ClsName = "phraseStyle";
|
|
|
+ LClick = "2";
|
|
|
+ }
|
|
|
+ else if (FlagName == "sentence") {
|
|
|
+ ClsName = "sentenceStyle";
|
|
|
+ LClick = "3";
|
|
|
+ }
|
|
|
+ var hitCode = highlightItem.attr('hitCode');
|
|
|
+ var ThitCode = "";
|
|
|
+ if (hitCode) {
|
|
|
+ ThitCode = hitCode + "|" + item.SourceCode;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ThitCode = item.SourceCode;
|
|
|
+ }
|
|
|
+ $('span[id=' + item.HightCode + ']').eq(0).addClass(ClsName).attr("data-setstatus", "1").attr("data-lstatus", LClick).attr("hitCode", ThitCode);
|
|
|
+ if (ClsName == "sentenceStyle") {
|
|
|
+ $('span[id=' + item.HightCode + ']').eq(0).before('<img src="' + PicInfo.sentenceIcoUrl + '" class="sentImagcs" data-lstatus="3" data-setstatus="1">');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 嵌套式答题点不作高亮显示(只做隐藏)
|
|
|
+function DealCssHiddenFunc() {
|
|
|
+ // 处理.wordStyle,.phraseStyle,.sentenceStyle全包含underlineContent情况
|
|
|
+ $.each($(".wordStyle,.phraseStyle,.sentenceStyle"), function (i, item) {
|
|
|
+ var displayCss = $(item).find(".underlineContent").css("display");
|
|
|
+ var showflag = $(item).find(".underlineContent").attr("showflag");
|
|
|
+ if (displayCss == "none" || showflag == "0") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ $(item).attr("data-lstatus", "0").attr("data-setstatus", "0"); // 不高亮也不可点击
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 处理underlineContent全包含.wordStyle,.phraseStyle,.sentenceStyle情况
|
|
|
+ $.each($(".underlineContent"), function (i, item) {
|
|
|
+ var displayCss = $(item).css("display");
|
|
|
+ var showflag = $(item).attr("showflag");
|
|
|
+ if (displayCss == "none" || showflag == "0") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ $(item).find(".wordStyle,.phraseStyle,.sentenceStyle").attr("data-lstatus", "0").attr("data-setstatus", "0"); // 不高亮也不可点击
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 嵌套式答题点高亮显示(重新渲染)
|
|
|
+function DealCssShowFunc() {
|
|
|
+ $.each($(".wordStyle"), function (i, item) {
|
|
|
+ if ($(item).find(".underlineContent").length == 1) {
|
|
|
+ var displayCss = $(item).find(".underlineContent").css("display");
|
|
|
+ var showflag = $(item).find(".underlineContent").attr("showflag");
|
|
|
+ if (displayCss != "none" && showflag == "1") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ $(item).attr("data-lstatus", "1").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(item).find(".underlineContent").length > 1) {
|
|
|
+ var AllShow = true;
|
|
|
+ $.each($(item).find(".underlineContent"), function (tIndex, tItem) {
|
|
|
+ var displayCss = $(tItem).css("display");
|
|
|
+ var showflag = $(tItem).attr("showflag");
|
|
|
+ if (displayCss == "none" || showflag == "0") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ AllShow = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (AllShow) {
|
|
|
+ $(item).attr("data-lstatus", "1").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("data-lstatus", "1").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $.each($(".phraseStyle"), function (i, item) {
|
|
|
+ if ($(item).find(".underlineContent").length == 1) {
|
|
|
+ var displayCss = $(item).find(".underlineContent").css("display");
|
|
|
+ var showflag = $(item).find(".underlineContent").attr("showflag");
|
|
|
+ if (displayCss != "none" && showflag == "1") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ $(item).attr("data-lstatus", "2").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(item).find(".underlineContent").length > 1) {
|
|
|
+ var AllShow = true;
|
|
|
+ $.each($(item).find(".underlineContent"), function (tIndex, tItem) {
|
|
|
+ var displayCss = $(tItem).css("display");
|
|
|
+ var showflag = $(tItem).attr("showflag");
|
|
|
+ if (displayCss == "none" || showflag == "0") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ AllShow = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (AllShow) {
|
|
|
+ $(item).attr("data-lstatus", "2").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("data-lstatus", "2").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $.each($(".sentenceStyle"), function (i, item) {
|
|
|
+ if ($(item).find(".underlineContent").length == 1) {
|
|
|
+ var displayCss = $(item).find(".underlineContent").css("display");
|
|
|
+ var showflag = $(item).find(".underlineContent").attr("showflag");
|
|
|
+ if (displayCss != "none" && showflag == "1") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ $(item).attr("data-lstatus", "3").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(item).find(".underlineContent").length > 1) {
|
|
|
+ var AllShow = true;
|
|
|
+ $.each($(item).find(".underlineContent"), function (tIndex, tItem) {
|
|
|
+ var displayCss = $(tItem).css("display");
|
|
|
+ var showflag = $(tItem).attr("showflag");
|
|
|
+ if (displayCss == "none" || showflag == "0") {
|
|
|
+ // 针对答题点进行做隐藏处理
|
|
|
+ AllShow = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (AllShow) {
|
|
|
+ $(item).attr("data-lstatus", "3").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("data-lstatus", "3").attr("data-setstatus", "1"); // 显示高亮和可点击
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// #endregion
|
|
|
+
|
|
|
+
|
|
|
+// 判断是否存在对象中
|
|
|
+function checkStrFunc(dataDtr) {
|
|
|
+ if (dataDtr == undefined || dataDtr == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (TFillData != null && TFillData.length > 0) {
|
|
|
+ var ReFlag = false;
|
|
|
+ TFillData.forEach(item=> {
|
|
|
+ if (item.HightCode == dataDtr) {
|
|
|
+ ReFlag = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return ReFlag;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 空字符串转换
|
|
|
+function ChangeSpaceStr(DataStr) {
|
|
|
+ if (DataStr == undefined || DataStr == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ var TDataStr = encodeURI(DataStr);
|
|
|
+ if (TDataStr.indexOf("%C2%A0") > -1) {
|
|
|
+ DataStr = encodeURI(DataStr);
|
|
|
+ var DataArr = DataStr.split("%C2%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", " ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return DataStr;
|
|
|
+}
|
|
|
+
|
|
|
+// 判断是否登记
|
|
|
+function ChangeCheckFlag(DataStr, AnswerStr) {
|
|
|
+ var ReStr = "";
|
|
|
+ if (AnswerStr == null || AnswerStr == "") {
|
|
|
+ return ReStr;
|
|
|
+ }
|
|
|
+ if (AnswerStr.indexOf(DataStr) > -1) {
|
|
|
+ // 直接等价
|
|
|
+ ReStr = AnswerStr.substring(0, (AnswerStr.indexOf(DataStr) + DataStr.length));
|
|
|
+ }
|
|
|
+ else if (DataStr.indexOf("'") > -1) {
|
|
|
+ // 模糊匹配
|
|
|
+ var DataArr = DataStr.split("'");
|
|
|
+ var pattWStr = "";
|
|
|
+ for (var i = 0; i < DataArr.length; i++) {
|
|
|
+ if (pattWStr != "") {
|
|
|
+ pattWStr += ".*" + DataArr[i];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ pattWStr += DataArr[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ReStr;
|
|
|
+}
|
|
|
+
|
|
|
+// 划分用户答案处理。待重构,将其划分写入(暂未处理)
|
|
|
+function SplitUserAnswer(AllAnswer, mytext) {
|
|
|
+ var ReArr = [];
|
|
|
+ if (AllAnswer == undefined || AllAnswer == null || AllAnswer.length == 0) {
|
|
|
+ return ReArr;
|
|
|
+ }
|
|
|
+ // 循环判断类型
|
|
|
+ for (var i = 0; i < AllAnswer.length; i++) {
|
|
|
+ // 先将答案进行切割
|
|
|
+ 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, "");
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+ 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>';
|
|
|
+ }
|
|
|
+ ReArr.push(ReStr);
|
|
|
+ }
|
|
|
+ else if (i != (AllAnswer.length - 1)) {
|
|
|
+ ReArr.push("");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ReArr.push(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ReArr;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+// 处理节点(使用data-scolor显示的颜色等级卡控,data-setstatus高亮是否处于显示状态,data-lstatus:卡控是否能点击(1单词,2短语,3句型))
|
|
|
+//页面加载完,课件 绑定事件(sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是)
|
|
|
+function bindEventYS(sWidthVal, isAStatus, isMAStatus) {
|
|
|
+ IsZTKEStatus = (isMAStatus == "undefined" || isMAStatus == undefined || isMAStatus == null) ? 0 : parseInt(isMAStatus);
|
|
|
+ // 处理文本
|
|
|
+ dealUnderLineFunc();
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ $(item).attr('answer-id', index).attr("showflag", "1").css("display", "block").attr("data-status", "1").attr("answer-isky", "0").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ // 关联渲染underlinecontent
|
|
|
+ if ($(item).next().length > 0) {
|
|
|
+ selectImgULContent($(item).next(), index);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ selectImgULContent($(item).parent(), index);
|
|
|
+ }
|
|
|
+ // 获取当前要是的标准答案
|
|
|
+ var AnswerText = "";
|
|
|
+ $.each($(".underlineContent[yaoshi-flag='" + index + "']"), function (tIndex, tItem) {
|
|
|
+ AnswerText += $(this).text();
|
|
|
+ // 补充嵌套,data-select表示选择状态0表示未选择,1表示已作答选择,2表示未做答选择
|
|
|
+ if ($(this).parent().children().length > 1) {
|
|
|
+ $(this).prop("outerHTML", '<span class="ULCBGUse" data-select="0" style="color: rgb(146, 208, 80);" onselectstart="return true">' + $(this).html() + '</span>');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(this).parent().addClass("ULCBGUse").attr("data-select", "0");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $(this).attr("answer-anstext", AnswerText);
|
|
|
+ });
|
|
|
+ //给音频绑定一个ID(未处理)
|
|
|
+ $.each($(".audioImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ $(item).attr('audio-id', index);
|
|
|
+ });
|
|
|
+ //给视频图标处理(未处理)
|
|
|
+ $.each($(".videoImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ });
|
|
|
+ //给口语图标处理(未处理)
|
|
|
+ $.each($(".oralLanguageImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ });
|
|
|
+ //处理口语试题
|
|
|
+ $.each($(".oralLanguage").nextUntil(".oralLanguageDone"), function (num, part) {
|
|
|
+ if ($(part).hasClass("yaoshi")) {
|
|
|
+ $(part).attr("answer-isky", "1");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //一题多空的答题点标注
|
|
|
+ var checkId = 0;
|
|
|
+ var headid = -1;
|
|
|
+ var groupId = -1;
|
|
|
+ $(".multipleStart").each(function (i, item) {
|
|
|
+ var $startNode = $(item);
|
|
|
+ var index = 0;
|
|
|
+ $.merge($(item).nextUntil(".multipleEnd").filter("[class*='group']"), $(item).nextUntil(".multipleEnd").find("[class*='group']")).each(function (index, item) {
|
|
|
+ checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
+ var gid = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
|
|
|
+ if (index == 0 || groupId != gid) {
|
|
|
+ groupId = gid;
|
|
|
+ headid = checkId;
|
|
|
+ }
|
|
|
+ $(item).find('.yaoshi').attr('parent-anid', headid);
|
|
|
+ $(item).find('.underlineContent').attr('parent-anid', headid);
|
|
|
+ // 打标志,含有boxQue的是多选题
|
|
|
+ if ($(item).hasClass('boxQue')) {
|
|
|
+ $(item).find('.yaoshi').attr('answer-isky', "2");
|
|
|
+ if ($(item).find(".underlineContent").length == 0) {
|
|
|
+ var AddHtmlStr = '<span class="ULCBGUse" data-select="0" style="color: rgb(146, 208, 80);" onselectstart="return true"><u class="underlineContent" yaoshi-flag="' + checkId + '" parent-anid="' + headid + '" data-errstatus="0" showflag="1" style="border-bottom: 1px solid rgb(151, 151, 151); text-decoration: none; white-space: pre-wrap;"> </u></span>';
|
|
|
+ $(item).find('.yaoshi').after(AddHtmlStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //处理表格宽度
|
|
|
+ AdjustTableFunc(sWidthVal, isAStatus);
|
|
|
+ // 音频处理
|
|
|
+ $.each($(".audioImg"), function (index, element) {
|
|
|
+ AddListenDiv(element, index, sWidthVal);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//页面加载完,原文 绑定事件(sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是)
|
|
|
+function bindEventTeaOrignalYS(sWidthVal, isAStatus, isMAStatus) {
|
|
|
+ IsZTKEStatus = (isMAStatus == "undefined" || isMAStatus == undefined || isMAStatus == null) ? 0 : parseInt(isMAStatus);
|
|
|
+ // 处理文本
|
|
|
+ dealUnderLineFunc();
|
|
|
+ //处理答题点
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ $(item).attr('answer-id', index).attr("showflag", "1").css("display", "block").attr("data-status", "1").attr("answer-isky", "0").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ // 关联渲染underlinecontent
|
|
|
+ if ($(item).next().length > 0) {
|
|
|
+ selectImgULContent($(item).next(), index);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ selectImgULContent($(item).parent(), index);
|
|
|
+ }
|
|
|
+ if (isAStatus != 1) {
|
|
|
+ // 学生隐藏答案
|
|
|
+ $(item).attr('answer-id', index).attr("showflag", "0").css("display", "none").attr("data-status", "0").attr("answer-isky", "0").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $(".underlineContent[yaoshi-flag='" + index + "']").not(".noKey").attr("showflag", "0"); // 隐藏答案(这种是连下划线删除的)
|
|
|
+ }
|
|
|
+ // 获取当前要是的标准答案
|
|
|
+ var AnswerText = "";
|
|
|
+ $.each($(".underlineContent[yaoshi-flag='" + index + "']"), function (tIndex, tItem) {
|
|
|
+ AnswerText += $(this).text();
|
|
|
+ // 补充嵌套
|
|
|
+ if ($(this).parent().children().length > 1) {
|
|
|
+ $(this).prop("outerHTML", '<span class="ULCBGUse" data-select="0" style="color: rgb(146, 208, 80);" onselectstart="return true">' + $(item).html() + '</span>');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(this).parent().addClass("ULCBGUse").attr("data-select", "0");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $(this).attr("answer-anstext", AnswerText);
|
|
|
+ });
|
|
|
+ //给音频绑定一个ID(未处理)
|
|
|
+ $.each($(".audioImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ $(item).attr('audio-id', index);
|
|
|
+ });
|
|
|
+ //给视频图标处理(未处理)
|
|
|
+ $.each($(".videoImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ });
|
|
|
+ //给口语图标处理(未处理)
|
|
|
+ $.each($(".oralLanguageImg"), function (index, item) {
|
|
|
+ $(item).attr("audiourl", "");
|
|
|
+ });
|
|
|
+ //一题多空的答题点标注
|
|
|
+ var checkId = 0;
|
|
|
+ var headid = -1;
|
|
|
+ var groupId = -1;
|
|
|
+ $(".multipleStart").each(function (i, item) {
|
|
|
+ var $startNode = $(item);
|
|
|
+ var index = 0;
|
|
|
+ $.merge($(item).nextUntil(".multipleEnd").filter("[class*='group']"), $(item).nextUntil(".multipleEnd").find("[class*='group']")).each(function (index, item) {
|
|
|
+ checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
+ var gid = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
|
|
|
+ if (index == 0 || groupId != gid) {
|
|
|
+ groupId = gid;
|
|
|
+ headid = checkId;
|
|
|
+ }
|
|
|
+ $(item).find('.yaoshi').attr('parent-anid', headid);
|
|
|
+ $(item).find('.underlineContent').attr('parent-anid', headid);
|
|
|
+ // 打标志,含有boxQue的是多选题
|
|
|
+ if ($(item).hasClass('boxQue')) {
|
|
|
+ $(item).find('.yaoshi').attr('answer-isky', "2");
|
|
|
+ if ($(item).find(".underlineContent").length == 0) {
|
|
|
+ var AddHtmlStr = '<span class="ULCBGUse" data-select="0" style="color: rgb(146, 208, 80);" onselectstart="return true"><u class="underlineContent" yaoshi-flag="' + checkId + '" parent-anid="' + headid + '" data-errstatus="0" showflag="1" style="border-bottom: 1px solid rgb(151, 151, 151); text-decoration: none; white-space: pre-wrap;"> </u></span>';
|
|
|
+ $(item).find('.yaoshi').after(AddHtmlStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //处理参考答案
|
|
|
+ $.each($(".underlineContent"), function (index, item) {
|
|
|
+ $(item).attr("answer-anstext", $(item).html());
|
|
|
+ });
|
|
|
+ //处理表格宽度
|
|
|
+ AdjustTableFunc(sWidthVal, isAStatus);
|
|
|
+ // 音频处理
|
|
|
+ $.each($(".audioImg"), function (index, element) {
|
|
|
+ AddListenDiv(element, index, sWidthVal);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 学生端 处理作答区域 answer-isky 是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
|
|
|
+var answerData = new Array();
|
|
|
+function handleAnswerRange() {
|
|
|
+ // 隐藏答案划线
|
|
|
+ //$(".underlineContentShow").attr("data-status", "0");
|
|
|
+ //规范文本格式
|
|
|
+ var answerId = "";
|
|
|
+ var tempJson = new Array();
|
|
|
+ //先处理一题多空的情况,获取两个之间的答题点
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ var AnswerID = $(item).attr("answer-id");
|
|
|
+ var AnswerPID = $(item).attr("parent-anid");
|
|
|
+ var AnswerIsky = $(item).attr("answer-isky");
|
|
|
+ // 获取答案
|
|
|
+ var TAnsText = "";
|
|
|
+ $.each($(".underlineContent[yaoshi-flag='" + AnswerID + "']"), function (index, tItem) {
|
|
|
+ TAnsText += " " + $(tItem).text();
|
|
|
+ });
|
|
|
+ // 添加答题点
|
|
|
+ if (AnswerIsky == 1) { }
|
|
|
+ else if (AnswerIsky == 2) {
|
|
|
+ $(item).after("<div class='cBoxCls cBoxCls_" + AnswerID + "' answer-id='" + AnswerID + "' parent-anid='" + AnswerPID + "' data-status='0' onclick='clickCheckBox(" + AnswerID + ")' answer-anstext='" + TAnsText + "'></div>");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // data-astatus控制作答样式(0表示未提交,1表示提交,2表示回显);data-errstatus判断是否作答
|
|
|
+ $(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 = (index).toString();
|
|
|
+ info.pId = info.Id;
|
|
|
+ info.AnsText = TAnsText;
|
|
|
+ answerData.push(info);
|
|
|
+ // 隐藏对应的钥匙和答案
|
|
|
+ $(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;
|
|
|
+}
|
|
|
+
|
|
|
+//提交,获取所有作答答案及参考答案(未处理)
|
|
|
+function getAllAnswer() {
|
|
|
+ // 从answer-body中获取答案
|
|
|
+ var TAnswerList = [];
|
|
|
+ ControlFlag = false;
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ var info = { "AStatus": 0, "AudioLength": 0, "AudioUrl": "", "Id": "0", "Score": -1.0, "Text": "", "Type": 1, "pId": "0", "playStartPoint": 0 };
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ var parentid = $(item).attr("parent-anid");
|
|
|
+ info.Id = answerid;
|
|
|
+ info.pId = parentid;
|
|
|
+ info.AStatus = ""; // 暂时没用到
|
|
|
+ info.Score = -1; // 作答得分,老师未评阅都是默认给-1分
|
|
|
+ info.Type = 1; //作答方式,1-文本作答,2-图片作答,3-音频作答,4-音频导入作答;目前只开放了1,3类型的作答方式
|
|
|
+ info.playStartPoint = ""; // 记录当前播放的时间点,下次继续播放时恢复到这个时间点
|
|
|
+ var answerisky = $(item).attr("answer-isky"); // 是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
|
|
|
+ info.AudioLength = 0; // 时长
|
|
|
+ var answerurl = $(".answer-body[answer-id='" + answerid + "']").attr("answer-url"); // 非口语题的输入
|
|
|
+ if (answerisky == 1 || (answerurl != undefined && answerurl != null && answerurl.length > 0)) {
|
|
|
+ info.AudioUrl = answerurl;
|
|
|
+ var AnswerText = $(".answer-body[answer-id='" + answerid + "']").find(".answer-text").text();
|
|
|
+ info.AudioLength = $(".answer-body[answer-id='" + answerid + "']").attr("answer-audiolength");
|
|
|
+ info.Text = AnswerText;
|
|
|
+ if (info.AudioUrl != undefined && info.AudioUrl != null && info.AudioUrl != "") {
|
|
|
+ info.Type = 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (answerisky == 2) {
|
|
|
+ var IsCheck = $(".cBoxCls[answer-id='" + answerid + "']").attr("data-status");
|
|
|
+ if (IsCheck == "0") {
|
|
|
+ info.Text = " ";
|
|
|
+ }
|
|
|
+ else if (IsCheck == "1") {
|
|
|
+ info.Text = "√";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var AnswerText = $(".answer-body[answer-id='" + answerid + "']").find(".answer-text").text();
|
|
|
+ info.Text = AnswerText;
|
|
|
+ }
|
|
|
+ TAnswerList.push(info);
|
|
|
+ });
|
|
|
+ return backupAllAnswer(JSON.stringify(TAnswerList), 1);
|
|
|
+}
|
|
|
+
|
|
|
+//回填所有答案,answerJson:所有作答及参考答案List,statusType:0-可作答,1-已提交,2-查看评阅
|
|
|
+function backupAllAnswer(answerJson, statusType) {
|
|
|
+ if (statusType == 0) {
|
|
|
+ ControlFlag = true; // 多选框可以作答
|
|
|
+ $(".answer-body").attr("data-astatus", statusType).attr("data-errstatus", "0"); // 实时记录作答状态
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerList = JSON.parse(answerJson);
|
|
|
+ $.each($(".answer-body"), function (num, item) {
|
|
|
+ var index = 0;
|
|
|
+ var isanswer = false;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ var parentid = $(item).attr("parent-anid");
|
|
|
+ //查找作答
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //一题多空的作答关联查找
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (parentid == answerList[i].pId) {
|
|
|
+ if (answerList[i].Text != "") {
|
|
|
+ isanswer = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ $(".yaoshi[answer-id='" + answerid + "']").attr("answer-score", answerList[index].Score); //作答评分
|
|
|
+ $(".yaoshi[answer-id='" + answerid + "']").attr("answer-text", mytext); // 作答内容
|
|
|
+ $(".yaoshi[answer-id='" + answerid + "']").attr("answer-comment", "");//评语
|
|
|
+ answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ //添加音频控制
|
|
|
+ var hasAudio = false;
|
|
|
+ var audioElement = $(item).children(".answer-audio-range").children("img").eq(0);
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ hasAudio = true;
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ $(item).children(".answer-audio-range").css("display", "inline-block");
|
|
|
+ $(item).children(".answer-audio-range").children("span").text("作答音频(" + answerList[index].AudioLength + "s)");
|
|
|
+ //填充作答内容
|
|
|
+ $(item).attr("answer-text", mytext);
|
|
|
+ if (mytext != "") {
|
|
|
+ mytext = "(" + mytext + ")";
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ }
|
|
|
+ //音频节点
|
|
|
+ $(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("play-status", "0");
|
|
|
+ $(item).attr("data-astatus", "3");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ if (mytext != "") {
|
|
|
+ $(item).attr("data-astatus", "3");
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("data-errstatus", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 保留已作答全部信息
|
|
|
+ $(item).attr("answer-score", answerList[index].Score);//作答评分
|
|
|
+ //$(item).attr("answer-anstext", answerList[index].AudioUrl);//参考答案
|
|
|
+ });
|
|
|
+ //打勾题的还原
|
|
|
+ $.each($(".cBoxCls"), function (num, item) {
|
|
|
+ //可作答状态,作答还原
|
|
|
+ var index = 0;
|
|
|
+ var isanswer = false;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ var parentid = $(item).attr("parent-anid");
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ mytext = (mytext == undefined || mytext == null) ? "" : mytext;
|
|
|
+ var ischecked = mytext.indexOf("√") > -1;
|
|
|
+ //还原打勾效果
|
|
|
+ if (ischecked) {
|
|
|
+ $(".cBoxCls_" + answerid).attr("data-status", "1");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".answer-body").remove(); // 删除原有答题点
|
|
|
+ $(".cBoxCls").remove(); // 删除原有答题点
|
|
|
+ $(".underlineContent").attr("data-errstatus", "0");
|
|
|
+ ControlFlag = false; // 多选框不可以作答
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerList = JSON.parse(answerJson);
|
|
|
+ $.each($(".yaoshi"), function (num, item) {
|
|
|
+ var index = 0; // 记录当前下标
|
|
|
+ var isanswer = false; // 判断是否作答
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ var parentid = $(item).attr("parent-anid");
|
|
|
+ // 保留已作答全部信息
|
|
|
+ //$(".answer-body[answer-id='" + answerid + "']").attr("answer-anstext", answerList[index].AudioUrl);//参考答案
|
|
|
+ //查找作答下标
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //一题多空的作答关联查找判断是否作答
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (parentid == answerList[i].pId && parentid != undefined && parentid != null && parentid != "") {
|
|
|
+ if (answerList[i].Text != undefined && answerList[i].Text != null && answerList[i].Text != "" && answerList[i].Text.length > 0) {
|
|
|
+ isanswer = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ $(item).attr("answer-score", answerList[index].Score); //作答评分
|
|
|
+ $(item).attr("answer-text", mytext); // 作答内容
|
|
|
+ $(item).attr("answer-comment", ""); // 作答内容
|
|
|
+ answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
|
|
|
+ //添加音频控制
|
|
|
+ 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>';
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(0).html(HtmlStr);
|
|
|
+ }
|
|
|
+ //填充作答内容
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").length == 1) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").css("display", "inline");
|
|
|
+ if (mytext == "" && !hasAudio) {
|
|
|
+ mytext = "未作答";
|
|
|
+ if (isanswer) {
|
|
|
+ mytext = " ";
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html(mytext);
|
|
|
+ }
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("data-errstatus", "1"); // 没有作答
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (mytext == "" && hasAudio) {
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var AllAnswer = []; // 记录所有标准答案
|
|
|
+ $.each($(".underlineContent[yaoshi-flag='" + answerid + "']").find("span"), 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);
|
|
|
+ });
|
|
|
+ mytext = ChangeSpaceStr(mytext);
|
|
|
+ var ReArr = SplitUserAnswer(AllAnswer, mytext);
|
|
|
+ if (ReArr != null && ReArr.length > 0) {
|
|
|
+ var NMyText = "";
|
|
|
+ for (var i = 0; i < ReArr.length; i++) {
|
|
|
+ NMyText += ReArr[i];
|
|
|
+ }
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").html(NMyText);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html(NMyText);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("data-errstatus", "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if ($(".underlineContent[yaoshi-flag='" + answerid + "']").length > 1) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").css("display", "inline");
|
|
|
+ if (mytext == "" && !hasAudio) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html("");
|
|
|
+ mytext = "未作答";
|
|
|
+ if (isanswer) {
|
|
|
+ mytext = " ";
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("data-errstatus", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (mytext == "" && hasAudio) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html("");
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(0).html(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ mytext = ChangeSpaceStr(mytext);
|
|
|
+ var ReArr = SplitUserAnswer(AllAnswer, mytext);
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").html("");
|
|
|
+ for (var i = 0; i < ReArr.length; i++) {
|
|
|
+ if ($(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").length > 0 && i == 0) {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").find(".answer-audio-range-child").eq(0).html(ReArr[0]);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(i).html(ReArr[i]);
|
|
|
+ }
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").eq(i).attr("data-errstatus", "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 进行重新渲染答题点的高亮
|
|
|
+ DealCssShowFunc();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+}
|
|
|
+
|
|
|
+//显示、隐藏钥匙及答案 isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function showHideAnswerEx(isShowYX, isShowAS) {
|
|
|
+ if (isShowYX) {
|
|
|
+ $(".yaoshi").attr("showflag", "1").css("display", "block");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".yaoshi").attr("showflag", "0").css("display", "none");
|
|
|
+ // 特殊处理:视听说学生端原文、传统教材都是没有钥匙的(直接隐藏掉)
|
|
|
+ $(".underlineContent").find("*[showflag='1']").attr("showflag", "0");
|
|
|
+ $(".cBoxCls").attr("data-status", "0");
|
|
|
+ }
|
|
|
+ if (isShowYX && isShowAS) {
|
|
|
+ $(".yaoshi").attr("data-status", "1");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ // 显示答案
|
|
|
+ $(".underlineContent").attr("showflag", "1");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if (isShowYX && !isShowAS) {
|
|
|
+ $(".yaoshi").attr("data-status", "0");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ // 隐藏答案
|
|
|
+ $(".underlineContent").attr("showflag", "0");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ DealCssShowFunc();
|
|
|
+ DealCssHiddenFunc();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+// 处理点击事件
|
|
|
+// 统一添加点击事件
|
|
|
+function AddClickEvent() {
|
|
|
+ // 释放
|
|
|
+ $(".answer-body").unbind("click");
|
|
|
+ // 点击答案切换答案
|
|
|
+ $(".underlineContent").unbind("click");
|
|
|
+ // 绑定显示或隐藏答案
|
|
|
+ $(".yaoshi").unbind("click");
|
|
|
+ // 绑定高亮
|
|
|
+ $(".wordStyle").unbind("click");
|
|
|
+ $(".phraseStyle").unbind("click");
|
|
|
+ $(".sentenceStyle").unbind("click");
|
|
|
+ // 绑定播放作答音频
|
|
|
+ $(".audioImg").unbind("click");
|
|
|
+ //点击播放事件,视频播放
|
|
|
+ $(".videoImg").unbind("click");
|
|
|
+ // 重新绑定
|
|
|
+ // 绑定答题点
|
|
|
+ $(".answer-body").on("click", function () {
|
|
|
+ var curObj = new Object();
|
|
|
+ curObj.Id = $(this).attr("answer-id");//答题点ID
|
|
|
+ curObj.pId = $(this).attr("parent-anid");//答题点ID
|
|
|
+ curObj.IsKY = $(this).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ curObj.Text = $(this).attr("answer-text");//用户作答内容
|
|
|
+ curObj.Score = $(this).attr("answer-score");//作答评分
|
|
|
+ curObj.AnsText = $(this).attr("answer-anstext");//参考答案
|
|
|
+ curObj.Comment = $(this).attr("answer-comment");//评语
|
|
|
+ // 选中样式渲染
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ if (curObj.pId == undefined || curObj.pId == null || curObj.pId == '' || curObj.pId == 'undefined') {
|
|
|
+ $(".answer-body[answer-id=" + curObj.Id + "]").addClass("select-answer");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".answer-body[parent-anid=" + curObj.pId + "]").addClass("select-answer");
|
|
|
+ }
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 点击答案切换答案
|
|
|
+ $(".underlineContent").on("click", function () {
|
|
|
+ var showFlag = $(this).attr("showflag");
|
|
|
+ if (showFlag != "1") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var answerID = $(this).attr("yaoshi-flag");
|
|
|
+ var parentID = $(".yaoshi[answer-id='" + answerID + "']").attr("parent-anid");
|
|
|
+ if (parentID == undefined || parentID == null || parentID == "undefined") {
|
|
|
+ parentID = '';
|
|
|
+ }
|
|
|
+ var answerIsky = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-isky");
|
|
|
+ var answerText = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-text");
|
|
|
+ var answerScore = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-score");
|
|
|
+ var answerAnstext = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-anstext");
|
|
|
+ var answerComment = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-comment");
|
|
|
+ var curObj = new Object();
|
|
|
+ curObj.Id = answerID;//答题点ID
|
|
|
+ curObj.pId = parentID;//答题点ID
|
|
|
+ curObj.IsKY = answerIsky;//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ curObj.Text = answerText;//用户作答内容
|
|
|
+ curObj.Score = answerScore;//作答评分
|
|
|
+ curObj.AnsText = answerAnstext;//参考答案
|
|
|
+ curObj.Comment = answerComment;//评语
|
|
|
+ // 选中样式渲染
|
|
|
+ var WType = "0";
|
|
|
+ if (answerText == "未做答" || answerText.length == 0) {
|
|
|
+ WType = "2";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ WType = "1";
|
|
|
+ }
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(".ULCBGUse").attr("data-select", "0");
|
|
|
+ if (curObj.pId == undefined || curObj.pId == null || curObj.pId == '' || curObj.pId == 'undefined') {
|
|
|
+ $(".underlineContent[yaoshi-flag=" + curObj.Id + "]").parent(".ULCBGUse").attr("data-select", WType);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".underlineContent[parent-anid=" + curObj.pId + "]").parent(".ULCBGUse").attr("data-select", WType);
|
|
|
+ }
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 绑定显示或隐藏答案
|
|
|
+ $(".yaoshi").on("click", function () {
|
|
|
+ var answerid = $(this).attr("answer-id");
|
|
|
+ var parentanid = $(this).attr("parent-anid");
|
|
|
+ var datastatus = $(this).attr("data-status");
|
|
|
+ if (datastatus == "0") {
|
|
|
+ // 隐藏->显示
|
|
|
+ $(this).attr("data-status", "1");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("showflag", "1");
|
|
|
+ // 处理多答题点
|
|
|
+ if (parentanid != undefined && parentanid != null && parentanid != '') {
|
|
|
+ $(".yaoshi[parent-anid='" + parentanid + "']").attr("data-status", "1");
|
|
|
+ $(".underlineContent[parent-anid='" + parentanid + "']").attr("showflag", "1");
|
|
|
+ }
|
|
|
+ DealCssShowFunc();
|
|
|
+ }
|
|
|
+ else if (datastatus == "1") {
|
|
|
+ // 显示->隐藏
|
|
|
+ $(this).attr("data-status", "0");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("showflag", "0");
|
|
|
+ // 处理多答题点
|
|
|
+ if (parentanid != undefined && parentanid != null && parentanid != '') {
|
|
|
+ $(".yaoshi[parent-anid='" + parentanid + "']").attr("data-status", "0");
|
|
|
+ $(".underlineContent[parent-anid='" + parentanid + "']").attr("showflag", "0");
|
|
|
+ }
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 绑定高亮
|
|
|
+ $(".wordStyle").on("click", function () {
|
|
|
+ var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ if (datalstatus != "1") {
|
|
|
+ return; // 不能点击
|
|
|
+ }
|
|
|
+ //var ThitCode = $(this).attr("hitCode");
|
|
|
+ hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ });
|
|
|
+ $(".phraseStyle").on("click", function () {
|
|
|
+ var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ if (datalstatus != "2") {
|
|
|
+ return; // 不能点击
|
|
|
+ }
|
|
|
+ //var ThitCode = $(this).attr("hitCode");
|
|
|
+ hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ });
|
|
|
+ $(".sentenceStyle").on("click", function () {
|
|
|
+ var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ if (datalstatus != "3") {
|
|
|
+ return; // 不能点击
|
|
|
+ }
|
|
|
+ //var ThitCode = $(this).attr("hitCode");
|
|
|
+ hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ });
|
|
|
+ // 绑定播放作答音频
|
|
|
+ $(".audioImg").on("click", function () {
|
|
|
+ audioPlayClick(this);
|
|
|
+ });
|
|
|
+ //点击播放事件,视频播放
|
|
|
+ $(".videoImg").on("click", function () {
|
|
|
+ $(".select-answer").removeClass("select-answer");
|
|
|
+ $(this).attr("audiourl", "");
|
|
|
+ var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
+ var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
+ playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
+ });
|
|
|
+ //// 绑定答题点
|
|
|
+ //$(".answer-body").unbind("click").on("click", function () {
|
|
|
+ // var curObj = new Object();
|
|
|
+ // curObj.Id = $(this).attr("answer-id");//答题点ID
|
|
|
+ // curObj.pId = $(this).attr("parent-anid");//答题点ID
|
|
|
+ // curObj.IsKY = $(this).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ // curObj.Text = $(this).attr("answer-text");//用户作答内容
|
|
|
+ // curObj.Score = $(this).attr("answer-score");//作答评分
|
|
|
+ // curObj.AnsText = $(this).attr("answer-anstext");//参考答案
|
|
|
+ // curObj.Comment = $(this).attr("answer-comment");//评语
|
|
|
+ // // 选中样式渲染
|
|
|
+ // $(".checkbox").removeClass("select-answer");
|
|
|
+ // $(".answer-body").removeClass("select-answer");
|
|
|
+ // if (curObj.pId == undefined || curObj.pId == null || curObj.pId == '' || curObj.pId == 'undefined') {
|
|
|
+ // $(".answer-body[answer-id=" + curObj.Id + "]").addClass("select-answer");
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // $(".answer-body[parent-anid=" + curObj.pId + "]").addClass("select-answer");
|
|
|
+ // }
|
|
|
+ // //已作答,弹出作答答案
|
|
|
+ // if ($(this).data("ans-status") == "1") {
|
|
|
+ // //移动端添加外部处理
|
|
|
+ // onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // //移动端添加外部处理,弹出作答操作
|
|
|
+ // onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ // }
|
|
|
+ //});
|
|
|
+ //// 点击答案切换答案
|
|
|
+ //$(".underlineContent").unbind("click").on("click", function () {
|
|
|
+ // var showFlag = $(this).attr("showflag");
|
|
|
+ // if (showFlag != "1") {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // var answerID = $(this).attr("yaoshi-flag");
|
|
|
+ // var parentID = $(".yaoshi[answer-id='" + answerID + "']").attr("parent-anid");
|
|
|
+ // if (parentID == undefined || parentID == null || parentID == "undefined") {
|
|
|
+ // parentID = '';
|
|
|
+ // }
|
|
|
+ // var answerIsky = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-isky");
|
|
|
+ // var answerText = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-text");
|
|
|
+ // var answerScore = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-score");
|
|
|
+ // var answerAnstext = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-anstext");
|
|
|
+ // var answerComment = $(".yaoshi[answer-id='" + answerID + "']").attr("answer-comment");
|
|
|
+ // var curObj = new Object();
|
|
|
+ // curObj.Id = answerID;//答题点ID
|
|
|
+ // curObj.pId = parentID;//答题点ID
|
|
|
+ // curObj.IsKY = answerIsky;//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+ // curObj.Text = answerText;//用户作答内容
|
|
|
+ // curObj.Score = answerScore;//作答评分
|
|
|
+ // curObj.AnsText = answerAnstext;//参考答案
|
|
|
+ // curObj.Comment = answerComment;//评语
|
|
|
+ // // 选中样式渲染
|
|
|
+ // var WType = "0";
|
|
|
+ // if (answerText == "未做答" || answerText.length==0){
|
|
|
+ // WType = "2";
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // WType = "1";
|
|
|
+ // }
|
|
|
+ // $(".checkbox").removeClass("select-answer");
|
|
|
+ // $(".answer-body").removeClass("select-answer");
|
|
|
+ // $(".ULCBGUse").attr("data-select", "0");
|
|
|
+ // if (curObj.pId == undefined || curObj.pId == null || curObj.pId == '' || curObj.pId == 'undefined') {
|
|
|
+ // $(".underlineContent[yaoshi-flag=" + curObj.Id + "]").parent(".ULCBGUse").attr("data-select", WType);
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // $(".underlineContent[parent-anid=" + curObj.pId + "]").parent(".ULCBGUse").attr("data-select", WType);
|
|
|
+ // }
|
|
|
+ // //已作答,弹出作答答案
|
|
|
+ // if ($(this).data("ans-status") == "1") {
|
|
|
+ // //移动端添加外部处理
|
|
|
+ // onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // //移动端添加外部处理,弹出作答操作
|
|
|
+ // onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ // }
|
|
|
+ //});
|
|
|
+ //// 绑定显示或隐藏答案
|
|
|
+ //$(".yaoshi").unbind("click").on("click", function () {
|
|
|
+ // var answerid = $(this).attr("answer-id");
|
|
|
+ // var datastatus = $(this).attr("data-status");
|
|
|
+ // if (datastatus == "0") {
|
|
|
+ // // 隐藏->显示
|
|
|
+ // $(this).attr("data-status", "1");
|
|
|
+ // $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ // $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("showflag", "1");
|
|
|
+ // DealCssShowFunc();
|
|
|
+ // }
|
|
|
+ // else if (datastatus == "1") {
|
|
|
+ // // 显示->隐藏
|
|
|
+ // $(this).attr("data-status", "0");
|
|
|
+ // $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ // $(".underlineContent[yaoshi-flag='" + answerid + "']").attr("showflag", "0");
|
|
|
+ // DealCssHiddenFunc();
|
|
|
+ // }
|
|
|
+ //});
|
|
|
+ //// 绑定高亮
|
|
|
+ //$(".wordStyle").unbind("click").on("click", function () {
|
|
|
+ // var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ // if (datalstatus != "1") {
|
|
|
+ // return; // 不能点击
|
|
|
+ // }
|
|
|
+ // //var ThitCode = $(this).attr("hitCode");
|
|
|
+ // hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ //});
|
|
|
+ //$(".phraseStyle").unbind("click").on("click", function () {
|
|
|
+ // var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ // if (datalstatus != "2") {
|
|
|
+ // return; // 不能点击
|
|
|
+ // }
|
|
|
+ // //var ThitCode = $(this).attr("hitCode");
|
|
|
+ // hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ //});
|
|
|
+ //$(".sentenceStyle").unbind("click").on("click", function () {
|
|
|
+ // var datalstatus = $(this).attr("data-lstatus");
|
|
|
+ // if (datalstatus != "3") {
|
|
|
+ // return; // 不能点击
|
|
|
+ // }
|
|
|
+ // //var ThitCode = $(this).attr("hitCode");
|
|
|
+ // hitCodeFunc($(this).attr("hitCode"));
|
|
|
+ //});
|
|
|
+ //// 绑定播放作答音频
|
|
|
+ //$(".audioImg").unbind("click").on("click", function () {
|
|
|
+ // audioPlayClick(this);
|
|
|
+ //});
|
|
|
+ ////点击播放事件,视频播放
|
|
|
+ //$(".videoImg").unbind("click").on("click", function () {
|
|
|
+ // $(".select-answer").removeClass("select-answer");
|
|
|
+ // $(this).attr("audiourl", "");
|
|
|
+ // var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
+ // var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
+ // playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
+ //});
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+// 移动端统一调用:学生端视听说主体课文
|
|
|
+// 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:200px;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);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TFillData = data;
|
|
|
+ }
|
|
|
+ var ReData = handleAnswerRange();
|
|
|
+ if (typeof (Fill) == "function") {
|
|
|
+ Fill(TFillData);
|
|
|
+ }
|
|
|
+ // 最终样式渲染
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+ return ReData;
|
|
|
+}
|
|
|
+
|
|
|
+// 移动端统一调用:教师端视听说主体课文
|
|
|
+// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
+// data高亮知识点
|
|
|
+// isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function teaEntryFunc(sWidthVal, isAStatus, isMAStatus, data, isShowYX, isShowAS) {
|
|
|
+ bindEventYS(sWidthVal, isAStatus, isMAStatus);
|
|
|
+ if (cTTypeFunc == 2) {
|
|
|
+ TFillData = JSON.parse(data);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TFillData = data;
|
|
|
+ }
|
|
|
+ if (typeof (Fill) == "function") {
|
|
|
+ Fill(TFillData);
|
|
|
+ }
|
|
|
+ // 最终样式渲染
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+ showHideAnswerEx(isShowYX, isShowAS);
|
|
|
+}
|
|
|
+
|
|
|
+// 移动端统一调用:教师/学生端视听说原文
|
|
|
+// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
+// isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function aYWFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS) {
|
|
|
+ bindEventTeaOrignalYS(sWidthVal, isAStatus, isMAStatus);
|
|
|
+ // 最终样式渲染
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+ showHideAnswerEx(isShowYX, isShowAS);
|
|
|
+}
|
|
|
+
|
|
|
+// 移动端统一调用:学生端传统教材
|
|
|
+// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
+// isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function stuCTJCFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS) {
|
|
|
+ aCTJCFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS);
|
|
|
+}
|
|
|
+// 移动端统一调用:教师端传统教材
|
|
|
+// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
+// isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function teaCTJCFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS) {
|
|
|
+ aCTJCFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS);
|
|
|
+}
|
|
|
+// 移动端统一调用:教师/学生端传统教材
|
|
|
+// sWidthVal:屏幕宽度,isAStatus是否含有作答0表示没有,isMAStatus判断是否是主体课文1表示是
|
|
|
+// isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+// data高亮知识点
|
|
|
+var Iindex = 0;
|
|
|
+function aCTJCFunc(sWidthVal, isAStatus, isMAStatus, isShowYX, isShowAS, data) {
|
|
|
+ bindEventYS(sWidthVal, isAStatus, isMAStatus);
|
|
|
+ if (cTTypeFunc == 2) {
|
|
|
+ TFillData = JSON.parse(data);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TFillData = data;
|
|
|
+ }
|
|
|
+ //if (data == null || data == "") {
|
|
|
+ // addFillAssist();
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ if (typeof (Fill) == "function") {
|
|
|
+ Fill(TFillData);
|
|
|
+ }
|
|
|
+ // 最终样式渲染
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+ showHideAnswerEx(isShowYX, isShowAS);
|
|
|
+}
|
|
|
+
|
|
|
+// 高亮调用统一接口
|
|
|
+function FillFunc(data) {
|
|
|
+ if (cTTypeFunc == 2) {
|
|
|
+ TFillData = JSON.parse(data);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ TFillData = data;
|
|
|
+ }
|
|
|
+ Fill(TFillData);
|
|
|
+ // 最终样式渲染
|
|
|
+ DealCssShowFunc();
|
|
|
+ DealCssHiddenFunc();
|
|
|
+ // 点击事件补充
|
|
|
+ AddClickEvent();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+// 移动端使用,true:表示点击表格且正在移动,需阻止模块切换
|
|
|
+function getPressFlag() {
|
|
|
+ return pressTableFlag;
|
|
|
+}
|
|
|
+
|
|
|
+// 音频进度条松开回调
|
|
|
+function mobileTEFunc(ID) {
|
|
|
+ pressTableFlag = false;
|
|
|
+ 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); // 安卓
|
|
|
+}
|
|
|
+
|
|
|
+// 音频进度条按下回调
|
|
|
+function mobileTSFunc(ID) {
|
|
|
+ pressTableFlag = true;
|
|
|
+ // 移动端回调处理
|
|
|
+ plugin.onSeekBarDown(ID); // 安卓
|
|
|
+}
|
|
|
+
|
|
|
+// 控制字体大小
|
|
|
+function adjustFontSize(FontSize) {
|
|
|
+ if (FontSize == null || FontSize < 80) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $(".LDFTimerS").attr("data-fsFlag", FontSize);
|
|
|
+ $(".TableContainer").attr("data-fsFlag", FontSize);
|
|
|
+}
|
|
|
+
|
|
|
+function playVisiableAudioCallBack(type, url) {
|
|
|
+ //console.log(url);
|
|
|
+ cancelBubble();
|
|
|
+ plugin.startPlay(type, url);
|
|
|
+}
|
|
|
+
|
|
|
+// 答题点选择调移动端接口
|
|
|
+function onClickAnswerPoint(data) {
|
|
|
+ //alert(JSON.stringify(data));
|
|
|
+ console.log(JSON.stringify(data));
|
|
|
+ //cancelBubble();
|
|
|
+ plugin.onClickAnswerPoint(data);
|
|
|
+}
|
|
|
+
|
|
|
+function onClickKeyHide() {
|
|
|
+ //alert(JSON.stringify(data));
|
|
|
+ cancelBubble();
|
|
|
+ plugin.onClickKeyHide();
|
|
|
+}
|
|
|
+
|
|
|
+function onClickKeyShow() {
|
|
|
+ //alert(JSON.stringify(data));
|
|
|
+ cancelBubble();
|
|
|
+ plugin.onClickKeyShow();
|
|
|
+}
|
|
|
+
|
|
|
+function cancelBubble(e) {
|
|
|
+ var evt = e ? e : window.event;
|
|
|
+ if (evt.stopPropagation) { //W3C
|
|
|
+ evt.stopPropagation();
|
|
|
+ } else { //IE
|
|
|
+ evt.cancelBubble = true;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getSelectedText(title) {
|
|
|
+ var txt;
|
|
|
+ if (window.getSelection) {
|
|
|
+ txt = window.getSelection().toString();
|
|
|
+ } else if (window.document.getSelection) {
|
|
|
+ txt = window.document.getSelection().toString();
|
|
|
+ } else if (window.document.selection) {
|
|
|
+ txt = window.document.selection.createRange().text;
|
|
|
+ }
|
|
|
+ JSInterface.callback(txt, title);
|
|
|
+}
|
|
|
+// 控制播放按钮样式,OCStatus(0表示停止,1表示播放)
|
|
|
+
|
|
|
+function playCssControl(iIndex, OCStatus) {
|
|
|
+ var jQStr = ".LDFPlayS_" + iIndex;
|
|
|
+ if (OCStatus == "0") {
|
|
|
+ $(jQStr).attr("data-playstatus", 0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(jQStr).attr("data-playstatus", 1);
|
|
|
+ }
|
|
|
+}
|
|
|
+// 控制滑块接口(Id第几个音频,leftVal进度条实时时间(毫秒),allTimes表示总时间(毫秒))
|
|
|
+
|
|
|
+function showImageFunc(Id, leftVal, allTimes) {
|
|
|
+ playImageFunc(Id, leftVal, allTimes);
|
|
|
+}
|
|
|
+
|
|
|
+// 暂停所有的样式
|
|
|
+function StopAllCss() {
|
|
|
+ $.each($(".LDFPlayS"), function (index, item) {
|
|
|
+ $(this).attr("data-playstatus", "0");
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+//处理播放录音,answerid:答题点ID,isPlay:是否播放(0-暂停,1-播放)
|
|
|
+function playRecordAudio(answerid, isPlay) {
|
|
|
+ //获取其他正在播放的音频
|
|
|
+ var playing = $(".answer-body[answer-id='" + answerid + "']").children(".answer-audio-range");
|
|
|
+ if (playing.length > 0) {
|
|
|
+ if (isPlay == "1") {
|
|
|
+ $(playing).attr("play-status", "1");
|
|
|
+ $(playing).find("img").attr("src", PicInfo.recordPauseImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(playing).attr("play-status", "0");
|
|
|
+ $(playing).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//滚动到相应DIV
|
|
|
+function scrollAnswer(answerid) {
|
|
|
+ //console.log(answerid);
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ var ansDom = $(".answer-body[parent-anid='" + answerid + "']");
|
|
|
+ if (ansDom.length == 0) {
|
|
|
+ ansDom = $(".checkbox[parent-anid='" + answerid + "']");
|
|
|
+ }
|
|
|
+ $(ansDom).addClass("select-answer");
|
|
|
+ var scroll_offset = $(ansDom).offset(); //得到box这个div层的offset,包含两个值,top和left
|
|
|
+ var offset_top = scroll_offset.top;
|
|
|
+ if (offset_top > 150) {
|
|
|
+ offset_top = offset_top - 200;
|
|
|
+ }
|
|
|
+ $("body,html").animate({
|
|
|
+ scrollTop: offset_top //让body的scrollTop等于pos的top,就实现了滚动
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//暂停播放原文音频
|
|
|
+function pauseTextAudio(audioid) {
|
|
|
+ //获取其他正在播放的音频
|
|
|
+ var playing = $(".audioImg[audio-id='" + audioid + "']");
|
|
|
+ if (playing.length > 0) {
|
|
|
+ $(playing).attr("play-status", "0");
|
|
|
+ $(playing).attr("src", PicInfo.audioPauseImgUrl);//移动端要根据本地 喇叭 路径替换
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 点击高亮调移动端
|
|
|
+function hitCodeFunc(code) {
|
|
|
+ //alert(code);
|
|
|
+ //cancelBubble();
|
|
|
+ plugin.call(code);
|
|
|
+}
|
|
|
+
|
|
|
+// 设置离焦事件
|
|
|
+function resetPressFlag() {
|
|
|
+ pressTableFlag = false;
|
|
|
+}
|