|
|
@@ -236,9 +236,10 @@ function bindEventYS() {
|
|
|
$(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'><input id=" + checkId + " type='checkbox' onclick=this.checked=!this.checked><label for=" + checkId + "></label></div>");
|
|
|
+ $(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();
|
|
|
}
|
|
|
@@ -379,6 +380,7 @@ function handleAnswerRange() {
|
|
|
$.each($(".yaoshi").nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
var info = new Object();
|
|
|
info.Id = $(item).prevAll(".yaoshi").attr("answer-id");
|
|
|
+ info.pId = $(item).prevAll(".yaoshi").attr("parent-anid");
|
|
|
//记录上一次的ID
|
|
|
if (info.Id == undefined) {
|
|
|
info.Id = answerId;
|
|
|
@@ -386,6 +388,9 @@ function handleAnswerRange() {
|
|
|
else {
|
|
|
answerId = info.Id;
|
|
|
}
|
|
|
+ if (info.pId == undefined) {
|
|
|
+ info.pId = answerId;
|
|
|
+ }
|
|
|
|
|
|
info.AnsText = $(item).text();
|
|
|
tempJson.push(info);
|
|
|
@@ -493,15 +498,33 @@ function handleAnswerRange() {
|
|
|
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);
|
|
|
- // $(item).find('.underlineContent').hide();
|
|
|
- //}
|
|
|
+ $(item).find('input').removeAttr("onclick");
|
|
|
+ $(item).find('input').prop('checked', false);
|
|
|
+ $(item).find('checkbox').bind("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-是口语题,2-打勾题
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ });
|
|
|
//删除钥匙节点
|
|
|
$(item).find('.yaoshi').remove();
|
|
|
});
|
|
|
@@ -530,12 +553,15 @@ function handleAnswerRange() {
|
|
|
$(".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");//评语
|
|
|
-
|
|
|
+ curObj.pId = curObj.pId ? curObj.pId : curObj.Id;//组ID
|
|
|
+
|
|
|
+ $(".checkbox").removeClass("select-answer");
|
|
|
$(".answer-body").removeClass("select-answer");
|
|
|
$(this).addClass("select-answer");
|
|
|
|
|
|
@@ -627,9 +653,12 @@ 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');//取消点击绑定事件
|
|
|
+ $(".answer-body").unbind("click");//取消点击绑定事件
|
|
|
+ $(".answer-body").children(".answer-audio-range").children("span").unbind("click");//取消点击绑定事件
|
|
|
|
|
|
return answerData;
|
|
|
}
|
|
|
@@ -638,7 +667,16 @@ function getAllAnswer() {
|
|
|
function backupAllAnswer(answerJson, statusType) {
|
|
|
if (answerJson != "" && answerJson) {
|
|
|
var answerList = JSON.parse(answerJson);
|
|
|
- $.each($(".answer-body"), function (index, item) {
|
|
|
+ $.each($(".answer-body"), function (num, item) {
|
|
|
+ //查找
|
|
|
+ var index = 0;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
//提交直接还原作答现场
|
|
|
var mytext = answerList[index].Text;//我的答案
|
|
|
answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
@@ -731,6 +769,38 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ //打勾题的还原
|
|
|
+ $.each($(".checkbox"), function (num, item) {
|
|
|
+ //可作答状态,作答还原
|
|
|
+ //查找
|
|
|
+ var index = 0;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ var ischecked = mytext.indexOf("√") > -1;
|
|
|
+
|
|
|
+ $(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");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -760,7 +830,17 @@ function reviewStuAnswer(answerJson) {
|
|
|
function backupAllReview(answerJson) {
|
|
|
if (answerJson != "" && answerJson) {
|
|
|
var answerList = JSON.parse(answerJson);
|
|
|
- $.each($(".answer-body"), function (index, item) {
|
|
|
+ $.each($(".answer-body"), function (num, item) {
|
|
|
+ //查找
|
|
|
+ var index = 0;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//$(item).attr("answer-id", answerList[index].Id);//答题点ID
|
|
|
//$(item).attr("answer-text", answerList[index].Text);//用户作答内容
|
|
|
$(item).attr("answer-score", answerList[index].Score);//作答评分
|
|
|
@@ -815,6 +895,26 @@ function backupAllReview(answerJson) {
|
|
|
$(item).children(".answer-text").addClass("good-answer");
|
|
|
}
|
|
|
});
|
|
|
+ //打勾题的还原
|
|
|
+ $.each($(".checkbox"), function (num, item) {
|
|
|
+ //查找
|
|
|
+ var index = 0;
|
|
|
+ var answerid = $(item).attr("answer-id");
|
|
|
+ for (var i = 0; i < answerList.length; i++) {
|
|
|
+ if (answerid == answerList[i].Id) {
|
|
|
+ index = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //提交直接还原作答现场
|
|
|
+ var mytext = answerList[index].Text;//我的答案
|
|
|
+ var ischecked = mytext.indexOf("√") > -1;
|
|
|
+
|
|
|
+ $(item).attr("answer-text", mytext);
|
|
|
+ $(item).find('input').prop('checked', ischecked);
|
|
|
+ $("input[type=checkbox]").attr("disabled", "disabled");
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -839,6 +939,9 @@ function scrollAnswer(answerid) {
|
|
|
//console.log(answerid);
|
|
|
$(".answer-body").removeClass("select-answer");
|
|
|
var ansDom = $(".answer-body[answer-id='" + answerid + "']");
|
|
|
+ if (ansDom.length == 0) {
|
|
|
+ ansDom = $(".checkbox[answer-id='" + answerid + "']");
|
|
|
+ }
|
|
|
$(ansDom).addClass("select-answer");
|
|
|
var scroll_offset = $(ansDom).offset(); //得到box这个div层的offset,包含两个值,top和left
|
|
|
var offset_top = scroll_offset.top;
|