<template>
  <div class="account">
    <div class="account-container">
      <div class="account-wrap-login">
        <div class="login-pic">
          <div>
            <img src="~@/assets/images/login-pic.png" />
          </div>
        </div>
        <div class="login-form">
          <div class="login-form-container">
            <div class="account-top">
              <div class="account-top-logo">
                <img src="~@/assets/images/logo.png" alt="" />
                <span class="project-title">Naive Admin</span>
              </div>
              <div class="account-top-desc">Element plus 中后台前端/设计解决方案</div>
            </div>
            <!-- <div class="login-form-title">
            <el-space>
              <el-button round>登录</el-button>
              <el-button type="primary" round>注册</el-button>
            </el-space>
          </div> -->
            <LoginForm v-if="tab === 'login'" ref="LoginFormRef" @go-register="changeGoRegister" />
            <RegisterForm v-else ref="RegisterFormRef" @back-login="changeBackLogin" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import LoginForm from './LoginForm2.vue';
  import RegisterForm from './RegisterForm2.vue';

  const tab = ref('login');

  function changeBackLogin() {
    tab.value = 'login';
  }

  function changeGoRegister() {
    tab.value = 'register';
  }
</script>

<style lang="scss" scoped>
  .account {
    width: 100%;
    margin: 0 auto;

    &-container {
      width: 100%;
      min-height: 100vh;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      padding: 15px;
      background: #9053c7;
      background: -webkit-linear-gradient(-135deg, #c850c0, #4158d0);
      background: -o-linear-gradient(-135deg, #c850c0, #4158d0);
      background: -moz-linear-gradient(-135deg, #c850c0, #4158d0);
      background: linear-gradient(-135deg, #c850c0, #4158d0);
    }

    &-wrap-login {
      width: 960px;
      height: 554px;
      background: #fff;
      border-radius: 10px;
      overflow: hidden;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      padding: 30px 95px 33px 95px;
      .login-pic {
        display: flex;
        align-items: center;
        flex-direction: column;
        justify-content: center;

        img {
          max-width: 100%;
        }
      }

      .login-form {
        width: 350px;
        display: flex;
        flex-direction: column;
        &-container {
          margin: auto;
          width: 100%;
        }
        &-title {
          padding-bottom: 15px;
          text-align: center;
        }
      }

      @media (max-width: 991px) {
        .login-pic {
          display: none;
        }

        .login-form {
          width: 100%;
          margin: auto;
        }
      }

      .account-top {
        text-align: center;

        &-logo {
          text-align: center;
          margin-bottom: 10px;
          display: flex;
          align-items: center;
          justify-content: center;
          img {
            width: 45px;
          }
          .project-title {
            background: linear-gradient(92.06deg, #33c2ff -17.9%, #1e6fff 43.39%, #1e6fff 99.4%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-size: 24px;
            line-height: 1.25;
            font-weight: 500;
            margin-left: 10px;
          }
        }

        &-desc {
          font-size: 14px;
          color: #808695;
          margin-bottom: 20px;
        }
      }
    }

    @media (max-width: 640px) {
      &-wrap-login {
        width: 100%;
        padding: 30px;
        height: auto;
      }
    }
  }
</style>
