|
|
//*************************
|
|
|
//理论成绩管理 ---成绩评定
|
|
|
//*************************
|
|
|
|
|
|
$(function () {
|
|
|
//获取列表
|
|
|
var PaperId = $.getUrlParam("PaperId");
|
|
|
var UserId = $.getUrlParam("UserId");
|
|
|
var ExamName = $.getUrlParam("ExamName")
|
|
|
//获取题型
|
|
|
GetPaperDetailList(PaperId, UserId);
|
|
|
//获取列表
|
|
|
LoadSubjectNum(PaperId, UserId,"",1);
|
|
|
//获取当前题目
|
|
|
LoadSubjectContent(PaperId, UserId);
|
|
|
|
|
|
|
|
|
|
|
|
//题目编号进行单机事件
|
|
|
$("#OptionSub span[spantag='charpter']").unbind("click").bind("click", function () {
|
|
|
$("#OptionSub span[spantag='charpter']").each(function (i, d) {
|
|
|
$(this).removeClass("active");
|
|
|
});
|
|
|
$(this).addClass("active");
|
|
|
var questionType = $(this).attr("spanflag");
|
|
|
//同时从新加载题型
|
|
|
LoadSubjectNum(PaperId, UserId, questionType);
|
|
|
LoadSubjectContent(PaperId, UserId, questionType);
|
|
|
|
|
|
});
|
|
|
//清空文本框
|
|
|
ClearText();
|
|
|
|
|
|
var obj = new Object();
|
|
|
//给得分注册unblur事件
|
|
|
$("#SetScore").unbind("blur").blur(function () {
|
|
|
//先要验证不为空 且不能大于相应分数
|
|
|
var NowScore = $(this).val();
|
|
|
var AnalysisTwo = $("#AnalysisTwo").val();
|
|
|
if (!VerificationHelper.checkFrom("AccurateAnswerTwo",
|
|
|
function () {
|
|
|
var score = $("#OptionSub .active").attr("subjectscore") * 1;//或得标准分
|
|
|
if (NowScore > score) {
|
|
|
showValidateMsg("SetScore", "分数必须小于等于标准分");
|
|
|
};
|
|
|
})) {
|
|
|
} else {
|
|
|
var QuestionId = $("#question_list_content .current").attr("spanflag");//问题id
|
|
|
obj["TeacScore"] = NowScore;//或的教师分数
|
|
|
obj["QuestionId"] = QuestionId;
|
|
|
obj["PaperId"] = PaperId;
|
|
|
obj["UserId"] = UserId;
|
|
|
obj["TeacAnalyse"] = AnalysisTwo;
|
|
|
//否则你就保存到数据
|
|
|
SaveScore(obj);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#CaptionContent #AnalysisTwo").unbind("blur").blur(function () {
|
|
|
var QuestionId = $("#question_list_content .current").attr("spanflag");//问题id
|
|
|
var NowScore = $("#SetScore").val();
|
|
|
var AnalysisTwo = $("#AnalysisTwo").val();
|
|
|
obj["TeacScore"] = NowScore;//或的教师分数
|
|
|
obj["QuestionId"] = QuestionId;
|
|
|
obj["PaperId"] = PaperId;
|
|
|
obj["UserId"] = UserId;
|
|
|
obj["TeacAnalyse"] = AnalysisTwo;
|
|
|
if (!VerificationHelper.checkFrom("AccurateAnswerTwo", function () {
|
|
|
var score = $("#OptionSub .active").attr("subjectscore")*1;//或得标准分
|
|
|
if (NowScore > score) {
|
|
|
showValidateMsg("SetScore", "分数必须小于等于标准分");
|
|
|
};
|
|
|
})) {
|
|
|
} else {
|
|
|
|
|
|
SaveScore(obj);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//点击按钮提交
|
|
|
$("#btnResult").unbind("click").bind("click", function () {
|
|
|
var QuestionId = $("#question_list_content .current").attr("spanflag");//问题id
|
|
|
var NowScore = $("#SetScore").val();
|
|
|
obj["TeacScore"] = NowScore;//或的教师分数
|
|
|
obj["QuestionId"] = QuestionId;
|
|
|
obj["PaperId"] = PaperId;
|
|
|
obj["UserId"] = UserId;
|
|
|
var statu = $("#AccurateAnswerTwo").css("display");
|
|
|
if (statu == "block") {
|
|
|
|
|
|
if (!VerificationHelper.checkFrom("AccurateAnswerTwo",
|
|
|
function () {
|
|
|
var score = $("#OptionSub .active").attr("subjectscore")*1;//或得标准分
|
|
|
if (NowScore > score) {
|
|
|
showValidateMsg("SetScore", "分数必须小于等于标准分");
|
|
|
};
|
|
|
})) {
|
|
|
} else {
|
|
|
SaveJump(obj, ExamName);
|
|
|
}
|
|
|
} else {
|
|
|
SaveJump(obj, ExamName);
|
|
|
}
|
|
|
});
|
|
|
//禁用按钮
|
|
|
disablebutton(true);
|
|
|
|
|
|
$("#btnNext").unbind("click").bind("click", function () {
|
|
|
var bo = false;
|
|
|
var NowScore = $("#SetScore").val();
|
|
|
if ($("#AccurateAnswerTwo").css("display") != "none") {
|
|
|
if (!VerificationHelper.checkFrom("CaptionContent")) {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
if (!VerificationHelper.checkFrom("AccurateAnswerTwo",
|
|
|
function () {
|
|
|
var score = $("#OptionSub .active").attr("subjectscore") * 1;//或得标准分
|
|
|
if (NowScore > score) {
|
|
|
showValidateMsg("SetScore", "分数必须小于等于标准分");
|
|
|
bo = true;
|
|
|
};
|
|
|
}));
|
|
|
}
|
|
|
if (bo) {
|
|
|
return false;
|
|
|
};
|
|
|
var obj = GetSpanIndex();
|
|
|
var QuestionId = obj[1];
|
|
|
var QuestionIdTow = 0;
|
|
|
var index = obj.index;
|
|
|
QuestionIdTow = $("#question_list_content span[spanflag='" + QuestionId + "']").next().attr("spanflag");
|
|
|
LoadSubjectContent(PaperId, UserId, "", QuestionIdTow)
|
|
|
$("#question_list_content span[spanflag='" + QuestionId + "']").removeClass("current").next().addClass("current")
|
|
|
//禁用按钮
|
|
|
disablebutton();
|
|
|
|
|
|
});
|
|
|
|
|
|
$("#btnPrev").unbind("click").bind("click", function () {
|
|
|
|
|
|
var bo = false;
|
|
|
var NowScore = $("#SetScore").val();
|
|
|
if ($("#AccurateAnswerTwo").css("display") != "none") {
|
|
|
if (!VerificationHelper.checkFrom("CaptionContent")) {
|
|
|
return false;
|
|
|
};
|
|
|
if (!VerificationHelper.checkFrom("AccurateAnswerTwo",
|
|
|
function () {
|
|
|
var score = $("#OptionSub .active").attr("subjectscore") * 1;//或得标准分
|
|
|
if (NowScore > score) {
|
|
|
showValidateMsg("SetScore", "分数必须小于等于标准分");
|
|
|
bo = true;
|
|
|
};
|
|
|
}));
|
|
|
};
|
|
|
if (bo) {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
var obj = GetSpanIndex();
|
|
|
var QuestionId = obj[1];
|
|
|
var QuestionIdTow = 0;
|
|
|
var index = obj.index;
|
|
|
QuestionIdTow = $("#question_list_content span[spanflag='" + QuestionId + "']").prev().attr("spanflag");
|
|
|
LoadSubjectContent(PaperId, UserId, "", QuestionIdTow)
|
|
|
$("#question_list_content span[spanflag='" + QuestionId + "']").removeClass("current").prev().addClass("current")
|
|
|
//禁用按钮
|
|
|
disablebutton();
|
|
|
});
|
|
|
|
|
|
|
|
|
//点击取消按钮
|
|
|
$("#btnCancel").unbind("click").bind("click", function () {
|
|
|
window.location.href = "/Teacher/TheoryQuestion/ResultEveluate?PaperId=" + PaperId + "&ExamName=" + escape(ExamName);
|
|
|
});
|
|
|
|
|
|
|
|
|
//$("#btnNextSub").unbind("click").bind("click", function () {
|
|
|
// MoveHandel()
|
|
|
//});
|
|
|
|
|
|
//$("#btnPrevSub").bind("click").bind("click", function () {
|
|
|
// MoveHandel()
|
|
|
//});
|
|
|
|
|
|
});
|
|
|
//刷新题目编号
|
|
|
function refreshSubject() {
|
|
|
$("#CaptionContent #SubjectNum").html("");
|
|
|
var subNum = $("#question_list_content .current").attr("spannum");
|
|
|
|
|
|
if (subNum != null) {
|
|
|
$("#CaptionContent #SubjectNum").append("<span>" + subNum + "</span>");
|
|
|
} else {
|
|
|
$("#CaptionContent #SubjectNum").append("<span>1</span>");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//上下按钮调用事件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//禁用按钮
|
|
|
function disablebutton(tag) {
|
|
|
if (typeof tag != "undefined") {
|
|
|
$("#btnPrev").removeClass("btn-blue").attr("disabled", true);
|
|
|
}
|
|
|
var falg = 0;
|
|
|
$("#question_list_content span[spantag='subjectnum']").each(function (index, dom) {
|
|
|
var len = $("#question_list_content span[spantag='subjectnum']").length - 1;
|
|
|
if ($(this).hasClass("current") && index == 0) {
|
|
|
$("#btnPrev").removeClass("btn-blue").attr("disabled", true);
|
|
|
$("#btnNext").addClass("btn-blue").attr("disabled", false);
|
|
|
falg = 1;
|
|
|
}
|
|
|
if ($(this).hasClass("current") && index == len) {
|
|
|
$("#btnNext").removeClass("btn-blue").attr("disabled", true);
|
|
|
$("#btnPrev").addClass("btn-blue").attr("disabled", false);
|
|
|
falg = 2;
|
|
|
}
|
|
|
});
|
|
|
if (falg == 0&&tag ==undefined) {
|
|
|
$("#btnNext").addClass("btn-blue").attr("disabled", false);
|
|
|
$("#btnPrev").addClass("btn-blue").attr("disabled", false);
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
//获取到span的个数
|
|
|
function GetSpanIndex() {
|
|
|
var obj = new Array();
|
|
|
$("#question_list_content span[spantag='subjectnum']").each(function (index, dom) {
|
|
|
var num = index;
|
|
|
if ($(this).hasClass("current")) {
|
|
|
var QuestionId= $(this).attr("spanflag")
|
|
|
obj[0] = index;
|
|
|
obj[1] = QuestionId;
|
|
|
return false;
|
|
|
};
|
|
|
});
|
|
|
return obj;
|
|
|
}
|
|
|
|
|
|
|
|
|
//直接保存
|
|
|
function SaveScore(obj) {
|
|
|
//否则你就保存到数据
|
|
|
$.ajax({
|
|
|
url: "/Teacher/TheoryQuestion/SetAnswerResult",
|
|
|
async: false,
|
|
|
type: "POST",
|
|
|
data: JSON.stringify(obj),
|
|
|
contentType: "application/json",
|
|
|
success: function (data) {
|
|
|
if (data == 0) {
|
|
|
dialogHelper.Error({
|
|
|
content: "保存失败"
|
|
|
})
|
|
|
} else {
|
|
|
$("#question_list_content .current").addClass("finish");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
//保存且跳转
|
|
|
function SaveJump(obj, ExamName) {
|
|
|
|
|
|
//否则你就保存到数据
|
|
|
$.ajax({
|
|
|
url: "/Teacher/TheoryQuestion/SetUserSummay",
|
|
|
async: false,
|
|
|
type: "POST",
|
|
|
data: JSON.stringify(obj),
|
|
|
contentType: "application/json",
|
|
|
success: function (data) {
|
|
|
if (data.Result == false) {
|
|
|
dialogHelper.Confirm({
|
|
|
content: "尚有未评分部分,是否确定退出?", success: function () {
|
|
|
window.location.href = "/Teacher/TheoryQuestion/ResultEveluate?PaperId=" + obj.PaperId + "&ExamName=" +escape(ExamName);
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
if (data.Tag == false) {
|
|
|
window.location.href = "/Teacher/TheoryQuestion/ResultEveluate?PaperId=" + obj.PaperId + "&ExamName=" + escape(ExamName);
|
|
|
} else {
|
|
|
window.location.href = "/Teacher/TheoryQuestion/ResultList";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//加载所有章节选项
|
|
|
function GetPaperDetailList(PaperId, userId) {
|
|
|
var async = true;
|
|
|
//题型选中样式
|
|
|
$.ajax({
|
|
|
url: "/Teacher/TheoryQuestion/GetPaperDetailList",
|
|
|
async: false,
|
|
|
type: "POST",
|
|
|
data: {
|
|
|
|
|
|
PaperId: PaperId,
|
|
|
userId: userId
|
|
|
},
|
|
|
success: function (data) {
|
|
|
//if (!$.checkSignIn(data)) return;
|
|
|
|
|
|
if (data != null && data != "") {
|
|
|
$("#OptionSub").html("");
|
|
|
var QID = 0;
|
|
|
var shtml = "";
|
|
|
//加载题目 <span class="">多选题</span>
|
|
|
$(data).each(function (index, dom) {
|
|
|
if (index == 0) {
|
|
|
shtml += "<span id=\"span_" + dom.Id + "\" spanflag=\"" + dom.CharpterID + "\" subjectscore=\"" + dom.Score + "\" spantag=\"charpter\" class=\"active\">" + dom.CharpterName + "</span>";
|
|
|
} else {
|
|
|
shtml += "<span id=\"span_" + dom.Id + "\" spanflag=\"" + dom.CharpterID + "\" subjectscore=\"" + dom.Score + "\" spantag=\"charpter\" class=\"\">" + dom.CharpterName + "</span>";
|
|
|
};
|
|
|
});
|
|
|
$("#OptionSub").html(shtml);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//获取题目序号
|
|
|
function LoadSubjectNum(PaperId, UserId, questionType, isStar) {
|
|
|
if (typeof isStar == undefined) {
|
|
|
isStar = null;//ispostback
|
|
|
}
|
|
|
$.ajax({
|
|
|
url: "/Teacher/TheoryQuestion/LoadSubjectNum",
|
|
|
type: "POST",
|
|
|
async: true,
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
data:
|
|
|
{
|
|
|
PaperId: PaperId,
|
|
|
userId: UserId,
|
|
|
questionType: questionType,
|
|
|
IsStart: isStar
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data != null && data != "") {
|
|
|
$("#question_list_content").html("");
|
|
|
var spanHtml = "";
|
|
|
$(data.QuestionsListId).each(function (index, dom) {
|
|
|
var clacIndex = index + 1;
|
|
|
if (index == 0) { //初始。
|
|
|
if (dom.ReviseResult == true) {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"finish current comfirst\">" + clacIndex + "</span>";
|
|
|
} else {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"current comfirst\">" + clacIndex + "</span>";
|
|
|
}
|
|
|
} else {
|
|
|
if (index == data.QuestionsListId.length - 1) {
|
|
|
if (dom.ReviseResult == true) {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"finish comlast\">" + clacIndex + "</span>";
|
|
|
} else {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"comlast\">" + clacIndex + "</span>";
|
|
|
}
|
|
|
} else {
|
|
|
if (dom.ReviseResult == true) {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"finish\">" + clacIndex + "</span>";
|
|
|
} else {
|
|
|
spanHtml += "<span id=\"span_" + dom.Id + "\" spanFlag=\"" + dom.Id + "\" spantag=\"subjectnum\" spanNum =\"" + clacIndex + "\" class=\"\">" + clacIndex + "</span>";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
$("#question_list_content").html(spanHtml);
|
|
|
|
|
|
//$("#btnNext").addClass("btn-blue").attr("disabled", false);
|
|
|
//$("#btnPrev").addClass("btn-blue").attr("disabled", false);
|
|
|
//题目编号进行点击事件
|
|
|
$("#question_list_content span[spantag='subjectnum']").unbind("click").bind("click", function () {
|
|
|
$("#question_list_content span[spantag='subjectnum']").each(function (i, d) {
|
|
|
$(this).removeClass("current");
|
|
|
});
|
|
|
$(this).addClass("current");
|
|
|
var QuestionId = $(this).attr("spanflag");
|
|
|
disablebutton();
|
|
|
//同时加载对应的题目
|
|
|
LoadSubjectContent(PaperId, UserId, "", QuestionId);
|
|
|
});
|
|
|
|
|
|
//直接给对应的题目编号固定死
|
|
|
$("#CaptionContent #SubjectNum").html("");
|
|
|
$("#CaptionContent #SubjectNum").append("<span>1</span>");
|
|
|
|
|
|
if ($("#question_list_content span").length == 1) {
|
|
|
$("#btnPrev").removeClass("btn-blue").attr("disabled", true);
|
|
|
$("#btnNext").removeClass("btn-blue").attr("disabled", true);
|
|
|
} else {
|
|
|
disablebutton();
|
|
|
}
|
|
|
//禁用按钮
|
|
|
//disablebutton();
|
|
|
|
|
|
//$("#btnNext").unbind("click").bind("click", function () {
|
|
|
// var obj = GetSpanIndex();
|
|
|
// var QuestionId = obj.QuestionId;
|
|
|
// var QuestionIdTow = 0;
|
|
|
// var index = obj.index;
|
|
|
// QuestionIdTow = $("#question_list_content span[spanflag='" + QuestionId + "']").next().attr("spanflag");
|
|
|
// alert(QuestionIdTow);
|
|
|
// //LoadSubjectContent(PaperId, userId, "", QuestionId)
|
|
|
//});
|
|
|
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
//获取当前题目
|
|
|
function LoadSubjectContent(PaperId, userId, chaptionId, QuestionId) {
|
|
|
|
|
|
$("#divfujian").hide();
|
|
|
$("#AnalysisMain").hide();
|
|
|
|
|
|
$.ajax({
|
|
|
url: "/Teacher/TheoryQuestion/LoadSubjectContent",
|
|
|
type: "POST",
|
|
|
async: true,
|
|
|
dataType: "json",
|
|
|
crossDomain: false,
|
|
|
data:
|
|
|
{
|
|
|
QuestionId: QuestionId,
|
|
|
PaperId: PaperId,
|
|
|
userId: userId,
|
|
|
chaptionId: chaptionId
|
|
|
},
|
|
|
success: function (data) {
|
|
|
if (data.QuestionResult != null && data.QuestionResult != "") {
|
|
|
var QuestionResult = data.QuestionResult; //题目
|
|
|
var Context = QuestionResult.Context;
|
|
|
//加载题干
|
|
|
$("#Context").val(Context);
|
|
|
|
|
|
//附件
|
|
|
var libraryID = QuestionResult.LibraryID;
|
|
|
if (libraryID == 1)
|
|
|
{
|
|
|
var html = "";
|
|
|
if (QuestionResult.AttachmentList!=null){
|
|
|
// if (QuestionResult.AttachmentList.length>0) {
|
|
|
if (QuestionResult.AttachmentList.length > 0) {
|
|
|
$("#divfujian").show();
|
|
|
$.each(QuestionResult.AttachmentList, function (i, item) {
|
|
|
|
|
|
var lastIndex = item.Name.lastIndexOf("\\");
|
|
|
var fullName = item.Name.substring(lastIndex + 1);
|
|
|
var _index = fullName.lastIndexOf(".");
|
|
|
var name = fullName.substring(0, _index);
|
|
|
|
|
|
html += " <a href=\"#\" onclick=\"DownLoad('" + item.FileUrl + "','" + name + "','" + item.Id + "')\"><img src=\"/Content/images/text-icon.png\"><span>附件" + i + 1 + "</span></a>";
|
|
|
});
|
|
|
$(".accessory").html(html);
|
|
|
}
|
|
|
} else {
|
|
|
$("#divfujian").hide();
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
$("#divfujian").hide();
|
|
|
}
|
|
|
|
|
|
|
|
|
//选项及题目
|
|
|
var OptionList = QuestionResult.OptionList;
|
|
|
var trhtml = "";
|
|
|
if (QuestionResult.StructType == 1) {
|
|
|
$("#AccurateAnswer").show(); //隐藏
|
|
|
$("#AccurateAnswerTwo").hide();//加载
|
|
|
if (QuestionResult.Analysis != null) {
|
|
|
$("#AnalysisMain").show();
|
|
|
//解析隐藏}
|
|
|
}
|
|
|
$("#AnalysisMainTwo").hide();//评析显示
|
|
|
pageReturn();
|
|
|
$("#OptionList ul").html("");
|
|
|
//单选
|
|
|
var html1 = "";
|
|
|
|
|
|
$.each(QuestionResult.OptionList, function (i, item) {
|
|
|
// html1 += " <li><label><input value=" + (i) + " type='radio' id='radioStu_" + i + "' ratag=\"sturadio\">" + GetAnswerStr(i + 1) + "</label><div class='inputtext'>" + item.OptionName + "</div></li>";
|
|
|
html1 += " <li><label><input value=" + (i) + " type='radio' id='radioStu_" + i + "' ratag=\"sturadio\">" + GetAnswerStr(i + 1) + "</label> <input type='text' disabled='disabled' class='inputtext' style='overflow:hidden' value='" + item.OptionName + "' /></li>";
|
|
|
|
|
|
});
|
|
|
$("#OptionList ul").html(html1);
|
|
|
AnswerList(QuestionResult.AnswerList,1);//加载答案
|
|
|
AnalysisText(QuestionResult.Analysis);//加载解析
|
|
|
|
|
|
//如果学生答过这题表示可以查到
|
|
|
if (data.UserAnswer != null) {
|
|
|
StudentAnswer(data.UserAnswer, 1);
|
|
|
};
|
|
|
disabledHtml("CaptionContent",true,"",true,true)
|
|
|
} else if (QuestionResult.StructType == 2) {
|
|
|
$("#AccurateAnswer").show(); //隐藏
|
|
|
$("#AccurateAnswerTwo").hide();//加载
|
|
|
if (QuestionResult.Analysis != null) {
|
|
|
$("#AnalysisMain").show();
|
|
|
//解析隐藏}
|
|
|
}
|
|
|
$("#AnalysisMainTwo").hide();//评析显示
|
|
|
pageReturn();
|
|
|
$("#OptionList ul").html("");
|
|
|
//多选
|
|
|
var html2 = "";
|
|
|
$.each(QuestionResult.OptionList, function (i, item) {
|
|
|
html2 += " <li><label><input value=" + (i) + " type='checkbox' id='checkStu_" + i + "'>" + GetAnswerStr(i + 1) + "</label> <input type='text' disabled='disabled' class='inputtext' style='overflow:hidden' value='" + item.OptionName + "' /></li>";
|
|
|
});
|
|
|
$("#OptionList ul").html(html2);
|
|
|
AnswerList(QuestionResult.AnswerList,2);//加载答案
|
|
|
AnalysisText(QuestionResult.Analysis);//加载解析
|
|
|
|
|
|
|
|
|
//如果学生答过这题表示可以查到
|
|
|
if (data.UserAnswer != null) {
|
|
|
StudentAnswer(data.UserAnswer, 2);
|
|
|
};
|
|
|
disabledHtml("CaptionContent", "", true, true, true)
|
|
|
} else if (QuestionResult.StructType == 3) {
|
|
|
$("#AccurateAnswer").show(); //隐藏
|
|
|
$("#AccurateAnswerTwo").hide();//加载
|
|
|
if (QuestionResult.Analysis != null) {
|
|
|
$("#AnalysisMain").show();
|
|
|
//解析隐藏}
|
|
|
}
|
|
|
$("#AnalysisMainTwo").hide();//评析显示
|
|
|
pageReturn();
|
|
|
$("#OptionList ul").html("");
|
|
|
//判断
|
|
|
var html3 = "";
|
|
|
$.each(QuestionResult.OptionList, function (i, item) {
|
|
|
html3 += " <li><label><input value=" + (i) + " type='radio' id='judgeStu_" + i + "'>" + GetAnswerStr(i + 1) + "</label> <input type='text' disabled='disabled' class='inputtext' style='overflow:hidden' value='" + item.OptionName + "' /></li>";
|
|
|
});
|
|
|
$("#OptionList ul").html(html3);
|
|
|
AnswerList(QuestionResult.AnswerList, 3);//加载答案
|
|
|
AnalysisText(QuestionResult.Analysis);//加载解析
|
|
|
|
|
|
|
|
|
//如果学生答过这题表示可以查到
|
|
|
if (data.UserAnswer != null) {
|
|
|
StudentAnswer(data.UserAnswer, 3);
|
|
|
};
|
|
|
disabledHtml("CaptionContent", true, "", true, true)
|
|
|
|
|
|
} else {
|
|
|
$("#AccurateAnswer").hide(); //隐藏
|
|
|
$("#AccurateAnswerTwo").show();//加载
|
|
|
//if (QuestionResult.Analysis != null) {
|
|
|
// // $("#AnalysisMain").show();
|
|
|
// //解析隐藏}
|
|
|
//}
|
|
|
$("#AnalysisMainTwo").show();//评析显示
|
|
|
$("#SetScore").attr("disabled", false);
|
|
|
$("#AnalysisTwo").attr("disabled", false);
|
|
|
//先清空文本框
|
|
|
ClearText();
|
|
|
//解除屏蔽
|
|
|
disEnabled("CaptionContent");
|
|
|
|
|
|
$("#OptionList").html("");//清空
|
|
|
$("#OptionList").html("<div class=\"ml53\"> <textarea id=\"StuAnalysis\" style=\"background-color: #e9e9e9\"></textarea></div>");
|
|
|
//改变文字答案
|
|
|
$("#OptionListMain strong").text("答案:");
|
|
|
//然后给里面加入答案
|
|
|
// $("#AnalysisMain strong").text("评析:");
|
|
|
//如果学生答过这题表示可以查到
|
|
|
if (data.UserAnswer.length > 0) {
|
|
|
StudentAnswer(data.UserAnswer, QuestionResult.StructType);
|
|
|
//同时如果老师给了分
|
|
|
if (data.UserAnswerResult != null) {
|
|
|
var teacherScore = data.UserAnswerResult.UserScore == null ? "" : data.UserAnswerResult.UserScore;
|
|
|
$("#SetScore").val(teacherScore);
|
|
|
$("#AnalysisTwo").val(data.UserAnswerResult.Analyse);
|
|
|
};
|
|
|
} else {
|
|
|
//如果查到学生没做这道题那么
|
|
|
$("#SetScore").val(0);
|
|
|
$("#SetScore").attr("disabled", true);
|
|
|
$("#AnalysisTwo").attr("disabled", true);
|
|
|
}
|
|
|
|
|
|
//附件
|
|
|
|
|
|
|
|
|
$("#AnalysisMain textarea").val("");
|
|
|
//加载屏蔽
|
|
|
disabledHtml("ContextMain", "", "", "", true);
|
|
|
$("#OptionListMain textarea").attr("readonly", true);
|
|
|
|
|
|
$("#AccurateAnswerTwo strong").html("");
|
|
|
var score= $("#OptionSub .active").attr("subjectscore")*1;
|
|
|
//给个标准分
|
|
|
var trhtml = "标准分:<span tag=\"" + score + "\">" + score + " 分</span>";
|
|
|
// var trhtml = "<strong>标准分:" + score + " 分</strong>";
|
|
|
//trhtml += " <div class=\"item-info input right\" id=\"AnswerList\"><span class=\"red\">*<span>得分:<input id=\"SetScore\" class=\"ipt-text\" type=\"text\"></div>"
|
|
|
$("#AccurateAnswerTwo strong").html(trhtml);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
refreshSubject();
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
//选择题的时候 1,2,3
|
|
|
function pageReturn() {
|
|
|
$("#OptionListMain").html("");
|
|
|
var trhtml = "<strong><i class=\"c-red\">*</i>选项及答案:</strong>";
|
|
|
trhtml += "<div class=\"item-info\" id=\"OptionList\"> <ul></ul></div>"
|
|
|
$("#OptionListMain").html(trhtml);
|
|
|
trhtml = "";
|
|
|
//$("#AccurateAnswer").html("");
|
|
|
//trhtml = "<strong>标准答案:</strong>";
|
|
|
//trhtml += "<div class=\"item-info\" id=\"AnswerList\"></div>"
|
|
|
//$("#AccurateAnswer").html(trhtml);
|
|
|
// trhtml = "";
|
|
|
// $("#AnalysisMain strong").text("解析:");
|
|
|
}
|
|
|
|
|
|
//清空所有的文本框
|
|
|
function ClearText() {
|
|
|
$("#CaptionContent input[type='text']").val("");
|
|
|
$("#CaptionContent #SetScore").val("");
|
|
|
$("#CaptionContent #SetScore").next().remove();
|
|
|
$("#CaptionContent #AnalysisTwo").val("");
|
|
|
$("#CaptionContent #AnalysisTwo").next().remove();
|
|
|
}
|
|
|
|
|
|
|
|
|
//加载选择题答案列表
|
|
|
function AnswerList(answerList, StructType) {
|
|
|
$("#AnswerList").html("");
|
|
|
var trhtml = "";
|
|
|
if (StructType == 1 || StructType == 2) {
|
|
|
$(answerList).each(function (index, dom) {
|
|
|
if (dom.Answer1 != null) {
|
|
|
trhtml += "<lable>" + GetAnswerStr(dom.Answer1 + 1) + "</lable>";
|
|
|
}
|
|
|
});
|
|
|
} else if (StructType == 3) { //判断题
|
|
|
if (answerList[0].Answer1 != null) {
|
|
|
trhtml += "<lable>" + GetAnswerStr(answerList[0].Answer1 + 1) + "</lable>";
|
|
|
}
|
|
|
} else {
|
|
|
if (dom.Answer2 != null) {
|
|
|
trhtml += "<lable>" + GetAnswerStr(dom.Answer2 + 1) + "</lable>";
|
|
|
}
|
|
|
if (dom.Answer3 != null) {
|
|
|
trhtml += "<lable>" + GetAnswerStr(dom.Answer3 + 1) + "</lable>";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$("#AnswerList").html(trhtml);
|
|
|
};
|
|
|
|
|
|
//加载解析
|
|
|
function AnalysisText(analysis) {
|
|
|
$("#Analysis").val("");
|
|
|
var newAnalysis = analysis == null ? "" : analysis;
|
|
|
$("#Analysis").val(newAnalysis);
|
|
|
};
|
|
|
|
|
|
//学生答题
|
|
|
function StudentAnswer(userAnswer, StructType) {
|
|
|
var stuResult = new Array();
|
|
|
if (StructType == 1 || StructType == 2 || StructType == 3) {
|
|
|
$(userAnswer).each(function (index, dom) {
|
|
|
stuResult.push(dom.Answer1);
|
|
|
});
|
|
|
}
|
|
|
if (StructType == 1) { //单选
|
|
|
//然后将用户结果个导出
|
|
|
$(stuResult).each(function (index, dom) {
|
|
|
$("#radioStu_" + dom).attr("checked", true);
|
|
|
});
|
|
|
} else if (StructType == 2) { //多选
|
|
|
$(stuResult).each(function (index, dom) {
|
|
|
$("#checkStu_" + dom).attr("checked", true);
|
|
|
});
|
|
|
} else if (StructType == 3) { //判断
|
|
|
$(stuResult).each(function (index, dom) {
|
|
|
$("#judgeStu_" + dom).attr("checked", true);
|
|
|
});
|
|
|
} else if (StructType == 4) {
|
|
|
var AnswerU = userAnswer[0] == null ? "" : userAnswer[0].Answer2
|
|
|
$("#OptionList textarea").val(AnswerU);
|
|
|
} else {
|
|
|
var AnswerU2 = userAnswer[0] == null ? "" : userAnswer[0].Answer3
|
|
|
$("#OptionList textarea").val(AnswerU2);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//禁用相应对象 层 单选,多选,文本框,文本域
|
|
|
function disabledHtml(div,disRadio,disCheckedBox,inpuText,areaText) {
|
|
|
//禁用所有输入框 和选择框
|
|
|
if (inpuText != ""&&inpuText != undefined) {
|
|
|
$("#" + div + " input[type='text']").attr("readonly", true);
|
|
|
} else {
|
|
|
$("#" + div + " input[type='text']").attr("readonly", false);
|
|
|
}
|
|
|
if (disRadio != "" && disRadio != undefined) {
|
|
|
$("#" + div + " input[type='radio']").attr("disabled", true);
|
|
|
} else {
|
|
|
$("#" + div + " input[type='radio']").attr("disabled", false);
|
|
|
}
|
|
|
if (disCheckedBox != "" && disCheckedBox != undefined) {
|
|
|
$("#" + div + " input[type='checkbox']").attr("disabled", true);
|
|
|
} else {
|
|
|
$("#" + div + " input[type='checkbox']").attr("disabled", false);
|
|
|
}
|
|
|
if (areaText != "" && areaText != undefined) {
|
|
|
$("#" + div + " textarea").attr("readonly", true);
|
|
|
} else {
|
|
|
$("#" + div + " textarea").attr("readonly", false);
|
|
|
}
|
|
|
//$("#" + div + " select").attr("readonly", true);
|
|
|
//$("#" + div + " input[type='button']").unbind("click").removeAttr("onclick").attr("disabled", true);
|
|
|
}
|
|
|
|
|
|
//取消屏蔽事件
|
|
|
function disEnabled(div) {
|
|
|
|
|
|
$("#" + div + " input[type='text']").attr("readonly", false);
|
|
|
|
|
|
|
|
|
$("#" + div + " input[type='radio']").attr("disabled", false);
|
|
|
|
|
|
|
|
|
$("#" + div + " input[type='checkbox']").attr("disabled", false);
|
|
|
|
|
|
|
|
|
$("#" + div + " textarea").attr("readonly", false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取答案序号
|
|
|
function GetAnswerStr(index) {
|
|
|
var result = "";
|
|
|
switch (index) {
|
|
|
case 1:
|
|
|
result = "A";
|
|
|
break;
|
|
|
case 2:
|
|
|
result = "B";
|
|
|
break;
|
|
|
case 3:
|
|
|
result = "C";
|
|
|
break;
|
|
|
case 4:
|
|
|
result = "D";
|
|
|
break;
|
|
|
case 5:
|
|
|
result = "E";
|
|
|
break;
|
|
|
case 6:
|
|
|
result = "F";
|
|
|
break;
|
|
|
case 7:
|
|
|
result = "G";
|
|
|
break;
|
|
|
case 8:
|
|
|
result = "H";
|
|
|
break;
|
|
|
case 9:
|
|
|
result = "I";
|
|
|
break;
|
|
|
case 10:
|
|
|
result = "J";
|
|
|
break;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
//判断题是否正确
|
|
|
function GetJudgetAnswer(Answer) {
|
|
|
var result = "";
|
|
|
switch (Answer) {
|
|
|
case 1:
|
|
|
result = "对";
|
|
|
break
|
|
|
case 2:
|
|
|
result = "错";
|
|
|
break
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
//文件下载
|
|
|
function DownLoad(path, name, Id) {
|
|
|
|
|
|
location.href = "/Teacher/TheoryQuestion/DownloadFile?path=" + encodeURIComponent(path) + "&name=" + encodeURIComponent(name) + "&randomId=" + Math.random();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//移动手柄
|
|
|
function MoveHandel() {
|
|
|
$(".question-types").each(function(){
|
|
|
var wid = 65,//单个格子宽度
|
|
|
index = 1,//每次移动几个
|
|
|
$UI = $(this).children(".caption-list-title").children(".caption-switch").children("#OptionSub"),
|
|
|
$Pre = $(this).find(".prev"),
|
|
|
$Next = $(this).find(".next"),
|
|
|
Len = $UI.children("span").length,
|
|
|
Left = parseInt($UI.css("left"));
|
|
|
$Pre.click(function () {
|
|
|
Left = Left * 1 + index * wid;
|
|
|
if (Left > 0) {
|
|
|
Left = 0;
|
|
|
}
|
|
|
$UI.stop().animate({ left: Left });
|
|
|
});
|
|
|
$Next.click(function () {
|
|
|
Left -= wid * index;
|
|
|
if (Left < -wid * (Len - 4)) {
|
|
|
Left = -wid * (Len - 4);
|
|
|
}
|
|
|
$UI.stop().animate({ left: Left });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|