Examination_system/Examination_system-1/.svn/pristine/9b/9b3da2613307591ba9fe9150e62...

253 lines
9.4 KiB
Plaintext

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<!DOCTYPE html>
<html>
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<link rel="stylesheet" href="${bonuspath}/static/plugins/zTree/3.5/zTreeStyle.css" />
<script src="${bonuspath}/static/plugins/zTree/3.5/jquery.ztree.core-3.5.min.js"></script>
<title></title>
<style type="text/css">
.p{
margin:1% 2% 0 1%;
}
.flag{
width:15%;
text-align: right;
}
.flag>span{
padding-right:1em;
}
.con{
width:35%;
text-align: left;
}
.lang{
valign:middle;
width:80%;
text-align: left;
}
.inp{
width:80%;
}
.linp{
width:91.5%;
}
</style>
</head>
<body>
<div class="p">
<form id="questionForm" method="POST" onsubmit="return false;" >
<table id="baseTable" cellspacing="0" cellpadding="0" border="0" style="margin: 2em 1em;" class="customTable">
<input type="hidden" value="${question.questionId}" name="questionId" />
<tbody>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>题目内容:</span></th>
<td class="con">
<textarea class="inp" style="width: 222%; height: 100px;" jyValidate="required" value="${question.content}" name="content" type="text">${question.content}</textarea>
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>题目选项:</span></th>
<td class="con">
<textarea placeholder='填空、简答、案例题请填写"无" ' class="inp" style="width: 222%;" jyValidate="required" value="${question.operation}" name="operation" type="text">${question.operation}</textarea>
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>正确答案:</span></th>
<td class="con">
<c:if test="${question.classification eq 1 or question.classification eq 2 or question.classification eq 3 or question.classification eq 4}"><input class="inp" jyValidate="required" value="${question.answer}" name="answer" type="text" /></c:if>
<c:if test="${question.classification eq 5 or question.classification eq 6}"><input class="inp" jyValidate="required" value="${question.standAnswer}" name="answer" type="text" /></c:if>
</td>
<th class="flag"><span><font color="red">*</font>所属专业:</span></th>
<td class="con">
<input class="inp" id="orgName" readonly="readonly" value="${question.questionTypeName}" jyValidate="required" type="text" onclick="showRole(); return false;" />
<input type="hidden" id="orgId" name="questionType" value="${question.questionType}">
<div id='orgContent' class="menuContent ztreeMC" style="display: none;width:25%; position: absolute;z-index: 999;background-color: #e7e7e7;">
<ul id="orgTree" class="ztree accountOrgTree"></ul>
</div>
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>题目类型:</span></th>
<td class="con">
<select name="classification" jyValidate="required" class="js-example-basic-single form-control inp" >
<option value="1" <c:if test="${question.classification eq 1}">selected="selected"</c:if>>单选题</option>
<option value="2" <c:if test="${question.classification eq 2}">selected="selected"</c:if>>多选题</option>
<option value="3" <c:if test="${question.classification eq 3}">selected="selected"</c:if>>判断题</option>
<option value="4" <c:if test="${question.classification eq 4}">selected="selected"</c:if>>填空题</option>
<option value="5" <c:if test="${question.classification eq 5}">selected="selected"</c:if>>简答题</option>
<option value="6" <c:if test="${question.classification eq 6}">selected="selected"</c:if>>案例题</option>
</select>
</td>
<th class="flag"><span><font color="red">*</font>题目分值:</span></th>
<td class="con">
<input maxlength="3" class="inp" jyValidate="required,posnum" value="${question.questionGrade}" name="questionGrade" type="text" placeholder="请输入数字"/>
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>题目难度:</span></th>
<td class="con">
<select name="questionLevel" jyValidate="required" class="js-example-basic-single form-control inp" >
<option value="1" <c:if test="${question.questionLevel eq 1}">selected="selected"</c:if>>简单</option>
<option value="2" <c:if test="${question.questionLevel eq 2}">selected="selected"</c:if>>普通</option>
<option value="3" <c:if test="${question.questionLevel eq 3}">selected="selected"</c:if>>困难</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<script type="text/javascript">
$(function () {
$.fn.modal.Constructor.prototype.enforceFocus = function(){};
var type = "${question.type}";
if(type == 'view'){
$("#questionForm").find("select,input,textarea").attr("disabled","disabled");
}
loadOrgTree();
});
var preisShow=false;//窗口是否显示
function showRole() {
if(preisShow){
hideRole();
}else{
var obj = $("#orgName");
var offpos = $("#orgName").position();
$("#orgContent").css({width:offpos.width+"px",left:offpos.left+"px",top:offpos.top+obj.heigth+"px"}).slideDown("fast");
preisShow=true;
}
}
function hideRole(){
$("#orgContent").fadeOut("fast");
preisShow=false;
}
function loadOrgTree(){
JY.Ajax.doRequest(null,bonuspath +'/backstage/user/orgTree',null,function(data){
$.fn.zTree.init($("#orgTree"),{view:{dblClickExpand:true,selectedMulti:false,nameIsHTML:true},data:{simpleData:{enable: true}},callback:{onClick:clickRole}},data.obj);
});
}
function clickRole(e, treeId, treeNode) {
// var check = (treeNode && !treeNode.isParent);
if(!treeNode.isParent){
var check = (treeNode);
if(check){
var zTree = $.fn.zTree.getZTreeObj("orgTree"),
nodes = zTree.getSelectedNodes(),v ="",n ="",o="",p="";
for (var i=0, l=nodes.length; i<l; i++) {
v += nodes[i].name + ",";//获取name值
n += nodes[i].id + ",";//获取id值
o += nodes[i].other + ",";//获取自定义值
var pathNodes=nodes[i].getPath();
for(var y=0;y<pathNodes.length;y++){
p+=pathNodes[y].name+"/";//获取path/name值
}
}
if (v.length > 0 ) v = v.substring(0, v.length-1);
if (n.length > 0 ) n = n.substring(0, n.length-1);
if (o.length > 0 ) o = o.substring(0, o.length-1);
if (p.length > 0 ) p = p.substring(0, p.length-1);
$("#orgName").val(p);
$("#orgId").val(n);
hideRole();
}
}
}
function addQuestion(){
if(JY.Validate.newForm("questionForm")){
var data = paramConversionToObjOfForm("questionForm"); //获取Form表单数据项
var idx = layer.msg('正在提交保存,请稍等...', {
icon: 16
,shade: 0.01
,time:'-1'
});
$.ajax({
type:"POST",
url:bonuspath +'/backstage/question/addQuestion',
data: JSON.stringify(data),
dataType:"json",
contentType:"application/json",
success:function(data){
layer.close(idx);
if(data.res == 1){
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.getbaseList();
parent.layer.close(i);
});
}else{
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
});
}
},
error:function(data){
layer.msg("数据加载失败!",{icon:2,time:2000})
layer.close(idx);
}
})
}else{
console.log("====ckuw===")
}
}
function updateQuestion(){
if(JY.Validate.newForm("questionForm")){
var data = paramConversionToObjOfForm("questionForm");
console.log("data=",data);
var idx = layer.msg('正在提交保存,请稍等...', {
icon: 16
,shade: 0.01
,time:'-1'
});
$.ajax({
type:"POST",
url:bonuspath +'/backstage/question/updateQuestion',
data: JSON.stringify(data),
dataType:"json",
contentType:"application/json",
success:function(data){
layer.close(idx);
if(data.res == 1){
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.getbaseList();
parent.layer.close(i);
});
}else{
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
});
}
},
error:function(data){
layer.msg("数据加载失败!",{icon:2,time:2000})
layer.close(idx);
}
})
}
}
function formValid(){
return JY.Validate.form("questionForm");
}
</script>