|
|
@@ -1,5 +1,5 @@
|
|
|
//播放音频图片地址
|
|
|
-var PicInfo = {
|
|
|
+var PicInfo1 = {
|
|
|
answerPointImgUrl: "file:///android_asset/js/update-answer.png",
|
|
|
yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
|
|
|
yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
|
|
|
@@ -10,7 +10,7 @@ var PicInfo = {
|
|
|
}
|
|
|
|
|
|
//本地调用用的资源
|
|
|
-var PicInfo1 = {
|
|
|
+var PicInfo = {
|
|
|
answerPointImgUrl: "../Images/update-answer.png",
|
|
|
yaoshiShowImgUrl: "../Images/yaoshi-show.png",
|
|
|
yaoshiHideImgUrl: "../Images/yaoshi-hide.png",
|
|
|
@@ -211,7 +211,7 @@ function bindEventYS() {
|
|
|
uHtml.innerText = "暂无参考答案";
|
|
|
if ($(parent)[0].tagName == 'P') {
|
|
|
if ($(parent).hasClass('correntQue') || $(parent).hasClass('boxQue')) {
|
|
|
- uHtml.innerHTML = " ";
|
|
|
+ uHtml.innerHTML = " ";
|
|
|
}
|
|
|
}
|
|
|
uHtml.setAttribute("data-text", uHtml.innerText);
|
|
|
@@ -226,25 +226,18 @@ function bindEventYS() {
|
|
|
var checkId = 0;
|
|
|
var headid = -1;
|
|
|
var groupId = -1;
|
|
|
- $.each($(".multipleStart").nextUntil(".multipleEnd").filter("[class*='group']"), 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);
|
|
|
-
|
|
|
- var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
|
|
|
- var answerText = ischecked ? "√" : "";
|
|
|
- //勾选题
|
|
|
- if ($(item).hasClass('boxQue')) {
|
|
|
- $(item).find('.yaoshi').after("<div class='checkbox' answer-id='" + checkId + "' parent-anid='" + headid + "' answer-isky='2' answer-anstext=" + answerText + "><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
|
|
|
- $(item).find('input').prop('checked', ischecked);
|
|
|
- $(item).find('.underlineContent').hide();
|
|
|
- }
|
|
|
+ $(".multipleStart").each(function (i, item) {
|
|
|
+ $.each($(item).nextUntil(".multipleEnd").filter("[class*='group']"), 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);
|
|
|
+ });
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//显示/隐藏习题答案
|
|
|
$(".yaoshi").on("click", function () {
|
|
|
var ParentAnid = $(this).attr("parent-anid");
|
|
|
@@ -355,6 +348,51 @@ function handleAnswerRange() {
|
|
|
//规范文本格式
|
|
|
var answerId = "";
|
|
|
var tempJson = new Array();
|
|
|
+ //先处理一题多空的情况,获取两个之间的答题点
|
|
|
+ $(".multipleStart").each(function (i, item) {
|
|
|
+ $.each($(item).nextUntil(".multipleEnd").filter("[class*='group']"), function (index, item) {
|
|
|
+ var checkId = $(item).find('.yaoshi').attr("answer-id");
|
|
|
+ var headid = $(item).find('.yaoshi').attr("parent-anid");
|
|
|
+ var ischecked = $(item).find(".underlineContent").text().indexOf("√") > -1;
|
|
|
+ var answerText = ischecked ? "√" : "";
|
|
|
+ //勾选题
|
|
|
+ if ($(item).hasClass('boxQue')) {
|
|
|
+ $(item).find('.yaoshi').after("<div class='checkbox' answer-id='" + checkId + "' parent-anid='" + headid + "' answer-isky='2' answer-anstext=" + answerText + "><input id=" + checkId + " type='checkbox'><label for=" + checkId + "></label></div>");
|
|
|
+ //$(item).find('input').prop('checked', ischecked);
|
|
|
+ $(item).find('.underlineContent').hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ $(item).find('input').bind("click", function () {
|
|
|
+ var curObj = new Object();
|
|
|
+ curObj.Id = $(this).parent().attr("answer-id");//答题点ID
|
|
|
+ curObj.pId = $(this).parent().attr("parent-anid");//答题点ID
|
|
|
+ curObj.IsKY = $(this).parent().attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
|
|
|
+ //curObj.Text = $(this).parent().attr("answer-text");//用户作答内容
|
|
|
+ curObj.Score = $(this).parent().attr("answer-score");//作答评分
|
|
|
+ curObj.AnsText = $(this).parent().attr("answer-anstext");//参考答案
|
|
|
+ curObj.Comment = $(this).parent().attr("answer-comment");//评语
|
|
|
+ curObj.pId = curObj.pId ? curObj.pId : curObj.Id;//组ID
|
|
|
+ curObj.Text = $(this).prop("checked") ? "√" : "";//用户作答内容
|
|
|
+ $(this).parent().attr("answer-text", curObj.Text);//用户作答内容
|
|
|
+
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(this).parent().addClass("select-answer");
|
|
|
+
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).parent().data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //删除钥匙节点
|
|
|
+ $(item).find('.yaoshi').remove();
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
//所有underline不做处理
|
|
|
$.each($(".yaoshi").nextUntil(".yaoshi").filter(".underline"), function (index, item) {
|
|
|
@@ -494,42 +532,6 @@ function handleAnswerRange() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //获取两个之间的答题点
|
|
|
- var index = 1;
|
|
|
- var checkId = 0;
|
|
|
- $.each($(".multipleStart").nextUntil(".multipleEnd").filter("[class*='group']"), function (index, item) {
|
|
|
- $(item).find('input').removeAttr("onclick");
|
|
|
- $(item).find('input').prop('checked', false);
|
|
|
- $(item).find('input').bind("click", function () {
|
|
|
- var curObj = new Object();
|
|
|
- curObj.Id = $(this).parent().attr("answer-id");//答题点ID
|
|
|
- curObj.pId = $(this).parent().attr("parent-anid");//答题点ID
|
|
|
- curObj.IsKY = $(this).parent().attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题,2-打勾题
|
|
|
- //curObj.Text = $(this).parent().attr("answer-text");//用户作答内容
|
|
|
- curObj.Score = $(this).parent().attr("answer-score");//作答评分
|
|
|
- curObj.AnsText = $(this).parent().attr("answer-anstext");//参考答案
|
|
|
- curObj.Comment = $(this).parent().attr("answer-comment");//评语
|
|
|
- curObj.pId = curObj.pId ? curObj.pId : curObj.Id;//组ID
|
|
|
- curObj.Text = $(this).prop("checked") ? "√" : "";//用户作答内容
|
|
|
-
|
|
|
- $(".checkbox").removeClass("select-answer");
|
|
|
- $(".answer-body").removeClass("select-answer");
|
|
|
- $(this).parent().addClass("select-answer");
|
|
|
-
|
|
|
- //已作答,弹出作答答案
|
|
|
- if ($(this).parent().data("ans-status") == "1") {
|
|
|
- //移动端添加外部处理
|
|
|
- onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
- }
|
|
|
- else {
|
|
|
- //移动端添加外部处理,弹出作答操作
|
|
|
- onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
- }
|
|
|
- });
|
|
|
- //删除钥匙节点
|
|
|
- $(item).find('.yaoshi').remove();
|
|
|
- });
|
|
|
-
|
|
|
//添加答题点的点击UI及交互
|
|
|
$.each($(".tag-span"), function (index, item) {
|
|
|
var answerText = "";
|
|
|
@@ -654,13 +656,23 @@ function getAllAnswer() {
|
|
|
$(item).children(".answer-text").addClass("no-answer");
|
|
|
}
|
|
|
});
|
|
|
- $("input[type=checkbox]").unbind("click");
|
|
|
- $("input[type=checkbox]").removeAttr("onclick");
|
|
|
- $("input[type=checkbox]").addr("disabled", "disabled");
|
|
|
$(".answer-body").removeClass("select-answer");//移除样式
|
|
|
$(".answer-body").unbind("click");//取消点击绑定事件
|
|
|
$(".answer-body").children(".answer-audio-range").children("span").unbind("click");//取消点击绑定事件
|
|
|
|
|
|
+ //打勾题的还原
|
|
|
+ $.each($(".checkbox"), function (num, item) {
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ var parentid = $(item).attr("parent-anid");
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = $(item).attr("answer-text");//我的答案
|
|
|
+ var ischecked = mytext.indexOf("√") > -1;
|
|
|
+ var answerText = $(item).attr("answer-anstext");//参考答案
|
|
|
+
|
|
|
+ mytext = mytext == "" ? "__" : mytext;
|
|
|
+ $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' parent-anid='" + parentid + "' answer-anstext='" + answerText + "' answer-isky='2'><div class='answer-audio-range'><img src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' style='display:none;'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div><buttom class='answer-text' style='display:block;'>" + mytext + "</buttom></div>");
|
|
|
+ });
|
|
|
+
|
|
|
return answerData;
|
|
|
}
|
|
|
|
|
|
@@ -776,6 +788,7 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
//查找
|
|
|
var index = 0;
|
|
|
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;
|
|
|
@@ -786,22 +799,45 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
//提交直接还原作答现场
|
|
|
var mytext = answerList[index].Text;//我的答案
|
|
|
var ischecked = mytext.indexOf("√") > -1;
|
|
|
-
|
|
|
+ var answerText = $(item).attr("answer-anstext");//参考答案
|
|
|
+
|
|
|
$(item).attr("answer-text", mytext);
|
|
|
$(item).find('input').prop('checked', ischecked);
|
|
|
|
|
|
- //已提交,作答还原
|
|
|
- if (statusType == 1) {
|
|
|
- $("input[type=checkbox]").unbind("click");
|
|
|
- $("input[type=checkbox]").removeAttr("onclick");
|
|
|
- $("input[type=checkbox]").attr("disabled", "disabled");
|
|
|
- }
|
|
|
- //已评阅,查看评阅详情
|
|
|
- if (statusType == 2) {
|
|
|
- $("input[type=checkbox]").attr("disabled", "disabled");
|
|
|
- //$("input[type=checkbox]").attr("onclick", "this.checked=!this.checked");
|
|
|
+ //已提交,已评阅,还原HTML代码,去除checkbox
|
|
|
+ if (statusType == 1 || statusType == 2) {
|
|
|
+ mytext = mytext == "" ? "__" : mytext;
|
|
|
+ $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' parent-anid='" + parentid + "' answer-anstext='" + answerText + "' answer-isky='2'><div class='answer-audio-range'><img src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' style='display:none;'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div><buttom class='answer-text' style='display:block;'>" + mytext + "</buttom></div>");
|
|
|
}
|
|
|
});
|
|
|
+ //点击事件重新绑定
|
|
|
+ if (statusType == 0 || statusType == 2) {
|
|
|
+ $(".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");//评语
|
|
|
+ curObj.pId = curObj.pId ? curObj.pId : curObj.Id;//组ID
|
|
|
+
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(this).addClass("select-answer");
|
|
|
+
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -901,6 +937,7 @@ function backupAllReview(answerJson) {
|
|
|
//查找
|
|
|
var index = 0;
|
|
|
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;
|
|
|
@@ -911,10 +948,35 @@ function backupAllReview(answerJson) {
|
|
|
//提交直接还原作答现场
|
|
|
var mytext = answerList[index].Text;//我的答案
|
|
|
var ischecked = mytext.indexOf("√") > -1;
|
|
|
+ var answerText = $(item).attr("answer-anstext");//参考答案
|
|
|
+ mytext = mytext == "" ? "__" : mytext;
|
|
|
+ $(item).prop("outerHTML", "<div class='answer-body' answer-id='" + answerid + "' parent-anid='" + parentid + "' answer-anstext='" + answerText + "' answer-isky='2'><div class='answer-audio-range'><img src='" + PicInfo.recordPlayImgUrl + "'/><span class='answer-audio-text'>作答音频</span></div><div class='answer-point-range' style='display:none;'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answer-point-text'>答题点</span></div><buttom class='answer-text' style='display:block;'>" + mytext + "</buttom></div>");
|
|
|
+ });
|
|
|
+ //点击事件重新绑定
|
|
|
+ $(".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");//评语
|
|
|
+ curObj.pId = curObj.pId ? curObj.pId : curObj.Id;//组ID
|
|
|
|
|
|
- $(item).attr("answer-text", mytext);
|
|
|
- $(item).find('input').prop('checked', ischecked);
|
|
|
- $("input[type=checkbox]").attr("disabled", "disabled");
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
+ $(".answer-body").removeClass("select-answer");
|
|
|
+ $(this).addClass("select-answer");
|
|
|
+
|
|
|
+ //已作答,弹出作答答案
|
|
|
+ if ($(this).data("ans-status") == "1") {
|
|
|
+ //移动端添加外部处理
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //移动端添加外部处理,弹出作答操作
|
|
|
+ onClickAnswerPoint(JSON.stringify(curObj));
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|