<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/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
	.select_width{
	     width: 220px;
	}
	.date_width{
	     width: 150px;
	}
	
	.tablelist th,td{
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}
	.tablelist td a{
    	text-decoration: underline;
	}
	
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">视频培训系统</a></li>
		<li><a href="#">培训视频管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/train/user/list.html}" method="post">
	<input type="hidden" name="pageSize" id="pageSize" value="10" />
	<ul class="seachform">
		<li>
			<label>权限：</label>
			<select class="scinput select_width"  name="roleType"   style="width: 150px;" >
				<option value="">全部</option>
				<option value="1" th:selected="${search.get('roleType') eq '1'}" >校长端</option>
				<option value="2" th:selected="${search.get('roleType') eq '2'}">老师端</option>
			</select>
	    </li>
	    <li>
			 <label>手机号码：</label>
			 <input name="mobile" type="text" class="scinput" th:value="${search.mobile}"   />
		</li>
		<li>
			 <label>姓名：</label>
			 <input name="name" type="text" class="scinput" th:value="${search.name}"   />
		</li>
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
			<ul class="toolbar">
				<a  href="javascript:;" th:onclick="'userEdit(\'\')'"  >
					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>添加老师</li>
				</a>
			</ul>
		</li>
	</ul>
	
<!-- 	<ul class="toolbar" style="margin-bottom: 10px;"> -->
<!-- 		<li class="click"> -->
<!-- 			<a th:href="@{/static/sys/excel/exam_info.xlsx}"> -->
<!-- 				<span><img th:src="@{/static/sys/images/t02.png}"></span>下载导入模板 -->
<!-- 			</a> -->
<!-- 		</li> -->
<!-- 	</ul> -->
	
	</form> 
	
	
	

	<table class="tablelist">
		<thead>
		    <tr>
		    	<th >序号</th>
		    	<th >权限 </th>
		    	<th >手机号 </th>
		    	<th >姓名</th>
		    	<th >创建时间</th>
		    	<th >操作 </th>
		    </tr> 
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${itemStat.count}"></td>
				<td  th:switch="${item.role_type}">
				   <span th:case="1" style="color:red">校长端</span>
				   <span th:case="2" style="color:red">老师端</span>
				</td>
				<td th:text="${item.mobile}"></td>
				<td th:text="${item.name}"></td>
				<td th:text="${item.create_time}"></td>
				<td >
					<a href="javascript:;" th:onclick="'userEdit(\''+${item.id}+'\')'" class="tablelink">编辑</a>
					<a href="javascript:;" th:onclick="'userDelete(\''+${item.id}+'\')'" class="tablelink">删除</a>
				</td>
			</tr>
		</tbody>
	</table>

	<!-- 分页 -->
	<div class="pagin">
    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
   	</div>
   	
</div>
</body>

<script type="text/javascript">
$(function () {
	
})	
	
function userEdit(id){
	var title="编辑老师";
	parent.layer.open({
	    type: 2,
	    title: title,
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    offset: '100px',
	    area: ['40%', '40%'],
	    content: '[[${sysUrl}]]/sys/train/user/edit.html?id='+id
	});
}
	

function userDelete(id){
	parent.layer.confirm("确定删除此老师？", {
		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
	}, function(){
		var url="[[${sysUrl}]]/sys/train/user/delete";
		var params ={
	        'id':id
	    };
		$.post(url,params,function(data){
			if(data.meta.success){
				parent.layer.msg("删除成功",{icon:1});
				parent.location.reload();
			}else{
				parent.layer.msg(data.meta.message,{icon:11});
			}
		});
	});
}
	
	



</script>

</html>