<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;
             }
          .lispan {line-height: 34px;}   
          
          .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>
		<li><a href="#">作业吧数据配置</a></li>
	</ul>
</div>
<div class="formbody">
	<div class="formtitle"><span th:text="${content.id} ? '修改数据' :'新增数据'">新增图书馆</span></div>
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		     <input type="hidden" name="libId"  th:value="${content.libId}"/>
		     <input type="hidden" name="id" th:if="${content.id}"  th:value="${content.id}"/>
		     <input type="hidden" name="scoringContentId"  th:value="${content.scoringContentId}"/>
		     <input type="hidden" name="type"  th:value="${content.type}"/>
		<ul class="forminfo">
			 <li class="clearfix">
				<label>内容:<b>*</b></label>
				<input type="text" id="content" class="dfinput fl" name="content"  th:value="${content.content}"  />
			 </li>
			 <li class="clearfix">
				<label>排序:<b>*</b></label>
				<input type="number" id="num" class="dfinput fl" name="num"  th:value="${content.num}"/>
			 </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(){
	$("#submitFrom").validate({
		rules : {
			
			content : {
				required : true
			},
			num : {
				required : true,
				digits:true
			}
		},
		messages: {
			content : {
				required : "不能为空"
			},
			num : {
				required : "不能为空",
				digits : "只能输入整数"
			}
			
		},
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
	
});
function roleFrom(){
	var url="[[${sysUrl}]]/sys/zuoyb/scoringContenDetailSave";
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/zuoyb/scoringContenDetailList.html?EQ_libId=[[${content.libId}]]&EQ_scoringContentId=[[${content.scoringContentId}]]&type=[[${type}]]&EQ_zybCourseId=[[${EQ_zybCourseId}]]';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}


</script>
</html>