<template>
  <div class="login">
    <div class="loginav">
      <div class="video">
        <video src="../assets/video/video.mp4" muted autoplay loop></video>
      </div>
      <div class=""></div>
      <div class="loginbox boxall">
        <div class="logo">
          <h1>无人机AI识别系统</h1>
          <h2>Drone AI identification system</h2>
        </div>
        <div class="logintit">用户注册</div>
        <ul class="logininput">
          <li>
            <i><img src="../assets/image/user.png"></i>
            <input class="forminput" v-model.trim="userInfo.username" type="text" placeholder="用户名">
          </li>
          <li>
            <i><img src="../assets/image/password.png"></i>
            <input class="forminput" type="password" v-model.trim="userInfo.password" placeholder="密码">
          </li>
          <li>
            <a href="#" class="btn btnblock btn-lg btn-block btn-primary" @click="registerAccount">注册</a>
          </li>
        </ul>
        <div class="boxfoot"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { PostData } from '@/api';

import qs from 'qs';
export default {
  data() {
    return {
      userInfo:{
        username:"",
        password:""
      },
    }
  },
  created() {

  },
  methods: {

    registerAccount(){
      if(this.userInfo.username == " " ||this.userInfo.username == null){
        this.$message.warning("请输出用户名")
        return
      }
      if(this.userInfo.password == " " ||this.userInfo.password == null){
        this.$message.warning("请输入密码")
        return
      }

      PostData("/user/register",qs.stringify(this.userInfo)).then(res=>{
      
        this.$message.success("注册成功")
        setTimeout(()=>{
          this.$router.push("/login")
        },2000)
      }).catch(error=>{
        this.$message.error("注册失败")
      })
    }
  },
}
</script>

<style scoped lang="scss">

li {
  list-style-type: none;
}

a {
  text-decoration: none;
  color: #fff;
}



.login {
  background: #000;
  max-width: 1920px;
  margin: 0 auto;
  height: 100%;
  position: relative;
  font-family: "PingFang SC", "Lantinghei SC", "Microsoft YaHei", "HanHei SC", "Helvetica Neue", "Open Sans", Arial, "Hiragino Sans GB", "微软雅黑", STHeiti, "WenQuanYi Micro Hei", SimSun, sans-serif;
}

.login::before {
  position: absolute;
  width: 100%;
  height: 100%;
  background: url(../assets/image/bg.png) no-repeat left center;
  content: "";
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
}

.loginbg {
  background-image: linear-gradient(300deg, #004491, #1e88e5);
  position: absolute;
  width: 100%;
  height: 50%;
  left: 0;
  top: 0;
  z-index: 0
}

.loginav {
  max-width: 1300px;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  z-index: 10;
  box-shadow: 0 0 30px rgba(0, 0, 0, .1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video {
  position: absolute;
  width: 1200px;
  left: 0px;
  padding-bottom: 40px;
  pointer-events: none;
}

.video video {
  width: 100%;
}

.video::before {
  position: absolute;
  content: "";
  width: 200px;
  height: 100%;
  background: #000;
  right: 0;
  top: 0;
}

.logotit {
  text-align: center;
  padding: 40px 0;
  font-size: 30px
}

.loginbox {
  padding: 30px 0 50px 0;
  width: 600px;
  padding: 30px 50px;
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.logininput .forminput {
  border: 2px solid rgba(32, 163, 245, .4);
  font-family: "PingFang SC", "Lantinghei SC", "Microsoft YaHei", "HanHei SC", "Helvetica Neue", "Open Sans", Arial, "Hiragino Sans GB", "微软雅黑", STHeiti, "WenQuanYi Micro Hei", SimSun, sans-serif;
  display: block;
  padding-left: 50px;
  font-size: 18px;
  color: #fff;
  width: 100%;
  line-height: 48px;
  outline: 0;
  text-indent: 1px;
  background: rgba(32, 163, 245, .1);
}

input::input-placeholder {
  color: #fff;
}

::-webkit-input-placeholder {
  color: #fff;
}




.logininput>li {
  display: block;
  padding: 15px 0;
  position: relative;
}

.logininput li>i {
  position: absolute;
  height: 100%;
  left: 15px;
  top: 0;
  display: flex;
  align-items: center;
}

.logintit {
  color: #00bff4;
  text-align: center;
  position: relative;
  padding: 25px 0;
  font-size: 24px
}

.btn-primary {
  background: #20a3f5;
  display: block;
  text-align: center;
  color: #fff;
  line-height: 48PX;
  font-size: 24px;
}

.btn-primary:hover {
  background: #137bd6
}

.copyright {
  position: fixed;
  width: 100%;
  left: 0;
  bottom: 10px;
  text-align: center;
  color: #006b95;
  font-size: 12px
}

.logo {
  position: absolute;
  top: -120px;
  width: 100%;
  left: 0;
  text-align: center;
  color: #fff;
}

.logo h1,
.logo h2 {
  background: linear-gradient(90deg, #009ef3, #00e9d0);
  background-size: cover;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-fill-color: transparent;
}

.logo h1 {
  font-weight: bolder;
  font-size: 48px;
  font-family: "Microsoft YaHei", "HanHei SC";
  letter-spacing: 2px;
}

.logo h2 {
  font-size: 30px;
  text-transform: uppercase;
  font-weight: lighter;
  letter-spacing: 2px;
}

.boxall {
  border: 2px solid #186baf;
  background: rgba(32, 163, 245, .1);
  position: relative;
  transform: scale(.7);
  opacity: 0;
  animation: shows 1s forwards;
}

@keyframes shows {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.boxall:before,
.boxall:after {
  position: absolute;
  width: 30px;
  height: 30px;
  content: "";
  border-top: 3px solid #20a3f5;
  top: -2px;
}

.boxall:before,
.boxfoot:before {
  border-left: 3px solid #20a3f5;
  left: -2px;
}

.boxall:after,
.boxfoot:after {
  border-right: 3px solid #20a3f5;
  right: -2px;
}

.boxfoot {
  position: absolute;
  bottom: 0;
  width: 100%;
  left: 0;
}

.boxfoot:before,
.boxfoot:after {
  position: absolute;
  width: 30px;
  height: 30px;
  content: "";
  border-bottom: 3px solid #20a3f5;
  bottom: -2px;
}




input[type="radio"] {
  border-radius: 20px;
}

input {
  outline: none !important;
}



@media (max-width: 1200px) {
  .loginav {
    justify-content: center;
  }

  .video {
    display: none;
  }

  .loginbox {
    width: 96%;
  }

  .logo h1 {
    font-size: 30px;
  }

  .logo h2 {
    font-size: 20px;
  }

  .loginbox {
    padding: 30px;
  }
}
</style>