You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
925 lines
35 KiB
925 lines
35 KiB
<#include "../_include/_t.ftl"/>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<#include "../_include/_h.ftl"/>
|
|
<#include "../_include/_l.ftl"/>
|
|
<#include "../_include/_j.ftl"/>
|
|
<#include "../_include/_z.ftl"/>
|
|
<#include "../_include/_p.ftl"/>
|
|
<#include "../_include/_c_1.ftl"/>
|
|
|
|
<style>
|
|
._td_class{
|
|
font-size:16px;
|
|
text-align:center;
|
|
height:50px;
|
|
line-height:50px;
|
|
vertical-align:middle;
|
|
text-align:left;
|
|
padding-left:10px;
|
|
}
|
|
.page_win form {margin:0}
|
|
.layui-form-radio{
|
|
margin:0;
|
|
padding:0;
|
|
}
|
|
.trClass{
|
|
height:50px;
|
|
text-align:center;
|
|
border:solid 1px #bce8f1;
|
|
vertical-align:middle;
|
|
}
|
|
.tdClass{
|
|
text-align:center;
|
|
border:solid 1px #bce8f1;
|
|
vertical-align:middle;
|
|
}
|
|
|
|
._trClass{
|
|
border:solid 1px #bce8f1;
|
|
vertical-align:middle;
|
|
}
|
|
._tdClass{
|
|
padding:10px;
|
|
font-size:16px;
|
|
border:solid 1px #bce8f1;
|
|
vertical-align:middle;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
|
|
<body class="layui-layout-body">
|
|
<div class="layui-layout layui-layout-admin">
|
|
<!-- 内容主体区域 -->
|
|
<div class="layui-body" style="top:0;">
|
|
<div class="page_content" style="padding:20px;margin-left:0px;width:100%;overflow-y:hidden">
|
|
<div>
|
|
<div class="page_tools">
|
|
<div class="layui-inline" style="width:80px;">
|
|
考试名称:
|
|
</div>
|
|
<div class="layui-inline" style="width:150px;">
|
|
<input id="exam_4_examName" class="layui-input" type="text" style="font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</div>
|
|
<button id="exam_4_cxBtn" class="layui-btn layui-btn-normal"><i class="layui-icon"></i>查询</button>
|
|
<button id="exam_4_czBtn" class="layui-btn"><i class="layui-icon"></i>重置</button>
|
|
<button id="exam_4_tjBtn" class="layui-btn layui-btn-warm"><i class="layui-icon"></i>添加</button>
|
|
</div>
|
|
<div id="div_table" style="height:90%;margin:10px;border-radius:5px;">
|
|
<table id="exam_4_dataTable" lay-filter="exam_4_dataTable_filter" lay-size="sm" width="100%">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 添加试卷配置的页面 -->
|
|
<div id="exam_4_addWin" class="page_win page_win_hide" style="padding:10px;">
|
|
<form id="exam_4_addForm" lay-filter="exam_4_addForm_filter" class="layui-form">
|
|
<input type="hidden" value="${manager_user['usersUid']}" name="usersUid"/>
|
|
<input type="hidden" value="${manager_user['baseId']}" name="baseId"/>
|
|
<input type="hidden" value="${manager_user['regionId']}" name="regionId"/>
|
|
<input type="hidden" value="${manager_user['regionIds']}" name="regionIds"/>
|
|
<input type="hidden" value="${manager_user['regionVal']}" name="regionVal"/>
|
|
<input type="hidden" value="${manager_user['regionVals']}" name="regionVals"/>
|
|
<table width="950px">
|
|
<tbody>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>类型</td>
|
|
<td width="35%" class="_td_class">
|
|
<select name="type" lay-verify="required" style="height:38px;width:98%;border-color:#f0f0f0">
|
|
<option value="1" >模拟考试</option>
|
|
<option value="2">在线考试</option>
|
|
</select>
|
|
</td>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>考试名称</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examName" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>开始时间</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="startTime" name="startTime" lay-verify="required" class="layui-input" type="text" placeholder="请选择考试开始时间" autocomplete="off" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>结束时间</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="endTime" name="endTime" lay-verify="required" class="layui-input" type="text" placeholder="请选择考试结束时间" autocomplete="off" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>考试时长</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examTime" oninput="value=value.replace(/[^0-9]/g,'')" placeholder="请输入考试时长,单位(分钟)" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:#00245F">*</span>考试密码</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examPassword" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>选择题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="radioScoreId" name="radioScore" onblur="calculation()" oninput="value=value.replace(/[^0-9]/g,'')" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>多选题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="checkboxScoreId" name="checkboxScore" onblur="calculation()" oninput="value=value.replace(/[^0-9]/g,'')" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>判断题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="judgeScoreId" name="judgeScore" onblur="calculation()" oninput="value=value.replace(/[^0-9]/g,'')" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>总分</td>
|
|
<td width="35%" class="_td_class">
|
|
<input id="totalScoreId" name="totalScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>及格分数</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="passingScore" oninput="value=value.replace(/[^0-9]/g,'')" lay-verify="required" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div style="text-align:center;margin-top:20px;width:100px;height:40px;line-height:40px;border:1px solid #bce8f1;border-bottom:0px;">
|
|
<span>题目配置</span>
|
|
</div>
|
|
<div style="margin-left:100px;height:1px;width:850px;border-top:1px solid #bce8f1;">
|
|
</div>
|
|
<div>
|
|
<!-- button标签会造成提交操作导致页面直接提交,所以改用a标签 -->
|
|
<a id="exam_4_xzWinBtn" class="layui-btn" style="float:left;margin-right:10px">选择</a>
|
|
</div>
|
|
<!-- 选择题库之后返回添加页面添加到表格上 -->
|
|
<table id="exam_4_questionNumTable" width="950px" style="margin-top:40px;border:solid 1px #bce8f1;">
|
|
<tr class="trClass">
|
|
<td class="tdClass" width="200px">类别</td>
|
|
<td class="tdClass" width="100px">选择题总数</td>
|
|
<td class="tdClass" width="100px">选择题数</td>
|
|
<td class="tdClass" width="100px">多选题总数</td>
|
|
<td class="tdClass" width="100px">多选题数</td>
|
|
<td class="tdClass" width="100px">判断题总数</td>
|
|
<td class="tdClass" width="100px">判断题数</td>
|
|
<td class="tdClass" width="50px"></td>
|
|
</tr>
|
|
<tbody id="exam_4_conf"></tbody>
|
|
</table>
|
|
<button lay-submit lay-filter="exam_4_addForm_filter" class="layui-btn layui-hide" style="float:left;margin-left:900px">确定</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 点击添加页面的选择按钮,打开题库选择页面 -->
|
|
<div id="exam_4_xzWin" class="page_win page_win_hide">
|
|
<div class="layui-body">
|
|
<div class="page_content" style="margin-left:0px;width:100%;overflow-y:hidden;">
|
|
<div style="padding: 20px;">
|
|
<div class="page_tools">
|
|
<div class="layui-inline" style="width:80px;">
|
|
题目名称:
|
|
</div>
|
|
<div class="layui-inline" style="width:150px;">
|
|
<input id="exam_4_win_typeName" class="layui-input" type="text" style="font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</div>
|
|
<button id="exam_4_cxWinBtn" class="layui-btn layui-btn-normal"><i class="layui-icon"></i>查询</button>
|
|
<button id="exam_4_czWinBtn" class="layui-btn"><i class="layui-icon"></i>重置</button>
|
|
</div>
|
|
<div style="margin:0px;">
|
|
<table id="exam_4_dataWinTable" lay-filter="exam_4_dataWinTable_filter" lay-size="sm" width="100%" style="border:solid 1px #bce8f1;">
|
|
</table>
|
|
<button id="exam_4_xzWinBtn_0" class="layui-btn layui-btn-normal layui-btn-ms" style="float:right;margin-right:10px;margin-top:-10px">确定</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 查看试卷配置的页面 -->
|
|
<div id="exam_4_showWin" class="page_win page_win_hide" style="padding:10px;">
|
|
<form id="exam_4_showForm" lay-filter="exam_4_showForm_filter" class="layui-form">
|
|
<table width="950px">
|
|
<tbody>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>类型</td>
|
|
<td width="35%" class="_td_class">
|
|
<select name="type" disabled="disabled" style="height:38px;width:98%;border-color:#f0f0f0">
|
|
<option value="1" >模拟考试</option>
|
|
<option value="2">在线考试</option>
|
|
</select>
|
|
</td>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>考试名称</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examName" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>开始时间</td>
|
|
<td width="35%" class="_td_class">
|
|
<input readonly="readonly" name="startTime" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>结束时间</td>
|
|
<td width="35%" class="_td_class">
|
|
<input readonly="readonly" name="endTime" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>考试时长</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examTime" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:#00245F">*</span>考试密码</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="examPassword" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>选择题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="radioScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>多选题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="checkboxScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>判断题分值</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="judgeScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>总分</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="totalScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="15%" class="_td_class"><span style="color:red">*</span>及格分数</td>
|
|
<td width="35%" class="_td_class">
|
|
<input name="passingScore" readonly="readonly" class="layui-input" type="text" style="width:98%;font-size:16px;padding-top:4px;cursor:pointer;letter-spacing:1px;"/>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div style="text-align:center;margin-top:20px;width:100px;height:40px;line-height:40px;border:1px solid #bce8f1;border-bottom:0px;">
|
|
<span>题目配置</span>
|
|
</div>
|
|
<div style="margin-left:100px;height:1px;width:850px;border-top:1px solid #bce8f1;">
|
|
</div>
|
|
<!-- 选择题库之后返回添加页面添加到表格上 -->
|
|
<table id="exam_4_questionNumTable_show" width="950px" style="margin-top:40px;border:solid 1px #bce8f1;">
|
|
<tr class="trClass">
|
|
<td class="tdClass" width="200px">类别</td>
|
|
<td class="tdClass" width="100px">选择题总数</td>
|
|
<td class="tdClass" width="100px">选择题数</td>
|
|
<td class="tdClass" width="100px">多选题总数</td>
|
|
<td class="tdClass" width="100px">多选题数</td>
|
|
<td class="tdClass" width="100px">判断题总数</td>
|
|
<td class="tdClass" width="100px">判断题数</td>
|
|
<td class="tdClass" width="50px"></td>
|
|
</tr>
|
|
<tbody id="exam_4_conf_show"></tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- 二维码图片窗口 -->
|
|
<div id="exam_4_scan" class="page_win page_win_hide">
|
|
<img id="vcode" src="" border="0" style="cursor:pointer;"/>
|
|
</div>
|
|
|
|
<!-- 题库预览 -->
|
|
<div id="exam_4_previewWin" class="page_win page_win_hide" style="padding:10px;">
|
|
<table id="exam_4_previewWinTable" width="700px" style="margin-left:70px;border:solid 1px #bce8f1"></table>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var questionTypeList = new Array();
|
|
layuiplus.on_w_1(function(){
|
|
layuiplus.init(1);
|
|
//日期input
|
|
ldate.render({
|
|
elem:"#startTime",
|
|
type:"datetime"
|
|
});
|
|
ldate.render({
|
|
elem:"#endTime",
|
|
type:"datetime"
|
|
});
|
|
|
|
//列表开始
|
|
var exam_4_dataTable = table.render({
|
|
elem:"#exam_4_dataTable",
|
|
url:"${ctx}/exam/exam_4/list",
|
|
where:{
|
|
baseId:"${manager_user['baseId']}"
|
|
},
|
|
method:"get",
|
|
cols:[[
|
|
{field:"examName",title:"考试名称",unresize:true,width:300},
|
|
{field:"startTime",title:"开始时间",unresize:true,width:200,templet:function(d){
|
|
var _time = d.startTime.replace(","," - ");
|
|
return _time;
|
|
}},
|
|
{field:"endTime",title:"结束时间",unresize:true,width:200,templet:function(d){
|
|
var _time = d.endTime.replace(","," - ");
|
|
return _time;
|
|
}},
|
|
{field:"examTime",title:"时长",unresize:true,width:100},
|
|
{field:"totalScore",title:"总分",unresize:true,width:100},
|
|
{field:"radioScore",title:"单选题分值",unresize:true,width:100},
|
|
{field:"checkboxScore",title:"多选题分值",unresize:true,width:100},
|
|
{field:"judgeScore",title:"判断题分值",unresize:true,width:100},
|
|
{title:"操作 ",unresize:true,align:"center",templet:function(d){
|
|
var opt = "<a class=\"layui-btn layui-btn-xs\" lay-event=\"opt_show\">查看</a> ";
|
|
opt += "<a class=\"layui-btn layui-btn-xs layui-btn-warm\" lay-event=\"opt_scan\">扫码</a> "
|
|
opt += "<a class=\"layui-btn layui-btn-danger layui-btn-xs\" lay-event=\"opt_delete\">删除</a> "
|
|
return opt;
|
|
}},
|
|
]],
|
|
height: $(document).height() - $('#exam_4_dataTable').offset().top - 20,
|
|
text:{none:"暂无数据,您可以更改查询时间段进行查询"},
|
|
page:{
|
|
layout:["prev","page","next","skip","count","limit"],
|
|
limits:[10],
|
|
theme: '#1E9FFF'
|
|
}
|
|
});
|
|
|
|
//查询按钮
|
|
$("#exam_4_cxBtn").bind("click", function(){
|
|
exam_4_dataTable.reload({
|
|
where:{
|
|
examName:$("#exam_4_examName").val(),
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
});
|
|
|
|
//重置按钮
|
|
$("#exam_4_czBtn").bind("click", function(){
|
|
$("#exam_4_examName").val("");
|
|
exam_4_dataTable.reload({
|
|
where:{
|
|
examName:"",
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
});
|
|
|
|
//试题类型查询按钮
|
|
$("#exam_4_cxWinBtn").bind("click", function(){
|
|
exam_4_dataWinTable.reload({
|
|
where:{
|
|
typeName:$("#exam_4_win_typeName").val(),
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
});
|
|
|
|
//试题类型重置按钮
|
|
$("#exam_4_czWinBtn").bind("click", function(){
|
|
$("#exam_4_win_typeName").val("");
|
|
exam_4_dataWinTable.reload({
|
|
where:{
|
|
typeName:"",
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
});
|
|
|
|
//添加中的选择试题按钮
|
|
var exam_4_xzWin;
|
|
var exam_4_dataWinTable
|
|
$("#exam_4_xzWinBtn").bind("click", function(){
|
|
exam_4_xzWin = layer.open({
|
|
id:"exam_4_xzWin_id",
|
|
type:1,
|
|
shade:0.3,
|
|
area:["900px","550px"],
|
|
resize:false,
|
|
content:$("#exam_4_xzWin"),
|
|
success:function(){
|
|
//选择试题
|
|
exam_4_dataWinTable = table.render({
|
|
elem:"#exam_4_dataWinTable",
|
|
url:"${ctx}/exam/exam_4/getTypelist",
|
|
where:{
|
|
typeName:"",
|
|
baseId:"${manager_user['baseId']}"
|
|
},
|
|
method:"get",
|
|
cols:[[
|
|
{type:"checkbox"},
|
|
{field:"id",title:"id",unresize:true,width:200},
|
|
{field:"typeName",title:"名称",unresize:true,width:200},
|
|
{field:"radio",title:"单选题数",unresize:true,width:150},
|
|
{field:"checkbox",title:"多选题数",unresize:true,width:150},
|
|
{field:"judge",title:"判断题数",unresize:true,width:150},
|
|
{title:"操作 ",unresize:true,templet:function(d){
|
|
var opt = "<a class=\"layui-btn layui-btn-xs layui-btn-normal\" lay-event=\"opt_preview\">预览</a> ";
|
|
return opt;
|
|
}}
|
|
]],
|
|
done: function () {
|
|
var _table = $("#exam_4_dataWinTable").next().find(".layui-table-box");
|
|
_table.find("[data-field=id]").css("display","none");
|
|
},
|
|
height: $(document).height() - $('#exam_4_dataWinTable').offset().top - 150,
|
|
text:{none:"暂无数据,您可以更改查询时间段进行查询"},
|
|
page:{
|
|
layout:["prev","page","next","skip","count","limit"],
|
|
limits:[5],
|
|
theme: '#1E9FFF'
|
|
},
|
|
limit:5
|
|
});
|
|
}
|
|
});
|
|
});
|
|
//选择好试题类型然后将数据返回新增弹窗
|
|
$("#exam_4_xzWinBtn_0").bind("click", function(){
|
|
var checkStatus = table.checkStatus("exam_4_dataWinTable");
|
|
var _data = checkStatus.data;
|
|
questionNum = checkStatus.data;
|
|
if(_data.length == 0){
|
|
layer.msg("请选择一条数据");
|
|
}else{
|
|
var html = "";
|
|
for(var i=0;i < _data.length;i++){
|
|
if(questionTypeList.indexOf(_data[i].id) == -1){
|
|
html += "<tr id='tr_id_"+_data[i].id+"' class='trClass'>"
|
|
html += "<td class='tdClass'>"+_data[i].typeName+"<input type='hidden' value='"+_data[i].id+"' name='questionTypeId'/></td>"
|
|
html += "<td class='tdClass'><span id='radio_"+_data[i].RN+"'>"+_data[i].radio+"</span></td>"
|
|
html += "<td class='tdClass'><input id='radio_"+_data[i].RN+"_num' totalNum='"+_data[i].radio+"' name='radioNum' onblur='calculation()' oninput=\"value=value.replace(/[^0-9]/g,'')\" class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'><span id='checkbox_"+_data[i].RN+"'>"+_data[i].checkbox+"</span></td>"
|
|
html += "<td class='tdClass'><input id='checkbox_"+_data[i].RN+"_num' totalNum='"+_data[i].checkbox+"' name='checkboxNum' onblur='calculation()' oninput=\"value=value.replace(/[^0-9]/g,'')\" class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'><span id='judge_"+_data[i].RN+"'>"+_data[i].judge+"</span></td>"
|
|
html += "<td class='tdClass'><input id='judge_"+_data[i].RN+"_num' totalNum='"+_data[i].judge+"' name='judgeNum' onblur='calculation()' oninput=\"value=value.replace(/[^0-9]/g,'')\" class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'><a class='layui-btn layui-btn-xs layui-btn-normal' onclick='deleteType(\""+_data[i].id+"\")' >删除</a></td>"
|
|
html += "</tr>";
|
|
questionTypeList.push(_data[i].id);
|
|
}
|
|
}
|
|
$("#exam_4_conf").append(html);
|
|
layer.msg("添加成功");
|
|
layer.close(exam_4_xzWin);
|
|
}
|
|
});
|
|
|
|
//添加按钮
|
|
var addWin;
|
|
$("#exam_4_tjBtn").bind("click", function(){
|
|
addWin = layer.open({
|
|
id:"exam_4_addWin_id",
|
|
title: "新增试卷配置",
|
|
type: 1,
|
|
content: $("#exam_4_addWin"),
|
|
area: ["1000px", "600px"],
|
|
btn:["确定"],
|
|
yes:function(){
|
|
$("#exam_4_addForm").find("button[lay-filter=exam_4_addForm_filter]").click();
|
|
},
|
|
end:function(){
|
|
$("#exam_4_addForm")[0].reset();
|
|
$("#exam_4_conf").html("");
|
|
questionTypeList = new Array();
|
|
}
|
|
});
|
|
});
|
|
//添加提交
|
|
form.on("submit(exam_4_addForm_filter)",function(formData){
|
|
var flag = true;
|
|
//验证如果题目配置没有选择则停止并提示
|
|
if($("#exam_4_questionNumTable tr").length == 1){
|
|
layer.msg("请选择题目配置",{time:2000});
|
|
return false;
|
|
}
|
|
//验证选择的题目数是否比总数大
|
|
$("input[name='radioNum']").each(function(){
|
|
if(!($(this).val() == "undefined" || $(this).val() == "")){
|
|
if(Number($(this).val()) > Number($(this).attr("totalNum"))){
|
|
flag = false;
|
|
}
|
|
}
|
|
});
|
|
$("input[name='checkboxNum']").each(function(){
|
|
if(!($(this).val() == "undefined" || $(this).val() == "")){
|
|
if(Number($(this).val()) > Number($(this).attr("totalNum"))){
|
|
flag = false;
|
|
}
|
|
}
|
|
});
|
|
$("input[name='judgeNum']").each(function(){
|
|
if(!($(this).val() == "undefined" || $(this).val() == "")){
|
|
if(Number($(this).val()) > Number($(this).attr("totalNum"))){
|
|
flag = false;
|
|
}
|
|
}
|
|
});
|
|
//如果flag是false说明有问题,则停止提交
|
|
if(!flag){
|
|
layer.msg("填写的题目数量超出范围",{time:2000});
|
|
return false;
|
|
}
|
|
|
|
//验证开始时间和结束时间的大小
|
|
var startTime = $("#startTime").val();
|
|
var endTime = $("#endTime").val();
|
|
var stdt=new Date(startTime.replace("-","/"));
|
|
var etdt=new Date(endTime.replace("-","/"));
|
|
if(stdt > etdt){
|
|
layer.msg("开始时间必须小于结束时间",{time:2000});
|
|
return false;
|
|
}
|
|
|
|
//如果没有选择题目数量则默认为全选并且计算总分
|
|
calculation();
|
|
|
|
layerload.on();
|
|
$.ajax({
|
|
type:"post",
|
|
url:"${ctx}/exam/exam_4/add",
|
|
data:$(formData.form).serialize(),
|
|
dataType:"json",
|
|
success:function(data){
|
|
if(data.status == true){
|
|
layer.close(addWin);
|
|
layer.msg("操作成功",{time:2000});
|
|
exam_4_dataTable.reload({
|
|
where:{
|
|
examName:$("#exam_4_examName").val(),
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
layerload.off();
|
|
}
|
|
}
|
|
});
|
|
return false;//不停止就会提交两次 没找到原因
|
|
});
|
|
|
|
//自定义验证规则
|
|
form.verify({
|
|
otherReq: function(value,item){
|
|
var $ = layui.$;
|
|
var verifyName=$(item).attr('name')
|
|
, verifyType=$(item).attr('type')
|
|
,formElem=$(item).parents('.layui-form')//获取当前所在的form元素,如果存在的话
|
|
,verifyElem=formElem.find('input[name='+verifyName+']')//获取需要校验的元素
|
|
,isTrue= verifyElem.is(':checked')//是否命中校验
|
|
,focusElem = verifyElem.next().find('i.layui-icon');//焦点元素
|
|
if(!isTrue || !value){
|
|
//定位焦点
|
|
focusElem.css(verifyType=='radio'?{"color":"#FF5722"}:{"border-color":"#FF5722"});
|
|
//对非输入框设置焦点
|
|
focusElem.first().attr("tabIndex","1").css("outline","0").blur(function() {
|
|
focusElem.css(verifyType=='radio'?{"color":""}:{"border-color":""});
|
|
}).focus();
|
|
return '必填项不能为空';
|
|
}
|
|
}
|
|
});
|
|
|
|
//数据表格exam_4_dataTable每行数据操作监听
|
|
table.on("tool(exam_4_dataTable_filter)",function(row){//row.data row.event
|
|
if(row.event == "opt_show"){
|
|
exam_4_showWin = layer.open({
|
|
id:"exam_4_showWin_id",
|
|
type:1,
|
|
shade:0.3,
|
|
area:["1000px","600px"],
|
|
resize:false,
|
|
content:$("#exam_4_showWin"),
|
|
btn:["关闭"],
|
|
yes:function(index,layero){
|
|
layer.close(index);
|
|
$("#exam_4_showForm")[0].reset();
|
|
$("#exam_4_conf_show").html("");
|
|
},
|
|
end:function(){
|
|
$("#exam_4_showForm")[0].reset();
|
|
$("#exam_4_conf_show").html("");
|
|
},
|
|
success:function(){
|
|
$.ajax({
|
|
type:"get",
|
|
url:"${ctx}/exam/exam_4/get",
|
|
data:{id:row.data.id},
|
|
dataType:"json",
|
|
success:function(data){
|
|
var _data = data.paperInfo;
|
|
form.val("exam_4_showForm_filter",{
|
|
type:_data.type,
|
|
examName:_data.examName,
|
|
startTime:_data.startTime,
|
|
endTime:_data.endTime,
|
|
examTime:_data.examTime,
|
|
examPassword:_data.examPassword,
|
|
radioScore:_data.radioScore,
|
|
checkboxScore:_data.checkboxScore,
|
|
judgeScore:_data.judgeScore,
|
|
totalScore:_data.totalScore,
|
|
passingScore:_data.passingScore
|
|
});
|
|
var _list = data.list;
|
|
var html = "";
|
|
for(var i=0;i < _list.length;i++){
|
|
html += "<tr id='tr_id_"+_list[i].id+"' class='trClass'>"
|
|
html += "<td class='tdClass'>"+_list[i].typeName+"</td>"
|
|
html += "<td class='tdClass'><span>"+_list[i].radioTotal+"</span></td>"
|
|
html += "<td class='tdClass'><input readonly='readonly' value='"+_list[i].radio+"' class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'><span>"+_list[i].checkboxTotal+"</span></td>"
|
|
html += "<td class='tdClass'><input readonly='readonly' value='"+_list[i].checkbox+"' class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'><span>"+_list[i].judgeTotal+"</span></td>"
|
|
html += "<td class='tdClass'><input readonly='readonly' value='"+_list[i].judge+"' class='layui-input' type='text' style='margin-left:5%;width:90%;padding-top:4px;'/></td>"
|
|
html += "<td class='tdClass'></td>"
|
|
html += "</tr>";
|
|
}
|
|
$("#exam_4_conf_show").html(html);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
if(row.event == "opt_delete"){
|
|
layer.confirm("删除当前考试。<br/>如果继续请点击“确定”,否则点击“取消”<br/>是否继续?",{title:"提示"},function(index){
|
|
$.ajax({
|
|
type:"get",
|
|
url:"${ctx}/exam/exam_4/delete",
|
|
data:{id:row.data.id},
|
|
dataType:"json",
|
|
success:function(data){
|
|
exam_4_dataTable.reload({
|
|
where:{
|
|
typeName:$("#exam_4_typeName").val(),
|
|
baseId:"${manager_user['baseId']}"
|
|
}
|
|
});
|
|
layer.close(index);
|
|
layer.msg("操作成功",{time:2000});
|
|
}
|
|
});
|
|
});
|
|
}
|
|
if(row.event == "opt_scan"){
|
|
//扫描二维码
|
|
layer.open({
|
|
type:1,
|
|
area:["340px", "390px"],
|
|
title:"试题二维码",
|
|
shade:0.3,
|
|
resize:false,
|
|
content:$("#exam_4_scan"),
|
|
success:function(){
|
|
$("#vcode").attr("src","${ctx}/exam/exam_4/scan?id="+row.data.id+"&baseId=${manager_user['baseId']}&url=http://www.firecloud119.com/")
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
//数据表格exam_4_dataWinTable每行数据操作监听
|
|
var exam_4_previewWin;
|
|
table.on("tool(exam_4_dataWinTable_filter)",function(row){//row.data row.event
|
|
if(row.event == "opt_preview"){
|
|
exam_4_previewWin = layer.open({
|
|
id:"exam_4_previewWin_id",
|
|
title:row.data.typeName+"(单选题: "+row.data.radio+"道,多选题: "+row.data.checkbox+"道,判断题: "+row.data.judge+"道)",
|
|
type:1,
|
|
shade:0.3,
|
|
area:["900px","700px"],
|
|
resize:false,
|
|
content:$("#exam_4_previewWin"),
|
|
btn:["关闭"],
|
|
yes:function(index,layero){
|
|
layer.close(index);
|
|
$("#exam_4_previewWinTable").html("");
|
|
},
|
|
end:function(){
|
|
$("#exam_4_previewWinTable").html("");
|
|
},
|
|
success:function(){
|
|
$.ajax({
|
|
type:"get",
|
|
url:"${ctx}/exam/exam_4/getQuestionInfoList",
|
|
data:{id:row.data.id},
|
|
dataType:"json",
|
|
success:function(data){
|
|
var _list = data.list;
|
|
var html = "";
|
|
var type;
|
|
var option;
|
|
var num = 1;
|
|
for(var i=0;i < _list.length;i++){
|
|
if(_list[i].type == "1"){
|
|
type = "单选题";
|
|
option = _list[i].questionOption.split("###");
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td rowspan='2' style='width:60px;text-align:center;' class='_tdClass'>题目</td>"
|
|
html += "<td colspan='4' class='_tdClass'><b>("+type+")</b>"+num+"、"+_list[i].questionTitle+"</td>"
|
|
html += "</tr>";
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td colspan='4' rowspan='1' class='_tdClass'>"
|
|
if(_list[i].questionAnswer.indexOf("1") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">A、"+option[0]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("2") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">B、"+option[1]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("3") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">C、"+option[2]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("4") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">D、"+option[3]+"<br></span>";
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
num++;
|
|
}
|
|
}
|
|
for(var i=0;i < _list.length;i++){
|
|
if(_list[i].type == "2"){
|
|
type = "多选题";
|
|
option = _list[i].questionOption.split("###");
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td rowspan='2' style='width=60px;text-align:center;' class='_tdClass'>题目</td>"
|
|
html += "<td colspan='4' class='_tdClass'><b>("+type+")</b>"+num+"、"+_list[i].questionTitle+"</td>"
|
|
html += "</tr>";
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td colspan='4' rowspan='1' class='_tdClass'>"
|
|
if(_list[i].questionAnswer.indexOf("1") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">A、"+option[0]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("2") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">B、"+option[1]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("3") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">C、"+option[2]+"<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("4") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">D、"+option[3]+"<br></span>";
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
num++;
|
|
}
|
|
}
|
|
for(var i=0;i < _list.length;i++){
|
|
if(_list[i].type == "3"){
|
|
type = "判断题";
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td rowspan='2' style='width=60px;text-align:center;' class='_tdClass'>题目</td>"
|
|
html += "<td colspan='4' class='_tdClass'><b>("+type+")</b>"+num+"、"+_list[i].questionTitle+"</td>"
|
|
html += "</tr>";
|
|
html += "<tr class='_trClass'>"
|
|
html += "<td colspan='4' rowspan='1' class='_tdClass'>"
|
|
if(_list[i].questionAnswer.indexOf("1") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">正确<br></span>";
|
|
if(_list[i].questionAnswer.indexOf("2") != -1){
|
|
html += "<span style='color:green;'";
|
|
}else{
|
|
html += "<span";
|
|
}
|
|
html += ">错误</span>";
|
|
html += "</td>";
|
|
html += "</tr>";
|
|
num++;
|
|
}
|
|
}
|
|
$("#exam_4_previewWinTable").html(html);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//点击删除对应的题目配置
|
|
function deleteType(obj){
|
|
//根据id删除对应数据
|
|
$("#tr_id_"+obj).remove();
|
|
questionTypeList.remove(obj);
|
|
|
|
}
|
|
|
|
//计算某一元素在数组中的位置
|
|
Array.prototype.indexOf = function indexOf(val) {
|
|
for (var i = 0; i < this.length; i++) {
|
|
if (this[i] == val) return i;
|
|
}
|
|
return -1;
|
|
};
|
|
//删除数组中的某个元素
|
|
Array.prototype.remove = function(val) {
|
|
var index = this.indexOf(val);
|
|
if (index > -1) {
|
|
this.splice(index, 1);
|
|
}
|
|
};
|
|
|
|
//选择的题目数量不大于对应题目总数
|
|
function compareNum(obj){
|
|
var totalNum = $("#"+obj).html();
|
|
var currentNum = $("#"+obj+"_num").val();
|
|
if(currentNum > totalNum){
|
|
alert("选择的题目数不要大于题目总数,请重新选择");
|
|
$("#"+obj+"_num").val("");
|
|
}
|
|
}
|
|
|
|
//计算试卷总分 加 判断选择的题目数量不大于对应题目总数
|
|
function calculation(){
|
|
//如果题目配置表格是空的,则不作计算
|
|
if($("#exam_4_questionNumTable tr").length == 1){
|
|
return false;
|
|
}
|
|
//三种题型的分值,如果有一个是空的,则不作计算
|
|
var radioScore = $("#radioScoreId").val();
|
|
var checkboxScore = $("#checkboxScoreId").val();
|
|
var judgeScore = $("#judgeScoreId").val();
|
|
if(radioScore == "undefined" || radioScore == ""){
|
|
return false;
|
|
}
|
|
if(checkboxScore == "undefined" || checkboxScore == ""){
|
|
return false;
|
|
}
|
|
if(judgeScore == "undefined" || judgeScore == ""){
|
|
return false;
|
|
}
|
|
|
|
var totalNum = 0;
|
|
var radioNum = 0;
|
|
var checkboxNum = 0;
|
|
var judgeNum = 0;
|
|
$("input[name='radioNum']").each(function(){
|
|
if($(this).val() == "undefined" || $(this).val() == ""){
|
|
radioNum += Number($(this).attr("totalNum"));
|
|
}else{
|
|
radioNum += Number($(this).val());
|
|
}
|
|
});
|
|
$("input[name='checkboxNum']").each(function(){
|
|
if($(this).val() == "undefined" || $(this).val() == ""){
|
|
checkboxNum += Number($(this).attr("totalNum"));
|
|
}else{
|
|
checkboxNum += Number($(this).val());
|
|
}
|
|
});
|
|
$("input[name='judgeNum']").each(function(){
|
|
if($(this).val() == "undefined" || $(this).val() == ""){
|
|
judgeNum += Number($(this).attr("totalNum"));
|
|
}else{
|
|
judgeNum += Number($(this).val());
|
|
}
|
|
});
|
|
|
|
totalNum = radioNum * radioScore + checkboxNum * checkboxScore + judgeNum * judgeScore;
|
|
|
|
$("#totalScoreId").val(totalNum);
|
|
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|