<template>
  <div class="page">
    <div class="page-wrap">
      <div class="content-wrap">
        <div class="content">
          <!-- 背景 -->
          <div class="introduce-wrap">
            <!-- 背景遮罩 -->
            <div class="introduce-layer">
              <img src="/src/assets/logo.png" alt="">
              <div>
                <h2>南开区民政局</h2>
                <h3></h3>
              </div>
            </div>
          </div>
          <div class="login">
            <LoginForm @success="handleSuccess" withIcon title="登录系统"/>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import LoginForm from '@/components/system/LoginForm'

export default {
  name: 'Login',
  components: { LoginForm },
  methods: {
    /**
     * 登录成功
     */
    handleSuccess () {
      this.$router.push(import.meta.env.VITE_APP_CONTEXT_PATH)
    }
  }
}
</script>

<style scoped lang="scss">
.page {
  // logo尺寸
  --logo-size: 45px;
  // 系统标题字体大小
  --title-font-size: 30px;
  // 顶部和底部的距离
  --distance: 160px;
  // 背景色
  --background-color-light: #f7f7f7;
  --background-color-dark: #ccc;
  width: 100%;
  height: 100vh;
  background: linear-gradient(45deg, var(--background-color-light) 50%, var(--background-color-dark) 100%);
  overflow-y: hidden;
  .page-wrap {
    height: 100%;
    min-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .content-wrap {
    width: 75%;
    min-width: 1000px;
    height: calc(100% - var(--distance));
    min-height: 600px;
    background-color: #ffffff;
    padding: 10px;
    border-radius: 45px;
    box-shadow: 0 0 50px -20px rgba(0, 0, 0, 0.3);
    .content {
      width: 100%;
      height: 100%;
      display: flex;
      border-radius: 40px;
      border: 1px solid #eee;
      overflow: hidden;
    }
    // 左侧内容
    .introduce-wrap {
      height: 100%;
      flex-grow: 1;
      background-image: url("/public/images/login.jpg");
      background-repeat: no-repeat;
      background-size: auto 100%;
      background-clip: content-box;
      background-position: center;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      // 遮罩层
      .introduce-layer {
        padding: 30px;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        color: #fff;
        background: rgba(0, 0, 0, 0.45);
        display: flex;
        align-items: flex-start;
        // logo
        & > img {
          width: var(--logo-size);
          height: var(--logo-size);
          margin-right: 10px;
        }
        // 标题
        & > div {
          font-style: italic;
          font-weight: bold;
          h2 {
            font-size: var(--title-font-size);
            letter-spacing: 2px;
          }
          h3 {
            font-size: 18px;
            font-weight: normal;
            margin-top: 10px;
          }
        }
      }
    }
    // 右侧登录
    .login {
      width: 45%;
      min-width: 400px;
      flex-shrink: 0;
      overflow: hidden;
      padding: 60px;
      box-sizing: border-box;
      background-color: #fff;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      // 登录表单
      .login-form {
        width: 80%;
        max-width: 450px;
        padding: 0;
        :deep(.el-input) {
          .el-input__wrapper {
            border-radius: 30px;
            font-size: 16px;
            // 前置图标
            .el-input__prefix {
              left: 10px;
              .el-icon {
                font-size: 20px;
              }
            }
            // 后置图标
            .el-input__suffix {
              right: 10px;
            }
            // 调整输入框左右两侧留白
            .el-input__inner {
              padding-left: 40px !important;
              padding-right: 40px !important;
            }
          }
        }
      }
      // 登录按钮
      :deep(.opera) {
        .el-button {
          background: linear-gradient(to right, var(--color-primary) 20%, var(--color-primary-light) 100%);
          border-radius: 40px;
          border: none;
          box-shadow: 0 0 50px -15px var(--color-primary-dark);
          transition: box-shadow 0.3s ease-in-out;
          &:hover {
            box-shadow: 0 0 50px -5px var(--color-primary-dark);
          }
        }
      }
    }
  }
}
</style>
