<template>
    <div class="registerContainer">
      <div class="mainBox">
        <div class="main">
          <p><Input prefix="ios-contact" placeholder="用户名" v-model="userName" class="inputBox"/></p>
          <p><Input prefix="md-contact" placeholder="真实姓名" v-model="trueName" class="inputBox"/></p>
          <p><Input prefix="md-lock" type="password" placeholder="密码" v-model="userPwd" class="inputBox"/></p>
          <p><Input prefix="md-phone-portrait" placeholder="手机号码" v-model="userPhone" class="inputBox"/></p>
          <p class="sexRegister">
            <RadioGroup v-model="sex">
              <Radio label="男"></Radio>
              <Radio label="女"></Radio>
            </RadioGroup>
          </p>
          <p><input type="button" value="注册" class="inputBox btnRegister" @click="register"></p>
        </div>
      </div>
    </div>
</template>

<script>
  import GetData from './../assets/js/api';
    export default {
        name: "Register",
        data(){
          return{
            userName:'',
            trueName:'',
            userPwd:'',
            userPhone:'',
            sex:'男'
          }
        },
      mounted(){

      },
      methods:{
        register(){
          let regTest= /^1[34578]\d{9}$/;
          // let regPwd=;
          if(this.userName==''){
              this.$Message.error('用户名不能为空');
              return false;
            }
            if(this.trueName==''){
              this.$Message.error('真实姓名不能为空');
              return false;
            }
            if(this.userPwd==''){
              this.$Message.error('密码不能为空');
              return false;
            }
            if(this.userPhone==''){
              this.$Message.error('手机号码不能为空');
              return false;
            }else if(!(regTest.test(this.userPhone))){
              this.$Message.error('手机号码格式不正确');
              return false;
            }
            this.$router.push({path:'/login'});
        }
      }
    }
</script>

<style scoped>
  .registerContainer{
    position: relative;
    height: 100%;
    width: 100%;
    background: url("./../assets/img/login.png") no-repeat;
    background-size: cover;
  }
  .mainBox{
    position: absolute;
    box-shadow: 0 0 25px #00507e;
    width: 554px;
    height: 420px;
    top:50%;
    left:50%;
    margin-top: -206px;
    margin-left: -277px;
    background-color: #fff;
    border-radius: 10px;
  }
  .main{
    height: 253px;
    text-align: center;
    padding: 50px 80px 0;
    font-size: 14px;
  }
  .main .inputBox{
    width: 100%;
    height: 36px;
    border-radius: 4px;
    margin-bottom: 22px;
  }
  .main input::-webkit-input-placeholder { color:#C2C5C9;font-size: 14px; }
  .main input::-moz-placeholder { color:#C2C5C9;font-size: 14px;} /* firefox 19+ */
  .mian input:-ms-input-placeholder {  color:#C2C5C9;font-size: 14px; } /* ie */
  .main input:-moz-placeholder {  color:#C2C5C9;font-size: 14px;}
  .sexRegister{
    height: 58px;

  }
  .sexRegister label{
    font-size: 14px;
    margin: 0 40px;
  }
  .btnRegister{
    background-color: #00507e;
    border: none;
    outline: none;
    color:#ffffff;
    cursor: pointer;
  }
</style>
