|
|
@@ -1,937 +1,939 @@
|
|
|
-//播放音频图片地址
|
|
|
-var PicInfo1 = {
|
|
|
- answerPointImgUrl: "file:///android_asset/js/update-answer.png",
|
|
|
- yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
|
|
|
- yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
|
|
|
- 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"
|
|
|
-}
|
|
|
-
|
|
|
-//本地调用用的资源
|
|
|
-var PicInfo = {
|
|
|
- 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"
|
|
|
-}
|
|
|
-
|
|
|
-//显示、隐藏答案
|
|
|
-function showHideAnswer(flag) {
|
|
|
- if (flag) {
|
|
|
- //$(".underlineContent").show();
|
|
|
- $(".underlineContent").css("color", "#92D050");
|
|
|
- $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- }
|
|
|
- else {
|
|
|
- //$(".underlineContent").hide();
|
|
|
- $(".underlineContent").css("color", "#ffffff");
|
|
|
- $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-///显示、隐藏钥匙及答案 isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
-function showHideAnswerEx(isShowYX, isShowAS) {
|
|
|
- if (isShowYX) {
|
|
|
- $(".yaoshi").show();
|
|
|
- }
|
|
|
- else {
|
|
|
- $(".yaoshi").hide();
|
|
|
- }
|
|
|
-
|
|
|
- if (isShowAS) {
|
|
|
- $.each($(".underlineContent"), function (index, item) {
|
|
|
- //$(item).html($(item).attr("data-text"));
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
-
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
- $(".yaoshi").attr("data-status", "1");
|
|
|
- $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- }
|
|
|
- else {
|
|
|
- $.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
- $(".yaoshi").attr("data-status", "0");
|
|
|
- $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//页面加载完,原文 绑定事件
|
|
|
-function bindEventTeaOrignalYS() {
|
|
|
- var bodyWidth = $(document.body).width();
|
|
|
- //显示/隐藏习题答案
|
|
|
- $(".yaoshi").on("click", function () {
|
|
|
- var curDisplay = $(this).nextUntil(".yaoshi").find(".underlineContent").eq(0).css("display");
|
|
|
- if (curDisplay == "undefined" || curDisplay == undefined) return;
|
|
|
-
|
|
|
- if (curDisplay == "none" || $(this).attr("data-status") == "0") {
|
|
|
- $(this).attr("data-status", "1");
|
|
|
- $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").show();
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#92D050");
|
|
|
- $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
-
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
- //不再存在已隐藏的钥匙,移动端回调
|
|
|
- if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
- //添加回调
|
|
|
- console.log("全部显示了");
|
|
|
- }
|
|
|
- } else {
|
|
|
- $(this).attr("data-status", "0");
|
|
|
- $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").hide();
|
|
|
- //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#ffffff");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
- //添加回调
|
|
|
- onClickKeyHide();
|
|
|
- }
|
|
|
- });
|
|
|
- //处理答题点
|
|
|
- $.each($(".underlineContent"), function (index, item) {
|
|
|
- $(item).attr("data-text", $(item).html());
|
|
|
- });
|
|
|
- //给音频绑定一个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", "");
|
|
|
- });
|
|
|
- //去除多余的U空标签
|
|
|
- $.each($("u"), function (index, item) {
|
|
|
- var text = $(item).text();
|
|
|
- text = text.replace(/\s+/g, "");
|
|
|
- if (text == "") {
|
|
|
- $(item).remove();
|
|
|
- }
|
|
|
- });
|
|
|
- //处理暂无参考答案
|
|
|
- $.each($(".yaoshi"), function (index, item) {
|
|
|
- var prev = $(item).nextUntil(".yaoshi").find(".underlineContent");
|
|
|
- if (prev.length == 0) {
|
|
|
- var spanHtml = document.createElement("span");
|
|
|
- //添加子节点
|
|
|
- var uHtml = document.createElement("u");
|
|
|
- uHtml.className = "underlineContent no-answer";
|
|
|
- uHtml.innerText = "暂无参考答案";
|
|
|
- uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
- $(spanHtml).html(uHtml.outerHTML);
|
|
|
- $(item).after(spanHtml);
|
|
|
- }
|
|
|
- });
|
|
|
- //处理表格宽度
|
|
|
- $.each($(".wordTable"), function (index, item) {
|
|
|
- $(item).css("width", bodyWidth + "px");
|
|
|
- });
|
|
|
-
|
|
|
- //点击喇叭事件,音频播放
|
|
|
- $(".audioImg").on("click", function () {
|
|
|
- audioPlayClick(this);
|
|
|
- });
|
|
|
- //点击播放事件,视频播放
|
|
|
- $(".videoImg").on("click", function () {
|
|
|
- var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
- var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
- playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
- });
|
|
|
- //处理表格样式
|
|
|
- $("td").attr("style", "");
|
|
|
-}
|
|
|
-
|
|
|
-//页面加载完,课件 绑定事件
|
|
|
-function bindEventYS() {
|
|
|
- var bodyWidth = $(document.body).width();
|
|
|
- //不存在underline 属性下有内容,所以全部隐藏,若有就是源头数据有问题
|
|
|
- $('.underline').css("display", "none");
|
|
|
- //给每个答题点加上ID
|
|
|
- $.each($(".yaoshi"), function (index, item) {
|
|
|
- $(item).attr('answer-id', index);
|
|
|
- });
|
|
|
- //给音频绑定一个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", "");
|
|
|
- });
|
|
|
- //去除多余的U空标签
|
|
|
- $.each($("u"), function (index, item) {
|
|
|
- var text = $(item).text();
|
|
|
- text = text.replace(/\s+/g, "");
|
|
|
- if (text == "") {
|
|
|
- $(item).remove();
|
|
|
- }
|
|
|
- });
|
|
|
- //处理暂无参考答案
|
|
|
- $.each($(".yaoshi"), function (index, item) {
|
|
|
- var parent = $(item).parent();
|
|
|
- var prev = $(item).nextAll(".underlineContent");
|
|
|
- if (prev.length == 0) {
|
|
|
- var uHtml = document.createElement("u");
|
|
|
- uHtml.className = "underlineContent no-answer";
|
|
|
- uHtml.innerText = "暂无参考答案";
|
|
|
- if ($(parent)[0].tagName == 'P') {
|
|
|
- if ($(parent).hasClass('correntQue') || $(parent).hasClass('boxQue')) {
|
|
|
- uHtml.innerHTML = " ";
|
|
|
- }
|
|
|
- }
|
|
|
- uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
- $(item).after(uHtml);
|
|
|
- }
|
|
|
- });
|
|
|
- //处理表格宽度
|
|
|
- $.each($(".wordTable"), function (index, item) {
|
|
|
- $(item).css("width", bodyWidth + "px");
|
|
|
- });
|
|
|
- //获取两个之间的答题点
|
|
|
- var index = 1;
|
|
|
- var checkId = 0;
|
|
|
- $.each($(".multipleStart").nextUntil(".multipleEnd").filter("[class*='group']"), function (index, item) {
|
|
|
- checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
- var index = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
|
|
|
- var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
|
|
|
- if ($(item).hasClass('boxQue')) {
|
|
|
- $(item).find('.yaoshi').after("<div class='checkbox'><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
|
|
|
- $(item).find('input').prop('checked', ischecked);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //显示/隐藏习题答案
|
|
|
- $(".yaoshi").on("click", function () {
|
|
|
- // 隐藏答案
|
|
|
- var NClsName = $(this).parent().attr("class") + " correntQue";
|
|
|
- var PClsName = $(this).parent().attr("class"); // 对错题有内容填写必然有correntQue,否则判断条件不成立
|
|
|
- if (PClsName.indexOf(" correntQue") > -1) {
|
|
|
- PClsName = PClsName.replace(" correntQue", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- PClsName = "";
|
|
|
- }
|
|
|
- var NextClsName = $(this).parent().next().attr("class");
|
|
|
- var PreClsName = $(this).parent().prev().attr("class");
|
|
|
- if ($(this).attr("data-status") == "0") {
|
|
|
- if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().next().find(".yaoshi").attr("data-status", "1");
|
|
|
- $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
- }
|
|
|
- if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("data-status", "1");
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- $(this).parent().prev().find(".underlineContent").css("color", "#989898");
|
|
|
- }
|
|
|
- $(this).attr("data-status", "1");
|
|
|
- $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
-
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
- //不再存在已隐藏的钥匙,移动端回调
|
|
|
- if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
- //添加回调
|
|
|
- console.log("全部显示了");
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().next().find(".yaoshi").attr("data-status", "0");
|
|
|
- $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
- }
|
|
|
- if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("data-status", "0");
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- $(this).parent().prev().find(".underlineContent").css("color", "#ffffff").css("background-color", "#ffffff");
|
|
|
- }
|
|
|
- $(this).attr("data-status", "0");
|
|
|
- $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
- //添加回调
|
|
|
- onClickKeyHide();
|
|
|
- }
|
|
|
- });
|
|
|
- //点击喇叭事件,音频播放
|
|
|
- $(".audioImg").on("click", function () {
|
|
|
- audioPlayClick(this);
|
|
|
- });
|
|
|
- //点击播放事件,视频播放
|
|
|
- $(".videoImg").on("click", function () {
|
|
|
- $(this).attr("audiourl", "");
|
|
|
- var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
- var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
- playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
- });
|
|
|
- //处理表格样式
|
|
|
- $("td").attr("style", "");
|
|
|
-}
|
|
|
-
|
|
|
-// 过滤规则
var FRules = function(DataStr) {
|
|
|
- return DataStr.indexOf("") > - 1;
};
|
|
|
-//学生端 处理作答区域
|
|
|
-var answerData = new Array();
|
|
|
-function handleAnswerRange() {
|
|
|
- //规范文本格式
|
|
|
- var answerId = "";
|
|
|
- var tempJson = new Array();
|
|
|
-
|
|
|
- //所有underline不做处理
|
|
|
- $.each($(".yaoshi").nextUntil(".yaoshi").filter(".underline"), function (index, item) {
|
|
|
- tempId = $(item).prevAll(".yaoshi").attr("answer-id");
|
|
|
- //记录上一次的ID
|
|
|
- if (tempId == undefined) {
|
|
|
- tempId = answerId;
|
|
|
- }
|
|
|
- else {
|
|
|
- answerId = tempId;
|
|
|
- }
|
|
|
- var prev = $(item).prev();
|
|
|
- if ((prev.length == 0 || $(prev).attr("class") != "tag-span") && $(prev).attr("class") != "underlineContent") {
|
|
|
- if ($("span[answer-id='" + tempId + "']").length == 0) {
|
|
|
- $(item).prop("outerHTML", "<span answer-id='" + tempId + "' class='tag-span' answer-isky='0'>_</span>");
|
|
|
- }
|
|
|
- }
|
|
|
- $(item).remove();
|
|
|
- });
|
|
|
-
|
|
|
- //提取参考答案并规范文本格式
|
|
|
- answerId = "";
|
|
|
- $.each($(".yaoshi").nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- var info = new Object();
|
|
|
- info.Id = $(item).prevAll(".yaoshi").attr("answer-id");
|
|
|
- //记录上一次的ID
|
|
|
- if (info.Id == undefined) {
|
|
|
- info.Id = answerId;
|
|
|
- }
|
|
|
- else {
|
|
|
- answerId = info.Id;
|
|
|
- }
|
|
|
-
|
|
|
- info.AnsText = $(item).text();
|
|
|
- tempJson.push(info);
|
|
|
-
|
|
|
- var prev = $(item).prev();
|
|
|
- if (prev.length == 0 || $(prev).attr("class") != "tag-span") {
|
|
|
- //替换答案
|
|
|
- $(item).prop("outerHTML", "<span answer-id='" + info.Id + "' class='tag-span' answer-isky='0'>_</span>");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).remove();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //补充空钥匙的处理
|
|
|
- $.each($(".yaoshi"), function (index, item) {
|
|
|
- var Id = $(item).attr("answer-id");
|
|
|
- var prev = $(item).next();
|
|
|
- if (prev.length == 0 || $(prev).attr("class") != "tag-span") {
|
|
|
- if ($("span[answer-id='" + Id + "']").length == 0) {
|
|
|
- var uHtml = document.createElement("span");
|
|
|
- uHtml.className = "tag-span";
|
|
|
- uHtml.innerText = "_";
|
|
|
- uHtml.setAttribute("answer-id", Id);
|
|
|
- $(item).after(uHtml);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //处理口语试题
|
|
|
- $.each($(".oralLanguage").nextUntil(".oralLanguageDone"), function (num, part) {
|
|
|
- if (part.tagName != "p") {
|
|
|
- $.each($(part).find(".tag-span"), function (index, item) {
|
|
|
- $(item).attr("answer-isky", "1");
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- if ($(part).hasClass("underlinePart")) {
|
|
|
- $.each($(part).find(".tag-span"), function (index, item) {
|
|
|
- $(item).attr("answer-isky", "1");
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //合并参考答案数据
|
|
|
- var tempid = "";
|
|
|
- var temptext = "";
|
|
|
- for (var i = 0; i < tempJson.length; i++) {
|
|
|
- if (tempid == tempJson[i].Id) {
|
|
|
- temptext = temptext + tempJson[i].AnsText;
|
|
|
- }
|
|
|
- else {
|
|
|
- if (tempid != "") {
|
|
|
- var info = new Object();
|
|
|
- info.Id = tempid;
|
|
|
- info.AnsText = temptext;
|
|
|
- answerData.push(info);
|
|
|
- //重置
|
|
|
- tempid = "";
|
|
|
- temptext = "";
|
|
|
- }
|
|
|
-
|
|
|
- tempid = tempJson[i].Id;
|
|
|
- temptext = tempJson[i].AnsText;
|
|
|
- //最后一个存入
|
|
|
- if (i == tempJson.length - 1) {
|
|
|
- var info = new Object();
|
|
|
- info.Id = tempid;
|
|
|
- info.AnsText = temptext;
|
|
|
- answerData.push(info);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //补全答题点
|
|
|
- var Num = 0;
|
|
|
- if (answerData.length > 0) {
|
|
|
- //Num = Number.parseInt(answerData[answerData.length - 1].Id);
|
|
|
- Num = Number.parseInt($(".yaoshi:last").attr('answer-id'));
|
|
|
- for (var i = 0; i < Num + 1; i++) {
|
|
|
- if (i < answerData.length) {
|
|
|
- var index = Number(answerData[i].Id) - i;
|
|
|
- for (var j = 0; j < index; j++) {
|
|
|
- var info = new Object();
|
|
|
- info.Id = (i + j).toString();
|
|
|
- info.AnsText = "";
|
|
|
- answerData.splice(i, 0, info);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- var info = new Object();
|
|
|
- info.Id = (i).toString();
|
|
|
- info.AnsText = "";
|
|
|
- answerData.splice(i, 0, info);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //添加答题点的点击UI及交互
|
|
|
- $.each($(".tag-span"), function (index, item) {
|
|
|
- var answerText = "";
|
|
|
- var isky = $(item).attr('answer-isky');
|
|
|
- var answerid = $(item).attr('answer-id');
|
|
|
-
|
|
|
- for (var i = 0; i < answerData.length; i++) {
|
|
|
- if (answerid == answerData[i].Id) {
|
|
|
- answerText = answerData[i].AnsText;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "'><div class='answer-audio-range'><img src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div><buttom class='answer-text'></buttom></div>");
|
|
|
- //删除钥匙节点
|
|
|
- var prev = $("img[answer-id='" + answerid + "']");
|
|
|
- if (prev.length > 0) {
|
|
|
- $(prev).remove();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //添加点击事件
|
|
|
- $(".answer-body").on("click", function () {
|
|
|
- var curObj = new Object();
|
|
|
- curObj.Id = $(this).attr("answer-id");//答题点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");//评语
|
|
|
-
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(this).addClass("select-answer");
|
|
|
-
|
|
|
- //已作答,弹出作答答案
|
|
|
- if ($(this).data("ans-status") == "1") {
|
|
|
- //移动端添加外部处理
|
|
|
- onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
- }
|
|
|
- else {
|
|
|
- //移动端添加外部处理,弹出作答操作
|
|
|
- onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //去除多余的空格横线
|
|
|
- $.each($(".underline"), function (index, item) {
|
|
|
- var text = $(item).text();
|
|
|
- text = text.replace(/\s+/g, "");
|
|
|
- if (text == "") {
|
|
|
- $(item).remove();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- return answerData;
|
|
|
-}
|
|
|
-
|
|
|
-//接收学生的作答
|
|
|
-function reviewAnswer(answerJson) {
|
|
|
- if (answerJson != "" && answerJson) {
|
|
|
- var answerObj = JSON.parse(answerJson);
|
|
|
- var selectElement = $(".answer-body[answer-id='" + answerObj.Id + "']");
|
|
|
- var audioElement = $(selectElement).children(".answer-audio-range").children("img").eq(0);
|
|
|
- answerObj.IsKY = $(selectElement).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
-
|
|
|
- //是否为音频作答
|
|
|
- if ((answerObj.Type == 3 || answerObj.Type == 4) && answerObj.AudioUrl != "") {
|
|
|
- $(selectElement).children(".answer-point-range").hide();
|
|
|
- $(selectElement).children(".answer-audio-range").css("display", "inline-block");
|
|
|
- $(selectElement).children(".answer-audio-range").children("span").text("作答音频(" + answerObj.AudioLength + "s)");
|
|
|
- //填充作答内容
|
|
|
- $(selectElement).attr("answer-text", answerObj.Text);
|
|
|
- if (answerObj.Text != "") {
|
|
|
- answerObj.Text = "(" + answerObj.Text + ")";
|
|
|
- $(selectElement).children(".answer-text").show();
|
|
|
- $(selectElement).children(".answer-text").text(answerObj.Text);
|
|
|
- }
|
|
|
-
|
|
|
- //是否之前存在作答音频
|
|
|
- $(selectElement).attr("answer-url", answerObj.AudioUrl);
|
|
|
- $(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
- $(selectElement).children(".answer-audio-range").attr("play-status", "0");
|
|
|
- //独立绑定事件
|
|
|
- $(audioElement).on("click", function () {
|
|
|
- recordAudioClick(this, answerObj.Id, answerObj.AudioUrl);
|
|
|
- });
|
|
|
- $(selectElement).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(selectElement).addClass("select-answer");
|
|
|
- onClickAnswerPoint(JSON.stringify(answerObj));
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- $(selectElement).attr("answer-text", answerObj.Text);//填充作答内容
|
|
|
- $(selectElement).children(".answer-audio-range").hide();
|
|
|
- if (answerObj.Text != "") {
|
|
|
- $(selectElement).children(".answer-text").show();
|
|
|
- $(selectElement).children(".answer-point-range").hide();
|
|
|
- $(selectElement).children(".answer-text").text(answerObj.Text);
|
|
|
- }
|
|
|
- else {
|
|
|
- $(selectElement).children(".answer-text").hide();
|
|
|
- $(selectElement).children(".answer-point-range").show();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//提交,获取所有作答答案及参考答案
|
|
|
-function getAllAnswer() {
|
|
|
- //处理作答
|
|
|
- $.each($(".answer-body"), function (index, item) {
|
|
|
- var mytext = $(item).children(".answer-text").text();
|
|
|
- var curDisplay = $(item).children(".answer-audio-range").css("display");
|
|
|
- if (mytext == "" && curDisplay == "none") {
|
|
|
- mytext = "未作答";
|
|
|
- $(item).children(".answer-point-range").hide();
|
|
|
- $(item).children(".answer-text").show();
|
|
|
- $(item).children(".answer-text").text(mytext);
|
|
|
- $(item).children(".answer-text").addClass("no-answer");
|
|
|
- }
|
|
|
- });
|
|
|
- $(".answer-body").removeClass("select-answer");//移除样式
|
|
|
- $(".answer-body").unbind('click');//取消点击绑定事件
|
|
|
- $(".answer-body").children(".answer-audio-range").children("span").unbind('click');//取消点击绑定事件
|
|
|
-
|
|
|
- return answerData;
|
|
|
-}
|
|
|
-
|
|
|
-//回填所有答案,answerJson:所有作答及参考答案List,statusType:0-可作答,1-已提交,2-查看评阅
|
|
|
-function backupAllAnswer(answerJson, statusType) {
|
|
|
- if (answerJson != "" && answerJson) {
|
|
|
- var answerList = JSON.parse(answerJson);
|
|
|
- $.each($(".answer-body"), function (index, item) {
|
|
|
- //提交直接还原作答现场
|
|
|
- var mytext = answerList[index].Text;//我的答案
|
|
|
- answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
-
|
|
|
- //添加音频控制
|
|
|
- var audioElement = $(item).children(".answer-audio-range").children("img").eq(0);
|
|
|
- if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- $(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).children(".answer-audio-range").attr("play-status", "0");
|
|
|
-
|
|
|
- //独立绑定事件
|
|
|
- $(audioElement).on("click", function () {
|
|
|
- recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- //可作答状态,作答还原
|
|
|
- if (statusType == 0) {
|
|
|
- //已作答过,还原作答,增加作答后的UI节点
|
|
|
- if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(item).addClass("select-answer");
|
|
|
- onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
- if (mytext != "") {
|
|
|
- $(item).children(".answer-text").show();
|
|
|
- $(item).children(".answer-point-range").hide();
|
|
|
- $(item).children(".answer-text").text(mytext);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //已提交,作答还原
|
|
|
- if (statusType == 1) {
|
|
|
- //取消点击绑定事件
|
|
|
- $(item).unbind('click');
|
|
|
- //填充作答内容
|
|
|
- $(item).attr("answer-text", mytext);
|
|
|
- if (mytext == "") {
|
|
|
- mytext = "未作答";
|
|
|
- $(item).children(".answer-text").addClass("no-answer");
|
|
|
- }
|
|
|
- $(item).children(".answer-text").show();
|
|
|
- $(item).children(".answer-text").text(mytext);
|
|
|
- $(item).children(".answer-point-range").hide();
|
|
|
- }
|
|
|
- //已评阅,查看评阅详情
|
|
|
- if (statusType == 2) {
|
|
|
- //添加音频控制
|
|
|
- if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- //独立绑定事件
|
|
|
- $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(item).addClass("select-answer");
|
|
|
- onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
- if (mytext == "") {
|
|
|
- mytext = "未作答";
|
|
|
- $(item).children(".answer-text").addClass("no-answer");
|
|
|
- }
|
|
|
- $(item).children(".answer-text").show();
|
|
|
- $(item).children(".answer-text").text(mytext);
|
|
|
- $(item).children(".answer-point-range").hide();
|
|
|
- }
|
|
|
-
|
|
|
- //评阅样式
|
|
|
- if (answerList[index].Score == 0 && answerList[index].Text != "") {
|
|
|
- $(item).children(".answer-text").addClass("bad-answer");
|
|
|
- }
|
|
|
- if (answerList[index].Score > 0) {
|
|
|
- $(item).children(".answer-text").addClass("good-answer");
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//老师评阅学生作答
|
|
|
-function reviewStuAnswer(answerJson) {
|
|
|
- if (answerJson != "" && answerJson) {
|
|
|
- var answerObj = JSON.parse(answerJson);
|
|
|
- var selectElement = $(".answer-body[answer-id='" + answerObj.Id + "']");
|
|
|
-
|
|
|
- //$(selectElement).attr("answer-text", answerObj.Text);//用户作答内容
|
|
|
- $(selectElement).attr("answer-score", answerObj.Score);//作答评分
|
|
|
- $(selectElement).attr("answer-anstext ", answerObj.AnsText);//参考答案
|
|
|
- $(selectElement).attr("answer-comment", answerObj.Comment);//评语
|
|
|
- //评阅样式
|
|
|
- if (answerObj.Score == 0) {
|
|
|
- $(selectElement).children(".answer-text").removeClass("good-answer");
|
|
|
- $(selectElement).children(".answer-text").addClass("bad-answer");
|
|
|
- }
|
|
|
- if (answerObj.Score > 0) {
|
|
|
- $(selectElement).children(".answer-text").removeClass("bad-answer");
|
|
|
- $(selectElement).children(".answer-text").addClass("good-answer");
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//回填所有评阅信息,answerJson:所有作答及参考答案评阅信息List
|
|
|
-function backupAllReview(answerJson) {
|
|
|
- if (answerJson != "" && answerJson) {
|
|
|
- var answerList = JSON.parse(answerJson);
|
|
|
- $.each($(".answer-body"), function (index, item) {
|
|
|
- //$(item).attr("answer-id", answerList[index].Id);//答题点ID
|
|
|
- //$(item).attr("answer-text", answerList[index].Text);//用户作答内容
|
|
|
- $(item).attr("answer-score", answerList[index].Score);//作答评分
|
|
|
- $(item).attr("answer-anstext ", answerList[index].AnsText);//参考答案
|
|
|
- $(item).attr("answer-comment", answerList[index].Comment);//评语
|
|
|
-
|
|
|
- //提交直接还原作答现场
|
|
|
- var mytext = answerList[index].Text;//我的答案
|
|
|
- var audioElement = $(item).children(".answer-audio-range").children("img").eq(0);
|
|
|
- if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- $(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).children(".answer-audio-range").attr("play-status", "0");
|
|
|
- //独立绑定事件
|
|
|
- $(audioElement).on("click", function () {
|
|
|
- recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
- });
|
|
|
- $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(item).addClass("select-answer");
|
|
|
- onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
- if (mytext == "") {
|
|
|
- mytext = "未作答";
|
|
|
- $(item).children(".answer-text").addClass("no-answer");
|
|
|
- }
|
|
|
- $(item).children(".answer-text").show();
|
|
|
- $(item).children(".answer-text").text(mytext);
|
|
|
- $(item).children(".answer-point-range").hide();
|
|
|
- }
|
|
|
-
|
|
|
- //评阅样式
|
|
|
- if (answerList[index].Score == 0) {
|
|
|
- $(item).children(".answer-text").addClass("bad-answer");
|
|
|
- }
|
|
|
- if (answerList[index].Score > 0) {
|
|
|
- $(item).children(".answer-text").addClass("good-answer");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-//处理播放录音,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);
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- var ansDom = $(".answer-body[answer-id='" + 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 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));
|
|
|
-}
|
|
|
-
|
|
|
-//作答录音播放按钮点击事件
|
|
|
-function recordAudioClick(myobj, id, url) {
|
|
|
- //处理当前按钮的状态
|
|
|
- if ($(myobj).parent().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).parent().attr("play-status", "1");
|
|
|
- $(myobj).attr("src", PicInfo.recordPauseImgUrl);//移动端要根据本地路径替换
|
|
|
- }
|
|
|
- else {
|
|
|
- $(myobj).parent().attr("play-status", "0");
|
|
|
- $(myobj).attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
- }
|
|
|
-
|
|
|
- //移动端添加外部处理,播放录音
|
|
|
- var info = new Object();
|
|
|
- info.Id = id;
|
|
|
- info.AudioUrl = url;
|
|
|
- //移动端添加外部处理,播放录音
|
|
|
- playVisiableAudioCallBack(3, JSON.stringify(info));
|
|
|
-}
|
|
|
-
|
|
|
-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 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);
|
|
|
+//播放音频图片地址
|
|
|
+var PicInfo1 = {
|
|
|
+ answerPointImgUrl: "file:///android_asset/js/update-answer.png",
|
|
|
+ yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
|
|
|
+ yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
|
|
|
+ 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"
|
|
|
+}
|
|
|
+
|
|
|
+//本地调用用的资源
|
|
|
+var PicInfo = {
|
|
|
+ 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"
|
|
|
+}
|
|
|
+
|
|
|
+//显示、隐藏答案
|
|
|
+function showHideAnswer(flag) {
|
|
|
+ if (flag) {
|
|
|
+ //$(".underlineContent").show();
|
|
|
+ $(".underlineContent").css("color", "#92D050");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //$(".underlineContent").hide();
|
|
|
+ $(".underlineContent").css("color", "#ffffff");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+///显示、隐藏钥匙及答案 isShowYX:显示和隐藏钥匙,isShowAS:显示和隐藏答案
|
|
|
+function showHideAnswerEx(isShowYX, isShowAS) {
|
|
|
+ if (isShowYX) {
|
|
|
+ $(".yaoshi").show();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(".yaoshi").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isShowAS) {
|
|
|
+ $.each($(".underlineContent"), function (index, item) {
|
|
|
+ //$(item).html($(item).attr("data-text"));
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
+
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ $(".yaoshi").attr("data-status", "1");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $.each($(".underlineContent,.underlineContent.no-answer"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ $(".yaoshi").attr("data-status", "0");
|
|
|
+ $(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//页面加载完,原文 绑定事件
|
|
|
+function bindEventTeaOrignalYS() {
|
|
|
+ var bodyWidth = $(document.body).width();
|
|
|
+ //显示/隐藏习题答案
|
|
|
+ $(".yaoshi").on("click", function () {
|
|
|
+ var curDisplay = $(this).nextUntil(".yaoshi").find(".underlineContent").eq(0).css("display");
|
|
|
+ if (curDisplay == "undefined" || curDisplay == undefined) return;
|
|
|
+
|
|
|
+ if (curDisplay == "none" || $(this).attr("data-status") == "0") {
|
|
|
+ $(this).attr("data-status", "1");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").show();
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#92D050");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").find(".underlineContent"), function (index, item) {
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
+
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ //不再存在已隐藏的钥匙,移动端回调
|
|
|
+ if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
+ //添加回调
|
|
|
+ console.log("全部显示了");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $(this).attr("data-status", "0");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").hide();
|
|
|
+ //$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#ffffff");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ //添加回调
|
|
|
+ onClickKeyHide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //处理答题点
|
|
|
+ $.each($(".underlineContent"), function (index, item) {
|
|
|
+ $(item).attr("data-text", $(item).html());
|
|
|
+ });
|
|
|
+ //给音频绑定一个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", "");
|
|
|
+ });
|
|
|
+ //去除多余的U空标签
|
|
|
+ $.each($("u"), function (index, item) {
|
|
|
+ var text = $(item).text();
|
|
|
+ text = text.replace(/\s+/g, "");
|
|
|
+ if (text == "") {
|
|
|
+ $(item).remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //处理暂无参考答案
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ var prev = $(item).nextUntil(".yaoshi").find(".underlineContent");
|
|
|
+ if (prev.length == 0) {
|
|
|
+ var spanHtml = document.createElement("span");
|
|
|
+ //添加子节点
|
|
|
+ var uHtml = document.createElement("u");
|
|
|
+ uHtml.className = "underlineContent no-answer";
|
|
|
+ uHtml.innerText = "暂无参考答案";
|
|
|
+ uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
+ $(spanHtml).html(uHtml.outerHTML);
|
|
|
+ $(item).after(spanHtml);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //处理表格宽度
|
|
|
+ $.each($(".wordTable"), function (index, item) {
|
|
|
+ $(item).css("width", bodyWidth + "px");
|
|
|
+ });
|
|
|
+
|
|
|
+ //点击喇叭事件,音频播放
|
|
|
+ $(".audioImg").on("click", function () {
|
|
|
+ audioPlayClick(this);
|
|
|
+ });
|
|
|
+ //点击播放事件,视频播放
|
|
|
+ $(".videoImg").on("click", function () {
|
|
|
+ var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
+ var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
+ playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
+ });
|
|
|
+ //处理表格样式
|
|
|
+ $("td").attr("style", "");
|
|
|
+}
|
|
|
+
|
|
|
+//页面加载完,课件 绑定事件
|
|
|
+function bindEventYS() {
|
|
|
+ var bodyWidth = $(document.body).width();
|
|
|
+ //不存在underline 属性下有内容,所以全部隐藏,若有就是源头数据有问题
|
|
|
+ $('.underline').css("display", "none");
|
|
|
+ //给每个答题点加上ID
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ $(item).attr('answer-id', index);
|
|
|
+ });
|
|
|
+ //给音频绑定一个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", "");
|
|
|
+ });
|
|
|
+ //去除多余的U空标签
|
|
|
+ $.each($("u"), function (index, item) {
|
|
|
+ var text = $(item).text();
|
|
|
+ text = text.replace(/\s+/g, "");
|
|
|
+ if (text == "") {
|
|
|
+ $(item).remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //处理暂无参考答案
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ var parent = $(item).parent();
|
|
|
+ var prev = $(item).nextAll(".underlineContent");
|
|
|
+ if (prev.length == 0) {
|
|
|
+ var uHtml = document.createElement("u");
|
|
|
+ uHtml.className = "underlineContent no-answer";
|
|
|
+ uHtml.innerText = "暂无参考答案";
|
|
|
+ if ($(parent)[0].tagName == 'P') {
|
|
|
+ if ($(parent).hasClass('correntQue') || $(parent).hasClass('boxQue')) {
|
|
|
+ uHtml.innerHTML = " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
+ $(item).after(uHtml);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //处理表格宽度
|
|
|
+ $.each($(".wordTable"), function (index, item) {
|
|
|
+ $(item).css("width", bodyWidth + "px");
|
|
|
+ });
|
|
|
+ //获取两个之间的答题点
|
|
|
+ var index = 1;
|
|
|
+ var checkId = 0;
|
|
|
+ $.each($(".multipleStart").nextUntil(".multipleEnd").filter("[class*='group']"), function (index, item) {
|
|
|
+ checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
+ var index = $(item).attr('class').replace(/.*group(\d+).*/g, "$1");
|
|
|
+ var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
|
|
|
+ if ($(item).hasClass('boxQue')) {
|
|
|
+ $(item).find('.yaoshi').after("<div class='checkbox'><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
|
|
|
+ $(item).find('input').prop('checked', ischecked);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //显示/隐藏习题答案
|
|
|
+ $(".yaoshi").on("click", function () {
|
|
|
+ // 隐藏答案
|
|
|
+ var NClsName = $(this).parent().attr("class") + " correntQue";
|
|
|
+ var PClsName = $(this).parent().attr("class"); // 对错题有内容填写必然有correntQue,否则判断条件不成立
|
|
|
+ if (PClsName.indexOf(" correntQue") > -1) {
|
|
|
+ PClsName = PClsName.replace(" correntQue", "");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ PClsName = "";
|
|
|
+ }
|
|
|
+ var NextClsName = $(this).parent().next().attr("class");
|
|
|
+ var PreClsName = $(this).parent().prev().attr("class");
|
|
|
+ if ($(this).attr("data-status") == "0") {
|
|
|
+ if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
+ // 相同前缀且有分组才渲染
|
|
|
+ $(this).parent().next().find(".yaoshi").attr("data-status", "1");
|
|
|
+ $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
+ // 相同前缀且有分组才渲染
|
|
|
+ $(this).parent().prev().find(".yaoshi").attr("data-status", "1");
|
|
|
+ $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ $(this).parent().prev().find(".underlineContent").css("color", "#989898");
|
|
|
+ }
|
|
|
+ $(this).attr("data-status", "1");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
+
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ //不再存在已隐藏的钥匙,移动端回调
|
|
|
+ if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
+ //添加回调
|
|
|
+ console.log("全部显示了");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
+ // 相同前缀且有分组才渲染
|
|
|
+ $(this).parent().next().find(".yaoshi").attr("data-status", "0");
|
|
|
+ $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
+ // 相同前缀且有分组才渲染
|
|
|
+ $(this).parent().prev().find(".yaoshi").attr("data-status", "0");
|
|
|
+ $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $(this).parent().prev().find(".underlineContent").css("color", "#ffffff").css("background-color", "#ffffff");
|
|
|
+ }
|
|
|
+ $(this).attr("data-status", "0");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ //添加回调
|
|
|
+ onClickKeyHide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //点击喇叭事件,音频播放
|
|
|
+ $(".audioImg").on("click", function () {
|
|
|
+ audioPlayClick(this);
|
|
|
+ });
|
|
|
+ //点击播放事件,视频播放
|
|
|
+ $(".videoImg").on("click", function () {
|
|
|
+ $(this).attr("audiourl", "");
|
|
|
+ var curHtml = $(this).parent().find(".videoUrl").html();
|
|
|
+ var curAlt = $(this).attr("alt");//播放视频地址
|
|
|
+ playVisiableAudioCallBack(2, $(this).attr("alt"));
|
|
|
+ });
|
|
|
+ //处理表格样式
|
|
|
+ $("td").attr("style", "");
|
|
|
+}
|
|
|
+
|
|
|
+// 过滤规则
|
|
|
+var FRules = function(DataStr) {
|
|
|
+ return DataStr.indexOf("") > - 1;
|
|
|
+};
|
|
|
+//学生端 处理作答区域
|
|
|
+var answerData = new Array();
|
|
|
+function handleAnswerRange() {
|
|
|
+ //规范文本格式
|
|
|
+ var answerId = "";
|
|
|
+ var tempJson = new Array();
|
|
|
+
|
|
|
+ //所有underline不做处理
|
|
|
+ $.each($(".yaoshi").nextUntil(".yaoshi").filter(".underline"), function (index, item) {
|
|
|
+ tempId = $(item).prevAll(".yaoshi").attr("answer-id");
|
|
|
+ //记录上一次的ID
|
|
|
+ if (tempId == undefined) {
|
|
|
+ tempId = answerId;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ answerId = tempId;
|
|
|
+ }
|
|
|
+ var prev = $(item).prev();
|
|
|
+ if ((prev.length == 0 || $(prev).attr("class") != "tag-span") && $(prev).attr("class") != "underlineContent") {
|
|
|
+ if ($("span[answer-id='" + tempId + "']").length == 0) {
|
|
|
+ $(item).prop("outerHTML", "<span answer-id='" + tempId + "' class='tag-span' answer-isky='0'>_</span>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(item).remove();
|
|
|
+ });
|
|
|
+
|
|
|
+ //提取参考答案并规范文本格式
|
|
|
+ answerId = "";
|
|
|
+ $.each($(".yaoshi").nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = $(item).prevAll(".yaoshi").attr("answer-id");
|
|
|
+ //记录上一次的ID
|
|
|
+ if (info.Id == undefined) {
|
|
|
+ info.Id = answerId;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ answerId = info.Id;
|
|
|
+ }
|
|
|
+
|
|
|
+ info.AnsText = $(item).text();
|
|
|
+ tempJson.push(info);
|
|
|
+
|
|
|
+ var prev = $(item).prev();
|
|
|
+ if (prev.length == 0 || $(prev).attr("class") != "tag-span") {
|
|
|
+ //替换答案
|
|
|
+ $(item).prop("outerHTML", "<span answer-id='" + info.Id + "' class='tag-span' answer-isky='0'>_</span>");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //补充空钥匙的处理
|
|
|
+ $.each($(".yaoshi"), function (index, item) {
|
|
|
+ var Id = $(item).attr("answer-id");
|
|
|
+ var prev = $(item).next();
|
|
|
+ if (prev.length == 0 || $(prev).attr("class") != "tag-span") {
|
|
|
+ if ($("span[answer-id='" + Id + "']").length == 0) {
|
|
|
+ var uHtml = document.createElement("span");
|
|
|
+ uHtml.className = "tag-span";
|
|
|
+ uHtml.innerText = "_";
|
|
|
+ uHtml.setAttribute("answer-id", Id);
|
|
|
+ $(item).after(uHtml);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //处理口语试题
|
|
|
+ $.each($(".oralLanguage").nextUntil(".oralLanguageDone"), function (num, part) {
|
|
|
+ if (part.tagName != "p") {
|
|
|
+ $.each($(part).find(".tag-span"), function (index, item) {
|
|
|
+ $(item).attr("answer-isky", "1");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($(part).hasClass("underlinePart")) {
|
|
|
+ $.each($(part).find(".tag-span"), function (index, item) {
|
|
|
+ $(item).attr("answer-isky", "1");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //合并参考答案数据
|
|
|
+ var tempid = "";
|
|
|
+ var temptext = "";
|
|
|
+ for (var i = 0; i < tempJson.length; i++) {
|
|
|
+ if (tempid == tempJson[i].Id) {
|
|
|
+ temptext = temptext + tempJson[i].AnsText;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (tempid != "") {
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = tempid;
|
|
|
+ info.AnsText = temptext;
|
|
|
+ answerData.push(info);
|
|
|
+ //重置
|
|
|
+ tempid = "";
|
|
|
+ temptext = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ tempid = tempJson[i].Id;
|
|
|
+ temptext = tempJson[i].AnsText;
|
|
|
+ //最后一个存入
|
|
|
+ if (i == tempJson.length - 1) {
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = tempid;
|
|
|
+ info.AnsText = temptext;
|
|
|
+ answerData.push(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //补全答题点
|
|
|
+ var Num = 0;
|
|
|
+ if (answerData.length > 0) {
|
|
|
+ //Num = Number.parseInt(answerData[answerData.length - 1].Id);
|
|
|
+ Num = Number.parseInt($(".yaoshi:last").attr('answer-id'));
|
|
|
+ for (var i = 0; i < Num + 1; i++) {
|
|
|
+ if (i < answerData.length) {
|
|
|
+ var index = Number(answerData[i].Id) - i;
|
|
|
+ for (var j = 0; j < index; j++) {
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = (i + j).toString();
|
|
|
+ info.AnsText = "";
|
|
|
+ answerData.splice(i, 0, info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = (i).toString();
|
|
|
+ info.AnsText = "";
|
|
|
+ answerData.splice(i, 0, info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加答题点的点击UI及交互
|
|
|
+ $.each($(".tag-span"), function (index, item) {
|
|
|
+ var answerText = "";
|
|
|
+ var isky = $(item).attr('answer-isky');
|
|
|
+ var answerid = $(item).attr('answer-id');
|
|
|
+
|
|
|
+ for (var i = 0; i < answerData.length; i++) {
|
|
|
+ if (answerid == answerData[i].Id) {
|
|
|
+ answerText = answerData[i].AnsText;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "'><div class='answer-audio-range'><img src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div><buttom class='answer-text'></buttom></div>");
|
|
|
+ //删除钥匙节点
|
|
|
+ var prev = $("img[answer-id='" + answerid + "']");
|
|
|
+ if (prev.length > 0) {
|
|
|
+ $(prev).remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //添加点击事件
|
|
|
+ $(".answer-body").on("click", function () {
|
|
|
+ var curObj = new Object();
|
|
|
+ curObj.Id = $(this).attr("answer-id");//答题点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");//评语
|
|
|
+
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(this).addClass("select-answer");
|
|
|
+
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //去除多余的空格横线
|
|
|
+ $.each($(".underline"), function (index, item) {
|
|
|
+ var text = $(item).text();
|
|
|
+ text = text.replace(/\s+/g, "");
|
|
|
+ if (text == "") {
|
|
|
+ $(item).remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return answerData;
|
|
|
+}
|
|
|
+
|
|
|
+//接收学生的作答
|
|
|
+function reviewAnswer(answerJson) {
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerObj = JSON.parse(answerJson);
|
|
|
+ var selectElement = $(".answer-body[answer-id='" + answerObj.Id + "']");
|
|
|
+ var audioElement = $(selectElement).children(".answer-audio-range").children("img").eq(0);
|
|
|
+ answerObj.IsKY = $(selectElement).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+
|
|
|
+ //是否为音频作答
|
|
|
+ if ((answerObj.Type == 3 || answerObj.Type == 4) && answerObj.AudioUrl != "") {
|
|
|
+ $(selectElement).children(".answer-point-range").hide();
|
|
|
+ $(selectElement).children(".answer-audio-range").css("display", "inline-block");
|
|
|
+ $(selectElement).children(".answer-audio-range").children("span").text("作答音频(" + answerObj.AudioLength + "s)");
|
|
|
+ //填充作答内容
|
|
|
+ $(selectElement).attr("answer-text", answerObj.Text);
|
|
|
+ if (answerObj.Text != "") {
|
|
|
+ answerObj.Text = "(" + answerObj.Text + ")";
|
|
|
+ $(selectElement).children(".answer-text").show();
|
|
|
+ $(selectElement).children(".answer-text").text(answerObj.Text);
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否之前存在作答音频
|
|
|
+ $(selectElement).attr("answer-url", answerObj.AudioUrl);
|
|
|
+ $(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
+ $(selectElement).children(".answer-audio-range").attr("play-status", "0");
|
|
|
+ //独立绑定事件
|
|
|
+ $(audioElement).on("click", function () {
|
|
|
+ recordAudioClick(this, answerObj.Id, answerObj.AudioUrl);
|
|
|
+ });
|
|
|
+ $(selectElement).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(selectElement).addClass("select-answer");
|
|
|
+ onClickAnswerPoint(JSON.stringify(answerObj));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(selectElement).attr("answer-text", answerObj.Text);//填充作答内容
|
|
|
+ $(selectElement).children(".answer-audio-range").hide();
|
|
|
+ if (answerObj.Text != "") {
|
|
|
+ $(selectElement).children(".answer-text").show();
|
|
|
+ $(selectElement).children(".answer-point-range").hide();
|
|
|
+ $(selectElement).children(".answer-text").text(answerObj.Text);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(selectElement).children(".answer-text").hide();
|
|
|
+ $(selectElement).children(".answer-point-range").show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//提交,获取所有作答答案及参考答案
|
|
|
+function getAllAnswer() {
|
|
|
+ //处理作答
|
|
|
+ $.each($(".answer-body"), function (index, item) {
|
|
|
+ var mytext = $(item).children(".answer-text").text();
|
|
|
+ var curDisplay = $(item).children(".answer-audio-range").css("display");
|
|
|
+ if (mytext == "" && curDisplay == "none") {
|
|
|
+ mytext = "未作答";
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ $(item).children(".answer-text").addClass("no-answer");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $(".answer-body").removeClass("select-answer");//移除样式
|
|
|
+ $(".answer-body").unbind('click');//取消点击绑定事件
|
|
|
+ $(".answer-body").children(".answer-audio-range").children("span").unbind('click');//取消点击绑定事件
|
|
|
+
|
|
|
+ return answerData;
|
|
|
+}
|
|
|
+
|
|
|
+//回填所有答案,answerJson:所有作答及参考答案List,statusType:0-可作答,1-已提交,2-查看评阅
|
|
|
+function backupAllAnswer(answerJson, statusType) {
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerList = JSON.parse(answerJson);
|
|
|
+ $.each($(".answer-body"), function (index, item) {
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
+
|
|
|
+ //添加音频控制
|
|
|
+ var audioElement = $(item).children(".answer-audio-range").children("img").eq(0);
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ $(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).children(".answer-audio-range").attr("play-status", "0");
|
|
|
+
|
|
|
+ //独立绑定事件
|
|
|
+ $(audioElement).on("click", function () {
|
|
|
+ recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //可作答状态,作答还原
|
|
|
+ if (statusType == 0) {
|
|
|
+ //已作答过,还原作答,增加作答后的UI节点
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
+ onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ if (mytext != "") {
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //已提交,作答还原
|
|
|
+ if (statusType == 1) {
|
|
|
+ //取消点击绑定事件
|
|
|
+ $(item).unbind('click');
|
|
|
+ //填充作答内容
|
|
|
+ $(item).attr("answer-text", mytext);
|
|
|
+ if (mytext == "") {
|
|
|
+ mytext = "未作答";
|
|
|
+ $(item).children(".answer-text").addClass("no-answer");
|
|
|
+ }
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ }
|
|
|
+ //已评阅,查看评阅详情
|
|
|
+ if (statusType == 2) {
|
|
|
+ //添加音频控制
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ //独立绑定事件
|
|
|
+ $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
+ onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ if (mytext == "") {
|
|
|
+ mytext = "未作答";
|
|
|
+ $(item).children(".answer-text").addClass("no-answer");
|
|
|
+ }
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ //评阅样式
|
|
|
+ if (answerList[index].Score == 0 && answerList[index].Text != "") {
|
|
|
+ $(item).children(".answer-text").addClass("bad-answer");
|
|
|
+ }
|
|
|
+ if (answerList[index].Score > 0) {
|
|
|
+ $(item).children(".answer-text").addClass("good-answer");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//老师评阅学生作答
|
|
|
+function reviewStuAnswer(answerJson) {
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerObj = JSON.parse(answerJson);
|
|
|
+ var selectElement = $(".answer-body[answer-id='" + answerObj.Id + "']");
|
|
|
+
|
|
|
+ //$(selectElement).attr("answer-text", answerObj.Text);//用户作答内容
|
|
|
+ $(selectElement).attr("answer-score", answerObj.Score);//作答评分
|
|
|
+ $(selectElement).attr("answer-anstext ", answerObj.AnsText);//参考答案
|
|
|
+ $(selectElement).attr("answer-comment", answerObj.Comment);//评语
|
|
|
+ //评阅样式
|
|
|
+ if (answerObj.Score == 0) {
|
|
|
+ $(selectElement).children(".answer-text").removeClass("good-answer");
|
|
|
+ $(selectElement).children(".answer-text").addClass("bad-answer");
|
|
|
+ }
|
|
|
+ if (answerObj.Score > 0) {
|
|
|
+ $(selectElement).children(".answer-text").removeClass("bad-answer");
|
|
|
+ $(selectElement).children(".answer-text").addClass("good-answer");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//回填所有评阅信息,answerJson:所有作答及参考答案评阅信息List
|
|
|
+function backupAllReview(answerJson) {
|
|
|
+ if (answerJson != "" && answerJson) {
|
|
|
+ var answerList = JSON.parse(answerJson);
|
|
|
+ $.each($(".answer-body"), function (index, item) {
|
|
|
+ //$(item).attr("answer-id", answerList[index].Id);//答题点ID
|
|
|
+ //$(item).attr("answer-text", answerList[index].Text);//用户作答内容
|
|
|
+ $(item).attr("answer-score", answerList[index].Score);//作答评分
|
|
|
+ $(item).attr("answer-anstext ", answerList[index].AnsText);//参考答案
|
|
|
+ $(item).attr("answer-comment", answerList[index].Comment);//评语
|
|
|
+
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ var audioElement = $(item).children(".answer-audio-range").children("img").eq(0);
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ $(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).children(".answer-audio-range").attr("play-status", "0");
|
|
|
+ //独立绑定事件
|
|
|
+ $(audioElement).on("click", function () {
|
|
|
+ recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
+ });
|
|
|
+ $(item).children(".answer-audio-range").children("span").on("click", function () {
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
+ onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ if (mytext == "") {
|
|
|
+ mytext = "未作答";
|
|
|
+ $(item).children(".answer-text").addClass("no-answer");
|
|
|
+ }
|
|
|
+ $(item).children(".answer-text").show();
|
|
|
+ $(item).children(".answer-text").text(mytext);
|
|
|
+ $(item).children(".answer-point-range").hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ //评阅样式
|
|
|
+ if (answerList[index].Score == 0) {
|
|
|
+ $(item).children(".answer-text").addClass("bad-answer");
|
|
|
+ }
|
|
|
+ if (answerList[index].Score > 0) {
|
|
|
+ $(item).children(".answer-text").addClass("good-answer");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理播放录音,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);
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ var ansDom = $(".answer-body[answer-id='" + 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 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));
|
|
|
+}
|
|
|
+
|
|
|
+//作答录音播放按钮点击事件
|
|
|
+function recordAudioClick(myobj, id, url) {
|
|
|
+ //处理当前按钮的状态
|
|
|
+ if ($(myobj).parent().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).parent().attr("play-status", "1");
|
|
|
+ $(myobj).attr("src", PicInfo.recordPauseImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(myobj).parent().attr("play-status", "0");
|
|
|
+ $(myobj).attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
+ }
|
|
|
+
|
|
|
+ //移动端添加外部处理,播放录音
|
|
|
+ var info = new Object();
|
|
|
+ info.Id = id;
|
|
|
+ info.AudioUrl = url;
|
|
|
+ //移动端添加外部处理,播放录音
|
|
|
+ playVisiableAudioCallBack(3, JSON.stringify(info));
|
|
|
+}
|
|
|
+
|
|
|
+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 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);
|
|
|
}
|