502 lines
18 KiB
Plaintext
502 lines
18 KiB
Plaintext
<!DOCTYPE html
|
||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
|
||
.hiddenscroll::-webkit-scrollbar{
|
||
display: none;
|
||
width: 0;
|
||
height: 0;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
|
||
var addDetailFun = function() {
|
||
var questitleid=$('#id').val();
|
||
// stopBubbleDefaultEvent();
|
||
$.post(ext.contextPath + '/exam/examTitleRange/showExamTitleRangeAdd.do' ,{questitleid:questitleid}, function(data) {
|
||
$("#subDetailDiv").html(data);
|
||
openModal('subDetailModal');
|
||
});
|
||
};
|
||
|
||
|
||
var showUser4SelectsFun = function() {
|
||
var userIds= $("#examuserids").val();
|
||
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"editForm",hiddenId:"examuserids",textId:"_auditMan",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
var typechange = function(){
|
||
if($("#examtype").val()=="正式考试"){
|
||
$("#frequency-div").hide();
|
||
// $("#frequency").attr("value","");
|
||
}else if($("#examtype").val()=="模拟考试"){
|
||
$("#frequency-div").show();
|
||
}
|
||
}
|
||
|
||
//下一题
|
||
var donext = function() {
|
||
var quesnum = $("#quesnum");
|
||
$.post(ext.contextPath + '/exam/examrecord/donext.do', {quesnum:quesnum} , function(data) {
|
||
|
||
});
|
||
};
|
||
|
||
//初始化题目
|
||
var init = function(){
|
||
var quesnum = $("#quesnum");
|
||
var examrecordid = $('#examrecordid');
|
||
// console.log(quesnum);
|
||
// console.log(examrecordid);
|
||
$.post(ext.contextPath + '/exam/examrecord/doexamhtml.do', {quesnum:quesnum,examrecordid:examrecordid} , function(data) {
|
||
$('#examhtml').html(data);
|
||
});
|
||
};
|
||
// 保存用户答案
|
||
var saveanswer = function(){
|
||
var quesid = $("#quesid").val();
|
||
var daytestrecordid = $('#daytestrecordid').val();
|
||
var questype = $('#questype').val();
|
||
var useranswer = '';
|
||
// console.log(questype);
|
||
if(questype == '填空题'){
|
||
// console.log("1");
|
||
useranswer= $('#useranswer').val();
|
||
// console.log(useranswer);
|
||
}else{
|
||
var id_array=new Array();
|
||
$('input[name="option"]:checked').each(function(){
|
||
id_array.push($(this).attr('id'));//向数组中添加元素
|
||
});
|
||
useranswer=id_array.join(',');//将数组元素连接起来以构建一个字符串
|
||
// console.log("2"+useranswer);
|
||
}
|
||
$.post(ext.contextPath + '/exam/daytestrecord/dosaveanswer.do', {quesid:quesid,useranswer:useranswer,questype:questype,visitorsID: '${param.visitorsID}'} , function(data) {
|
||
|
||
});
|
||
};
|
||
|
||
/*
|
||
切换上下题
|
||
*/
|
||
function doSwitch(switchtype){//switchtype为上一个/下一个的切换类型 quesnum 为当前题序号
|
||
//切换之前先保存用户答案
|
||
saveanswer();
|
||
//隐藏答案区域
|
||
$("#analysis").hide();
|
||
//变色
|
||
var quesallcount = $('#quesallcount').val();
|
||
var quesnum = $('#quesnum').val();
|
||
var daytestrecordid = $('#daytestrecordid').val();
|
||
// console.log(examrecordid);
|
||
$.post("<%=request.getContextPath()%>/exam/daytestrecord/dodaytesthtml.do",{switchtype:switchtype,quesnum:quesnum,daytestrecordid:daytestrecordid},function(data){
|
||
if(data==1){
|
||
swal("没有上一道题了");
|
||
}else if(data == 2){
|
||
swal("问卷到此结束,感谢您的参与!");
|
||
// fullscreen();
|
||
$("#box-body").html("问卷到此结束,感谢您的参与!");
|
||
$("#btn_save").hide();
|
||
$(".modal-backdrop").remove();
|
||
closeModal('subModal');
|
||
//最后一题,打开题目解析
|
||
//openanalysis(daytestrecordid);
|
||
}else{
|
||
var arr= JSON.parse(data);
|
||
var questitlediv = '<div>'+arr.quesnum+'、'+arr.quesdescript+'</div>';
|
||
var progress = '当前第'+arr.quesnum+'题,总共'+quesallcount+'题';
|
||
var questoptiondiv = '';
|
||
// console.log(arr.rows);
|
||
if(arr.questype=='填空题'){
|
||
questoptiondiv += '<div><input type="text" name="useranswer" id="useranswer" style="width: 90%;" value="'+arr.useranswer+'" placeholder="请填写此处"/>'+
|
||
'</div>';
|
||
}else if(arr.questype=='多选题'){
|
||
var array = arr.useranswer.split(",");
|
||
for(var i = 0;i<arr.rows.length;i++){
|
||
var count = 0;
|
||
for(var j = 0;j<array.length;j++){
|
||
count++;
|
||
if(arr.rows[i].optionid == array[j]){
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" checked="checked"/>'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
break;
|
||
}else{
|
||
if(count == array.length){
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" />'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
break;
|
||
}
|
||
|
||
}
|
||
}
|
||
// console.log("aaa"+i);
|
||
}
|
||
}else if(arr.questype=='单选题' || arr.questype=='判断题'){
|
||
for(var i = 0;i<arr.rows.length;i++){
|
||
if(arr.rows[i].optionid == arr.useranswer){
|
||
questoptiondiv += '<div><input type="radio" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" checked="checked"/>'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
}else{
|
||
questoptiondiv += '<div><input type="radio" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" />'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
}
|
||
|
||
}
|
||
}
|
||
$('#questitlediv').html(questitlediv);
|
||
$('#questoptiondiv').html(questoptiondiv);
|
||
$('#progress').html(progress);
|
||
$("#quesnum").val(arr.quesnum);
|
||
$("#quesid").val(arr.quesid);
|
||
$('#questype').val(arr.questype);
|
||
$('#leftquesttype').html(arr.questype);
|
||
if(arr.questype=='单选题' || arr.questype=='判断题'){
|
||
$('#questypenamediv').html(arr.questype+":");
|
||
}else if(arr.questype=='多选题'){
|
||
$('#questypenamediv').html(arr.questype+":");
|
||
}else if(arr.questype=='填空题'){
|
||
$('#questypenamediv').html(arr.questype+":");
|
||
}
|
||
|
||
}
|
||
|
||
|
||
})
|
||
}
|
||
|
||
//打开题目解析
|
||
var openanalysis = function(id) {
|
||
var daytestrecordid = id;
|
||
$.post(ext.contextPath + '/exam/daytestrecord/openanalysis.do',{daytestrecordid:daytestrecordid}, function(data) {
|
||
// console.log(data);
|
||
$("#subDiv").html(data);
|
||
openModal('subModal');
|
||
});
|
||
};
|
||
|
||
function dojumpques(id){
|
||
var examrecordid = $('#examrecordid').val();
|
||
var questitleid = id;
|
||
$.post(ext.contextPath + '/exam/examrecord/dojumpques.do', {examrecordid:examrecordid,questitleid:questitleid} , function(data) {
|
||
// console.log(data);
|
||
var arr= JSON.parse(data);
|
||
var questitlediv = '<div>'+arr.quesnum+'、'+arr.quesdescript+'</div>';
|
||
var questoptiondiv = '';
|
||
console.log(arr.rows);
|
||
if(arr.questype=='填空题'){
|
||
questoptiondiv += '<div><input type="text" name="useranswer" id="useranswer" style="width: 90%;" value="'+arr.useranswer+'" placeholder="请填写此处"/>'+
|
||
'</div>';
|
||
}else if(arr.questype=='多选题'){
|
||
var array = arr.useranswer.split(",");
|
||
for(var i = 0;i<arr.rows.length;i++){
|
||
var count = 0;
|
||
for(var j = 0;j<array.length;j++){
|
||
count++;
|
||
if(arr.rows[i].optionid == array[j]){
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" checked="checked"/>'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
break;
|
||
}else{
|
||
if(count == array.length){
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" />'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
break;
|
||
}
|
||
|
||
}
|
||
}
|
||
// console.log("aaa"+i);
|
||
}
|
||
}else if(arr.questype=='单选题' || arr.questype=='判断题'){
|
||
for(var i = 0;i<arr.rows.length;i++){
|
||
if(arr.rows[i].optionid == arr.useranswer){
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" checked="checked"/>'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
}else{
|
||
questoptiondiv += '<div><input type="checkbox" style="zoom: 140%;" name="option" id="'+arr.rows[i].optionid+'" value="'+arr.rows[i].optionid+'" />'+
|
||
''+arr.rows[i].optionx+"."+arr.rows[i].optioncontent+'</div>';
|
||
}
|
||
|
||
}
|
||
}
|
||
$('#questitlediv').html(questitlediv);
|
||
$('#questoptiondiv').html(questoptiondiv);
|
||
$("#quesnum").val(arr.quesnum);
|
||
$("#quesid").val(arr.quesid);
|
||
$('#questype').val(arr.questype);
|
||
$('#leftquesttype').html(arr.questype);
|
||
});
|
||
}
|
||
|
||
|
||
//交卷功能
|
||
var dosendpaper = function() {
|
||
//交卷之前先保存用户最后一题答案
|
||
saveanswer();
|
||
|
||
var examrecordid = $("#examrecordid").val();
|
||
|
||
swal({
|
||
title: "您确定要交卷吗?",
|
||
// text:"这将花费大约几秒的时间",
|
||
dangerMode: true,
|
||
icon: "warning",
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
className: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
className: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(function (willDelete) {
|
||
if (willDelete) {
|
||
|
||
$.post(ext.contextPath + '/exam/examrecord/dosendpaper.do', {examrecordid:examrecordid} , function(data) {
|
||
exitfullscreen();
|
||
swal("交卷成功!");
|
||
closeModal('subModal');
|
||
location.reload();
|
||
});
|
||
|
||
}
|
||
});
|
||
|
||
};
|
||
|
||
|
||
|
||
//获取当前时间
|
||
function time() {
|
||
//获得显示时间的div
|
||
t_div = document.getElementById('nowtime');
|
||
var now = new Date()
|
||
//替换div内容
|
||
// t_div.innerHTML = "现在是" + now.getFullYear() + "年" + (now.getMonth() + 1) + "月" + now.getDate() + "日" + now.getHours() + "时" + now.getMinutes() + "分" + now.getSeconds() + "秒";
|
||
var hours = now.getHours();
|
||
var min = now.getMinutes();
|
||
var sec = now.getSeconds();
|
||
if(hours<10){
|
||
hours = "0"+hours;
|
||
}
|
||
if(min<10){
|
||
min = "0"+min;
|
||
}
|
||
if(sec<10){
|
||
sec = "0"+sec;
|
||
}
|
||
t_div.innerHTML = hours + ":" + min + ":" + sec;
|
||
//等待一秒钟后调用time方法,由于settimeout在time方法内,所以可以无限调用
|
||
setTimeout(time, 1000);
|
||
}
|
||
|
||
//全屏功能 F11
|
||
function fullscreen(){
|
||
//全屏
|
||
var docElm = document.documentElement;
|
||
//W3C
|
||
if(docElm.requestFullscreen) {
|
||
docElm.requestFullscreen();
|
||
}
|
||
|
||
//FireFox
|
||
else if(docElm.mozRequestFullScreen) {
|
||
docElm.mozRequestFullScreen();
|
||
}
|
||
|
||
//Chrome等
|
||
else if(docElm.webkitRequestFullScreen) {
|
||
docElm.webkitRequestFullScreen();
|
||
}
|
||
|
||
//IE11
|
||
else if(elem.msRequestFullscreen) {
|
||
elem.msRequestFullscreen();
|
||
}
|
||
}
|
||
|
||
//退出全屏
|
||
function exitfullscreen(){
|
||
//W3C
|
||
if (document.exitFullscreen) {
|
||
document.exitFullscreen();
|
||
}
|
||
//FireFox
|
||
else if (document.mozCancelFullScreen) {
|
||
document.mozCancelFullScreen();
|
||
}
|
||
//Chrome等
|
||
else if (document.webkitCancelFullScreen) {
|
||
document.webkitCancelFullScreen();
|
||
}
|
||
//IE11
|
||
else if (document.msExitFullscreen) {
|
||
document.msExitFullscreen();
|
||
}
|
||
}
|
||
|
||
//题目标记功能
|
||
function domarkques(){
|
||
var testpaperid = $('#quesid').val();
|
||
$.post(ext.contextPath + '/exam/examrecord/domarkques.do', {testpaperid:testpaperid} , function(data) {
|
||
console.log(data);
|
||
$("#"+data).css({
|
||
"border-color":"#E7505A",
|
||
"background":"#E7505A",
|
||
});
|
||
$("#"+data+"000").css({
|
||
'color':'white',
|
||
});
|
||
|
||
swal("标记成功");
|
||
|
||
});
|
||
}
|
||
|
||
//题目解析
|
||
function doanalysis(){
|
||
$("#analysis").css({
|
||
display: "block",
|
||
});
|
||
}
|
||
|
||
function doclose() {
|
||
swal({
|
||
title: "您确定要退出吗?",
|
||
// text:"这将花费大约几秒的时间",
|
||
dangerMode: true,
|
||
icon: "warning",
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
className: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
className: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(function (willDelete) {
|
||
if (willDelete) {
|
||
swal("退出成功!");
|
||
closeModal('subModal');
|
||
}
|
||
});
|
||
}
|
||
$(function () {
|
||
var examPlanId=$('#id').val();
|
||
|
||
});
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-xlg">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">调查问卷</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<input type="hidden" name="quesnum" id="quesnum" value="${quesnum}" />
|
||
<input type="hidden" name="quesallcount" id="quesallcount" value="${quesallcount}" />
|
||
<input type="hidden" name="quesid" id="quesid" value="${quesid}" />
|
||
<input type="hidden" name="daytestrecordid" id="daytestrecordid" value="${daytestrecordid}" />
|
||
<input type="hidden" name="questype" id="questype" value="${questypename}" />
|
||
<input type="hidden" name="questitlenum" id="questitlenum" value="${questitlenum}" />
|
||
<input type="hidden" name="examtime" id="examtime" value="${examtime}" />
|
||
<div class="row">
|
||
<div class="col-sm-6">
|
||
<h3 id="questypenamediv" style="width: 100%;">
|
||
<!-- 判断题型 -->
|
||
<c:if test="${questypename == '单选题'}">
|
||
单选题:
|
||
</c:if>
|
||
<c:if test="${questypename == '判断题'}">
|
||
判断题:
|
||
</c:if>
|
||
<c:if test="${questypename == '多选题'}">
|
||
多选题:
|
||
</c:if>
|
||
<c:if test="${questypename == '填空题'}">
|
||
填空题:
|
||
</c:if>
|
||
</h3>
|
||
</div>
|
||
<div class="col-sm-6 text-right">
|
||
<h3 id="progress" style="width: 100%;">
|
||
当前第${quesnum}题,总共${quesallcount}题
|
||
</h3>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
<div class="col-sm-12">
|
||
<!--横版-->
|
||
<h4 id="questitlediv">${quesnum}、${questitle}</h4>
|
||
<h4 id="questoptiondiv" >
|
||
<!--判断填空题-->
|
||
<c:if test="${questypename == '填空题'}">
|
||
<div>
|
||
<input type="text" name="useranswer" id="useranswer" style="width: 90%;" value="" placeholder="请填写此处"/>'+
|
||
</div>
|
||
</c:if>
|
||
|
||
<c:if test="${questypename == '多选题'}">
|
||
<c:forEach var="quesoptionlist" items="${quesoptionlist}">
|
||
<div>
|
||
<input type="checkbox" name="option" id="${quesoptionlist.optionid}" value="${quesoptionlist.optionid}" style="zoom: 140%;"/>
|
||
${quesoptionlist.optionx}.${quesoptionlist.optioncontent}
|
||
</div>
|
||
</c:forEach>
|
||
</c:if>
|
||
|
||
<c:if test="${questypename == '单选题' || questypename == '判断题'}">
|
||
<c:forEach var="quesoptionlist" items="${quesoptionlist}">
|
||
<div>
|
||
<input type="radio" name="option" id="${quesoptionlist.optionid}" value="${quesoptionlist.optionid}" style="zoom: 140%;"/>
|
||
${quesoptionlist.optionx}.${quesoptionlist.optioncontent}
|
||
</div>
|
||
</c:forEach>
|
||
</c:if>
|
||
</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer text-center">
|
||
<button type="button" class="btn btn-primary" onclick="doSwitch('next')" >确定</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|
||
</div> |