<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
	<head>
		<meta charset="UTF-8"/>
		<title>工作流</title>

		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
		<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
		<link rel="stylesheet"  th:href="@{/css/layui.css}"  media="all">
	</head>
	<body class="text-center">
		<div>
			<body>
			<!--top头部标题栏-->
			<div id="top">
				<!--用户注册-->
				<div id="vl_registe">
					<div>
						<p class="userinfo">
							<label class="layui-form-label" style="    width: 98px;">用户名:</label>
							<input type="text" name="username" id="username" value="" style="    width: 250px;" placeholder="用户名" class="layui-input"  autocomplete="off" />
						</p>

						<p class="userinfo">
							<label class="layui-form-label" style="    width: 98px;">密码:</label>
							<input type="text" name="passward" id="passward" value="" style="    width: 250px;" placeholder="密码" class="layui-input" autocomplete="off" />
						</p>
						<p class="userinfo">
							<label class="layui-form-label" style="    width: 98px;">邮箱:</label>
							<input type="text" name="v_mail" id="email" value="" style="    width: 250px;" placeholder="邮箱" class="layui-input"  autocomplete="off" />
						</p>
						<p class="userinfo">
							<label class="layui-form-label" style="    width: 98px;">手机号:</label>
							<input type="text" name="telephone" id="telephone" value="" style="    width: 250px;" placeholder="手机号" class="layui-input"  autocomplete="off" />
						</p>
						<p class="userinfo">
							<label class="layui-form-label" style="    width: 98px;">用户描述:</label>
							<input type="text" name="content" id="content" value="" style="    width: 250px;" placeholder="用户描述" class="layui-input"  autocomplete="off" />
						</p>
					</div>
					<button  style="background-color: #005ba7;margin-top: 50px ;margin-left: -80px;width: 100px;" onclick="register()" class="layui-btn">添加</button>

				</div>
			</div>
	</body>
		</div>
	</body>
</html>

<style>
* {
	font-family: "微软雅黑";
	font-size: 15px;
	margin: 0 auto;
}
div{
	text-align:center;
	padding-top:10px;
}
input,button{
	margin-top:10px;
}

.btn{
	border-color: #10c8ef;
	background-color: #10c8ef;
	color: #fff;
}
</style>
<script src="/js/plugins/jquery.min.js"></script>
<script src="/js/plugins/layer/layer.js"></script>
<script>
	function register(){
	    var name=$("#username").val();
        if(name==''){
            layer.msg('账号不可为空');
            return false
        }
	   	var passWard=$("#passward").val();
        if(passWard==''){
            layer.msg('密码不可为空');
            return false
        }
	   	var email=$("#email").val();
        if(email==''){
            layer.msg('邮箱不可为空');
            return false
        }
        var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	    if(!myreg.test(email)){
		   alert('请输入有效的E_mail！');
		   myreg.focus();
		   return false;
	   }
		var telephone=$("#telephone").val()
		if(telephone==''){
            layer.msg('手机号不可为空');
            return false
		}
        if(!(/^1[34578]\d{9}$/.test(telephone))){
            alert('请输入有效手机号');
            myreg.focus();
            return false;
        }
        var content=$("#content").val();
        if(content==''){
            layer.msg('用户描述不可为空');
            return false
        }
        $.post("/bpm/user/addUser",
            {
                telephone:telephone,
                password:passWard,
                username:name,
                email:email,
                content:content
            },function (data) {
                if(data.code==200){
                    layer.msg('添加成功!', {icon: 1,time:1000});
                    setTimeout(function (){
                        parent.location.reload();
                    },500);
                }else {
                    layer.msg('添加失败!', {icon: 2,time:1000});
                    setTimeout(function (){
                        parent.location.reload();
                    },500);
                }
            },'json')




	}
</script>

