<template>
  <div class="login-bg">
    <div class="container">
      <div class="logo">
        <img alt="logo" src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image" />
        <div class="logo-text">智能运维管理系统</div>
      </div>
      <LoginBanner />
      <div class="content">
        <div class="content-inner">
          <LoginForm />
        </div>
        <div class="home-link" @click="goToHome">
          <a-tooltip content="访问官网首页">
            <a-button type="text" shape="circle">
              <icon-home />
            </a-button>
          </a-tooltip>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import LoginBanner from './components/banner.vue'
import LoginForm from './components/login-form.vue'

export default defineComponent({
  components: {
    LoginBanner,
    LoginForm,
  },
  setup() {
    const showQr = ref(false)
    
    const goToHome = () => {
      window.location.href = '/#/home'
    }
    
    return { showQr, goToHome }
  },
})
</script>

<style lang="less" scoped>
.login-bg {
  min-height: 100vh;
  width: 100vw;
  background: linear-gradient(135deg, #e0e7ff 0%, #f8fafc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.container {
  display: flex;
  min-height: 500px;
  width: 900px;
  max-width: 96vw;
  border-radius: 18px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  background: #fff;
  position: relative;
  overflow: hidden;
  margin: 40px 0;
  @media (max-width: 900px) {
    flex-direction: column;
    width: 98vw;
    min-height: unset;
  }
  .banner {
    width: 400px;
    background: linear-gradient(163.85deg, #1d2129 0%, #00308f 100%);
    @media (max-width: 900px) {
      width: 100%;
      min-height: 220px;
    }
  }
  .content {
    border-radius: 18px;
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    background: #fff;
    @media (max-width: 900px) {
      padding: 24px 0;
    }
  }
}
.logo {
  position: absolute;
  top: 32px;
  left: 32px;
  z-index: 2;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 18px 6px 10px;
  border-radius: 24px;
  box-shadow: 0 2px 8px 0 rgba(31, 38, 135, 0.08);
  &-text {
    margin-left: 8px;
    color: #00308f;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 1px;
  }
  img {
    height: 32px;
    width: 32px;
  }
  @media (max-width: 900px) {
    position: static;
    margin: 24px auto 0 auto;
    justify-content: center;
    box-shadow: none;
    background: transparent;
  }
}
.home-link {
  position: absolute;
  top: 32px;
  right: 32px;
  z-index: 2;
  
  .arco-btn {
    color: var(--color-text-2);
    font-size: 20px;
    transition: all 0.3s;
    
    &:hover {
      color: rgb(var(--primary-6));
      background: rgba(0, 0, 0, 0.05);
    }
  }
  
  @media (max-width: 900px) {
    position: static;
    margin: 16px auto 0 auto;
  }
}
</style>
