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