<!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>

	</head>
	<body class="text-center">
		<div>
			<body>
			<!--top头部标题栏-->
			<div id="top">
				<!--用户注册-->
				<div id="vl_registe">
					<div>
						<p class="userinfo">
							<span class="left">
							<span class="info"  style="margin-left: -15px;">用户名:</span>
							</span>
							<input type="text" name="v_username" id="username" value="" placeholder="用户名" onfocus="userNameFocus()" autocomplete="off" />
						</p>
						<p class="userinfo">
							<span class="left">
							<span class="info">密码:</span>
							</span>
							<input type="password" name="v_passward" id="passward" value="" placeholder="密码" autocomplete="off" />
						</p>
						<p class="userinfo">
							<span class="left">
							<span class="info">邮箱:</span>
							</span>
							<input type="emaila" name="v_mail" id="email" value="" placeholder="邮箱" autocomplete="off" />
						</p>
						<p class="userinfo">
							<span class="left">
							<span class="info" style="margin-left: -15px;">手机号:</span>
							</span>
							<input type="emaila" name="telephone" id="telephone" value="" placeholder="手机号" autocomplete="off" />
						</p>
						<p class="userinfo">
							<span class="left">
							<span class="info" style="margin-left: -29px;">用户描述:</span>
							</span>
							<input type="emaila" name="content" id="content" value="" placeholder="用户描述" autocomplete="off" />
						</p>
					</div>
					<button onclick="register()" class="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>

