<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head th:replace="fragment :: head(~{::title})">
  <title>用户注册</title>
<!--  <script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>-->
</head>

<body class="login-bg">

<br>
<br>
<br>
 <div class="m-container-small m-padded-tb-massive disabled" style="max-width: 30em !important;">
   <div class="ur container">
     <div class="ui middle aligned center aligned grid">
       <div class="column">
         <h2 class="ui teal image header">
           <div class="content" >
         注 &nbsp册
           </div>
         </h2>
         <form class="ui large form" method="post" action="#" th:action="@{/user/toRegister}">
           <div class="ui  segment">
             <div class="field">
               <div class="ui left icon input">
                 <i class="user icon"></i>
                 <input type="text" name="username" placeholder="请输入用户名">
               </div>
             </div>
             <br><br><br>
             <div class="field">
               <div class="ui left icon input">
                 <i class="lock icon"></i>
                 <input type="password" name="password"  id="pass" placeholder="请输入密码">
               </div>
             </div>
             <br><br><br>
             <div class="field">
               <div class="ui left icon input">
                 <i class="building icon "></i>
                 <input type="text" name="school" placeholder="请输入学校">
               </div>
             </div>
             <br><br><br>
             <div class="field">
               <div class="ui left icon input">
                 <i class="envelope  icon"></i>
                 <input type="text" name="email" placeholder="请输入邮箱">
               </div>
             </div>
             <br><br><br>
             <button class="ui fluid large teal submit button" >注册</button>
             <br><br>
             <p>有账号，直接<a th:href="@{/user}" style="font-style: italic">登录</a></p>
           </div>


           <div id="errorMessage" style="display: none" th:text="${msg}">信息有误！！</div>

         </form>

       </div>
     </div>
   </div>
 </div>


<script>
  $('.ui.form').form({
    fields : {
      username : {
        identifier: 'username',
        rules: [{
          type : 'empty',
          prompt: '用户名不能为空！',

        }]
      },
      password : {
        identifier: 'password',
        rules: [{
          type : 'empty',
          prompt: '密码不能为空！'
        }]
      },
      school : {
        identifier: 'school',
        rules: [{
          type : 'empty',
          prompt: '学校不能为空！'
        }]
      },
      email : {
        identifier: 'email',
        rules: [{
          type : 'empty',
          prompt: '邮箱不能为空！'
        }]
      }
    }
  });

  $(document).ready(function(){


    if ( $('#errorMessage').text()!='')
    {
      alert("客官，您输入的信息可能有误哦！")
    }else
    {

    }


  })


</script>

</body>
</html>
