This commit is contained in:
parent
d4f31f8c4b
commit
3f1201aa3a
|
|
@ -61,8 +61,8 @@ public class CmsExaminationController {
|
|||
@GetMapping()
|
||||
public String start(@PathVariable String id, ModelMap mmap) {
|
||||
ExamExamination examExamination = examExaminationService.selectById( id );
|
||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
Integer userId = Integer.parseInt( sysUser.getUserId().toString() );
|
||||
// SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||
// Integer userId = Integer.parseInt( sysUser.getUserId().toString() );
|
||||
//考试类型
|
||||
String type = examExamination.getType();
|
||||
//试卷ID
|
||||
|
|
@ -73,14 +73,15 @@ public class CmsExaminationController {
|
|||
Integer timeLength = examExamination.getTimeLength();
|
||||
//考试记录ID
|
||||
Integer examUserExaminationId = -1;
|
||||
if(1==1){
|
||||
throw new BaseException("已超过" + examNumber + "次考试,");
|
||||
}
|
||||
// if(1==1){
|
||||
// mmap.put("error","已超过" + examNumber + "次考试");
|
||||
// return prefix + "list";
|
||||
// }
|
||||
ExamUserExamination insert = new ExamUserExamination();
|
||||
//正式考试
|
||||
if (type.equals( "2" )) {
|
||||
ExamUserExamination examUserExamination = new ExamUserExamination();
|
||||
examUserExamination.setVipUserId( userId );
|
||||
examUserExamination.setVipUserId( 1 );
|
||||
examUserExamination.setExamPaperId( examPaperId );
|
||||
examUserExamination.setExamExaminationId( Integer.parseInt( id ) );
|
||||
//考试记录集合
|
||||
|
|
@ -110,7 +111,7 @@ public class CmsExaminationController {
|
|||
|| userExamination.get( 0 ).getCreateDate().getTime() + timeLength * 60 * 1000 < new Date().getTime()//最后一次考试,已超过考过时长
|
||||
) {
|
||||
insert.setExamExaminationId( Integer.parseInt( id ) );
|
||||
insert.setVipUserId( userId );
|
||||
insert.setVipUserId( 1 );
|
||||
insert.setCreateDate( new Date() );
|
||||
insert.setExamPaperId( examPaperId );
|
||||
insert.setDelFlag( "0" );
|
||||
|
|
@ -169,7 +170,8 @@ public class CmsExaminationController {
|
|||
mmap.put( "data", data );
|
||||
mmap.put( "examUserExaminationId", examUserExaminationId );
|
||||
mmap.put( "examExamination", examExamination );
|
||||
return prefix+"deatil";
|
||||
mmap.put("paperId", examPaperId);
|
||||
return prefix+"detail";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,25 +13,38 @@
|
|||
<div class="layui-col-md12">
|
||||
<div class="fly-panel">
|
||||
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card" th:each="question:${data}">
|
||||
<div class="layui-card-header"><span th:text="${question.title}"></span>
|
||||
<span th:if="${question.type=='1'}">(单选)</span>
|
||||
<span th:if="${question.type=='2'}">(多选)</span>
|
||||
<span th:if="${question.type=='3'}">(判断)</span>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card" th:each="question:${data}">
|
||||
<div class="layui-card-header">[[${questionStat.index+1}]]:<span
|
||||
th:text="${question.title}"></span>
|
||||
<span th:if="${question.type=='1'}">(单选)</span>
|
||||
<span th:if="${question.type=='2'}">(多选)</span>
|
||||
<span th:if="${question.type=='3'}">(判断)</span>
|
||||
</div>
|
||||
<div class="layui-card-body" th:each="item:${question.questionItem}">
|
||||
<input th:class="${question.id}+'useranswer'" th:if="${question.type=='2'}"
|
||||
type="checkbox" th:name="${question.id}" th:value="${item.number}">
|
||||
<input th:class="${question.id}+'useranswer'" th:if="${question.type != '2'}"
|
||||
type="radio" th:name="${question.id}" th:value="${item.number}">
|
||||
[[${item.number}]]:
|
||||
<span th:text="${item.content}" onclick="checkbox(this)"></span>
|
||||
</div>
|
||||
|
||||
|
||||
<!--<div class="layui-card-body">-->
|
||||
<!--<button class="layui-btn layui-btn-warm"-->
|
||||
<!--th:onclick="'analysis('+${question.id}+',\''+${question.answer}+'\')'">解析-->
|
||||
<!--</button>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="layui-card-body" hidden th:id="${question.id}+'answer'">-->
|
||||
<!--解析:正确答案[[${question.answer}]]<br>-->
|
||||
<!--[[${question.label}]]-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="layui-card-body" th:each="item:${question.questionItem}">
|
||||
<input th:class="${question.id}+'useranswer'" th:if="${question.type=='2'}" type="checkbox" th:name="${question.id}" th:value="${item.number}">
|
||||
<input th:class="${question.id}+'useranswer'" th:if="${question.type != '2'}" type="radio" th:name="${question.id}" th:value="${item.number}">
|
||||
[[${item.number}]]:
|
||||
<span th:text="${item.content}"></span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<button class="layui-btn layui-btn-warm" th:onclick="'analysis('+${question.id}+',\''+${question.answer}+'\')'">解析</button>
|
||||
</div>
|
||||
<div class="layui-card-body" hidden th:id="${question.id}+'answer'">
|
||||
解析:正确答案[[${question.answer}]]<br>
|
||||
[[${question.label}]]
|
||||
|
||||
<div class="layui-card">
|
||||
<button class="layui-btn layui-btn-warm" onclick="endPaper()">交卷</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -40,11 +53,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="fly-footer" th:replace="web/index::cmsBottom">
|
||||
|
|
@ -58,25 +70,24 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
|
||||
<script type="text/javascript">
|
||||
var layer;
|
||||
$(function(){
|
||||
layui.use('layer', function(){
|
||||
$(function () {
|
||||
layui.use('layer', function () {
|
||||
layer = layui.layer;
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
function analysis(id,answer) {
|
||||
var userAnswer = $("."+id+"useranswer:checked").val();
|
||||
if(userAnswer != answer){
|
||||
function endPaper() {
|
||||
var userAnswer = $("." + id + "useranswer:checked").val();
|
||||
if (userAnswer != answer) {
|
||||
layer.msg('回答错误', {icon: 2});
|
||||
|
||||
$.ajax({
|
||||
type : 'post',
|
||||
url:"/api/v1/practice/answer",
|
||||
contentType:"application/json",
|
||||
data:"["+id+"]",
|
||||
success : function(result) {
|
||||
type: 'post',
|
||||
url: "/api/v1/practice/answer",
|
||||
contentType: "application/json",
|
||||
data: "[" + id + "]",
|
||||
success: function (result) {
|
||||
if (result.code != web_status.SUCCESS) {
|
||||
$.modal.msgError(result.msg);
|
||||
}
|
||||
|
|
@ -85,7 +96,7 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
|
||||
|
||||
}
|
||||
$("#"+id+"answer").show()
|
||||
$("#" + id + "answer").show()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -37,10 +37,27 @@
|
|||
</div>
|
||||
|
||||
<script src="/web/res/layui/layui.js"></script>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
|
||||
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var layer;
|
||||
$(function(){
|
||||
layui.use('layer', function(){
|
||||
layer = layui.layer;
|
||||
});
|
||||
|
||||
var errormsg = '[[${error}]]';
|
||||
if(errormsg){
|
||||
layer.msg(errormsg, {icon: 2});
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
|
||||
|
|
@ -110,7 +127,7 @@
|
|||
var data = obj.data //获得当前行数据
|
||||
,layEvent = obj.event; //获得 lay-event 对应的值
|
||||
if(layEvent === 'start'){
|
||||
window.location.href = "/web/practice/start/"+data.id;
|
||||
window.location.href = "/web/examination/start/"+data.id;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card" th:each="question:${data}">
|
||||
<div class="layui-card-header"><span th:text="${question.title}"></span>
|
||||
<div class="layui-card-header">[[${questionStat.index+1}]]:<span th:text="${question.title}"></span>
|
||||
<span th:if="${question.type=='1'}">(单选)</span>
|
||||
<span th:if="${question.type=='2'}">(多选)</span>
|
||||
<span th:if="${question.type=='3'}">(判断)</span>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<input th:class="${question.id}+'useranswer'" th:if="${question.type=='2'}" type="checkbox" th:name="${question.id}" th:value="${item.number}">
|
||||
<input th:class="${question.id}+'useranswer'" th:if="${question.type != '2'}" type="radio" th:name="${question.id}" th:value="${item.number}">
|
||||
[[${item.number}]]:
|
||||
<span th:text="${item.content}"></span>
|
||||
<span th:text="${item.content}" onclick="checkbox(this)"></span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<button class="layui-btn layui-btn-warm" th:onclick="'analysis('+${question.id}+',\''+${question.answer}+'\')'">解析</button>
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -57,11 +58,15 @@
|
|||
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
var layer;
|
||||
$(function(){
|
||||
layui.use('layer', function(){
|
||||
layer = layui.layer;
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -78,7 +83,7 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
data:"["+id+"]",
|
||||
success : function(result) {
|
||||
if (result.code != web_status.SUCCESS) {
|
||||
$.modal.msgError(result.msg);
|
||||
layer.msg('result.msg', {icon: 2});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -88,6 +93,10 @@ document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Csc
|
|||
$("#"+id+"answer").show()
|
||||
}
|
||||
|
||||
// function checkbox(value){
|
||||
// $(value).prev().attr("checked", true);
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue