<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
 <style>
    	.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		 label.control-label-error {
  				color: Red;
             }
             .select1{
   		    width:100%;
		    height: 32px;
		    line-height: 32px;
		    border-top: solid 1px #a7b5bc;
		    border-left: solid 1px #a7b5bc;
		    border-right: solid 1px #ced9df;
		    border-bottom: solid 1px #ced9df;
		    opacity:1;
	        margin-bottom: 10px;
    	}
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">问题管理</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>问题信息</span></div>
	<form id="roleFrom"   method="post" class="form-horizontal form-validate">
		<input  type="hidden" id="id" th:if="${articeMatter.id}" th:value="${articeMatter.id}" name="id">
		<input  type="hidden" id="id" th:if="${articeMatter.articeId}" th:value="${articeMatter.articeId}" name="articeId">
		<ul class="forminfo">
			<li class="clearfix">
				<label class="fl">问题<b>*</b></label>
				  <input  type="text" id="matter"  th:value="${articeMatter.matter}" class="dfinput fl"  name="matter">
			</li>
			<li class="clearfix">
			    <label>问题类型：<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 179px">
					<select class="select1" name="stat">
					   		 <option  value="1"  th:selected="${articeMatter.stat==1}" >信息提取能力</option>
					   		 <option  value="2"  th:selected="${articeMatter.stat==2}" >推断理解能力</option>
					   		 <option  value="3"  th:selected="${articeMatter.stat==3}" >整体感知能力</option>
					   		 <option  value="4"  th:selected="${articeMatter.stat==4}" >评价鉴赏能力</option>
					   		 <option  value="5"  th:selected="${articeMatter.stat==5}" >联结运用能力</option>
					   		 <option  value="0"  th:selected="${articeMatter.stat==0}" >阅读积累测试</option>
					</select>
				</div>
		   </li>
		   <li class="clearfix">
			    <label>单多选项：<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 179px">
					<select class="select1" name="type">
					   		 <option  value="1"  th:selected="${articeMatter.type==1}" >单选</option>
					   		 <option  value="2"  th:selected="${articeMatter.type==2}" >多选</option>
					</select>
				</div>
		   </li>
			<li class="clearfix">
				<label class="fl">排序<b>*</b></label>
				  <input  type="text" id="count"  th:value="${articeMatter.count}" class="dfinput fl"  name="count">
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="submit" class="btn">保存</button>
				<button type="button" class="btn" onclick="window.history.go(-1);">取消</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">

$(function(){
	$("#roleFrom").validate({
		rules : {
			matter : {
				required : true
			},
			solution : {
		        required : true
	       }
		},
		messages: {
			matter : {
				required : "请输入问题" 
			 },
			 solution : {
			   required : "请输入正确答案" 
		   }
			
		},
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
	
});

function roleFrom(){
	var url="[[${sysUrl}]]/sys/ydz/saveArticeMatter";
	var params = $("#roleFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
			if(data.code=="999"){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/ydz/articeMatterlist.html?artice_id='+'[[${articeMatter.articeId}]]';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}


</script>
</html>