kaoshixiangqing

This commit is contained in:
shilixia 2019-10-10 15:49:45 +08:00
parent 08e42ae7ad
commit 44fe311c69
5 changed files with 138 additions and 9 deletions

View File

@ -0,0 +1,121 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>答题详情</title>
<script type="text/javascript" src="/static/safesite/easyui/jquery.min.js"></script>
</head>
<body >
<div style="height:100%;overflow:auto;width:70%;background-color:lightcyan;margin:0 auto;">
<div id="examname" style="font-size: 36px;color: #73348a;text-align: center;margin-top: 30px;font-weight: bold;"></div>
<div style="height:200px" id="user">
</div>
<div id="examtype1"></div>
</div>
</body>
</html>
<script>
var id = {{id }};
var html;
alert(id);
$.ajax({
type: "get",
url: "/api/examtestdetail?a=detail",
data: { 'id': id },
dateType: "json",
success: function (data) {
document.getElementById("examname").innerHTML = data.examtest__name;
var divUserHtml = "";
divUserHtml += '<div style="margin-left:10px;padding-bottom:13px;float:left"><image style="margin: 10px 10px;" src=' + data.user__headimgurl + '></image></div>';
divUserHtml += '<div style="float:left;margin-top: 20px;margin-left:20px"><p>姓名:' + data.user__name + '</p><p>得分:' + data.score + '</p><p>是否通过:' + (data.passcode == 1 ? '通过' : '不通过') + '</p></div > ';
$("#user").append(divUserHtml);
for (var i = 1; i <= data.testdetail.length; i++) {
if (data.testdetail[i].question__type == 3)
{
var divHtml = "";
divHtml += '<div style="margin-left:30px;padding-bottom:13px">';
divHtml += '<span style="color:blue">' + "【判断题】</span></span>"+"第"+i+"题:" + data.testdetail[i].question__title +'</span>';
divHtml += '<span style=" margin-left: 40px; color:#d5cc1d;">此题得分:' + data.testdetail[i].iscore + ' 分</span>';
divHtml += '<br />';
divHtml += '<div style="margin-left: 80px;margin-top: 15px;"><span>A.' + data.testdetail[i].question__answer.A + '</span></br></br><span>B.' + data.testdetail[i].question__answer.B +'</span></div>';
divHtml += '<br />';
divHtml += '<div style="padding-left: 10px; padding-top: 10px;">';
divHtml += '<div style="color:green;">正确答案:' + data.testdetail[i].question__right + '</div>';
if (data.testdetail[i].iscore == 0) {
divHtml += '<div style="color:red;">您的答案错误:' + data.testdetail[i].userchecked + '</div>';
}
else {
divHtml += '<div style="color:green;">您的答案正确:' + data.testdetail[i].userchecked + '</div>';
}
}
else if (data.testdetail[i].question__type == 2) {
var divHtml = "";
var answrText = "";
divHtml += '<div style="margin-left:30px;padding-bottom:13px">';
divHtml += '<span style="color:blue">' + "【多选题】</span></span>" +"第" + i + "题:" + data.testdetail[i].question__title + '</span>';
divHtml += '<span style=" margin-left: 40px; color:#d5cc1d;">此题得分:' + data.testdetail[i].iscore + ' 分</span>';
divHtml += '<br />';
divHtml += '<div style="margin-left: 80px;margin-top: 15px;"><span>A.' + data.testdetail[i].question__answer.A + '</span></br></br><span>B.' + data.testdetail[i].question__answer.B + '</span></br></br><span>C.' + data.testdetail[i].question__answer.C + '</span></br></br><span>D.' + data.testdetail[i].question__answer.D + '</span></br></br><span>E.' + (data.testdetail[i].question__answer.E == undefined ? '无该选项' : data.testdetail[i].question__answer.E) + '</span></br></br><span>F.' + (data.testdetail[i].question__answer.F == undefined ? '无该选项' : data.testdetail[i].question__answer.F) + '</span></div>';
divHtml += '<br />';
divHtml += '<div style="padding-left: 10px; padding-top: 10px;">';
divHtml += '<div style="color:green;">正确答案:' + data.testdetail[i].question__right + '</div>';
if (data.testdetail[i].iscore == data.testdetail[i].score) {
divHtml += '<div style="color:green;">您的答案正确:' + data.testdetail[i].userchecked + '</div>';
}
else if (data.testdetail[i].iscore == 0) {
divHtml += '<div style="color:red;">您的答案错误:' + data.testdetail[i].userchecked + '</div>';
}
else {
divHtml += '<div style="color:yellow;">您没有选全答案:' + data.testdetail[i].userchecked + '</div>';
}
}
else {
var divHtml = "";
var answrText = "";
divHtml += '<div style="margin-left:30px;padding-bottom:13px">';
divHtml += '<span style="color:blue">' + "【单选题】</span></span>" + "第" + i + "题:" + data.testdetail[i].question__title + '</span>';
divHtml += '<span style=" margin-left: 40px; color:#d5cc1d;">此题得分:' + data.testdetail[i].iscore + ' 分</span>';
divHtml += '<br />';
divHtml += '<div style="margin-left: 80px;margin-top: 15px;"><span>A.' + data.testdetail[i].question__answer.A + '</span></br></br><span>B.' + data.testdetail[i].question__answer.B + '</span></br></br><span>C.' + data.testdetail[i].question__answer.C + '</span></br></br><span>D.' + data.testdetail[i].question__answer.D + '</span></div>';
divHtml += '<br />';
divHtml += '<div style="padding-left: 10px; padding-top: 10px;">';
divHtml += '<div style="color:green;">正确答案:' + data.testdetail[i].question__right + '</div>';
if (data.testdetail[i].iscore == 0) {
divHtml += '<div style="color:red;">您的答案错误:' + data.testdetail[i].userchecked + '</div>';
}
else {
divHtml += '<div style="color:green;">您的答案正确:' + data.testdetail[i].userchecked + '</div>';
}
}
$("#examtype1").append(divHtml);
}
},
error: function () {
return false;
},
async: false
});
</script>

View File

@ -60,16 +60,16 @@
<table class='detailtable'>
<thead>
<tr>
<th style="width:10%">
序号
</th>
<th style="width:10%">
序号
</th>
<th style="width:20%">
姓名
</th>
<th style="width:30%">
部门
</th>
<th style="width:20%">
部门
</th>
<th style="width:15%">
状态
</th>
<th style="width:10%">
@ -78,6 +78,9 @@
<th style="width:10%">
用时
</th>
<th style="width:15%">
答题详情
</th>
</tr>
</thead>
{{each cjrydetail}}
@ -92,6 +95,7 @@
{{/if}}
<td>{{$value.score}}</td>
<td>{{$value.took}}</td>
<td><a target="_blank" href="/html/examhistory/{{$value.id}}" >点击查看</a></td>
</tr>
{{/each}}
</table>
@ -183,4 +187,6 @@
}
});
}
</script>

View File

@ -249,7 +249,7 @@
};
var imagSize = document.getElementById("file").files[0].size;
if (imagSize > 1024 * 1024 * 10) {
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M超出了上传大小" + "请选择3M以内的文件");
alert("文件大小为:" + (imagSize / (1024 * 1024)).toFixed(2) + "M超出了上传大小" + "请选择10M以内的文件");
return false;
}
var url = "rlt/api/upload"; // 接收上传文件的后台地址

View File

@ -148,7 +148,7 @@ urlpatterns = [
#path('api/riskactcheck',views.apiriskactcheck),
path('api/riskcheck2',views.apiriskcheck2),
path('api/report',views.apireport),
path('html/examhistory/<int:id>/',views.examhistory),
#path('api/rights/group/<int:groupid>',views.rightsgroup),

View File

@ -135,6 +135,8 @@ def exampaperadd(req):
return render(req,'exampaperadd.html')
def exampaper(req):
return render(req,'exampaper.html')
def examhistory(req,id):
return render(req,'examhistory.html',{'id':id})
def questionadd(req):
return render(req,'questionadd.html')
def questionadd2(req):
@ -4756,7 +4758,7 @@ def apiexamtestdetail(req):
elif a == 'detail':
id = req.GET.get('id')
obj = ExamTestDetail.objects.filter(id=id)
data = obj.values('id','starttime','took','score','testdetail')[0]
data = obj.values('id','starttime','took','score','passcode','testdetail','examtest__name','user__headimgurl','user__name')[0]
return JsonResponse(data)
def apitrain(req):