<template>
  <div class="login">
    <!-- <img
            class="welcome-text"
            src="@/assets/img/login/welcome-text.png"
            alt=""
        /> -->
    <div class="login-box">
      <!-- <img v-if="activeName !== 'codeLogin'" class="login-change" src="@/assets/img/login/code-login.png"
           alt="" @click="activeName = 'codeLogin'">
      <img v-else class="login-change" src="@/assets/img/login/password-login.png" alt=""
           @click="activeName = 'accountLogin'"> -->
      <!--   账号和手机号登录   -->
      <template v-if="activeName !== 'codeLogin'">
        <div class="title-box">
          <h3 class="title">登录</h3>
          <div class="little_code" @click="qrCodeShow = true"></div>
          <img src="@/assets/img/qrCodeBg.png" alt="" class="qrCodeBgStyle">
        </div>
        <div class="login-box-header">
          <img src="@/assets/img/logo-lj-blue.png" alt="" />
          <span class="title">{{ systemInformation.name }}</span>
        </div>
        <div class="login-box-content">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="账号登录" name="accountLogin"
              >账号登录</el-tab-pane
            >
            <!-- <el-tab-pane label="短信登录" name="phoneNumberLogin"
                            >短信登录</el-tab-pane
                        > -->
          </el-tabs>
          <div class="tab-content">
            <!--    账号登录      -->
            <AccountLogin
              :systemInformation="systemInformation"
              v-if="activeName === 'accountLogin'"
            />
            <!--    短信登录      -->
            <!-- <PhoneNumberLogin
                            v-if="activeName === 'phoneNumberLogin'"
                        /> -->
            <!--    验证码登录      -->
          </div>
        </div>
        <div class="login-box-footer">
          <!-- <div class="footer-title">忘记密码请联系管理员</div> -->
        </div>
      </template>
      <!--   二维码登录   -->
      <template v-else>
        <CodeLogin />
      </template>
    </div>
    <div class="Super_Big" v-if="qrCodeShow">
      <i class="el-icon-close dialog__close" @click="qrCodeShow = false"></i>
    </div>
  </div>
</template>

<script>
import AccountLogin from '@/views/Login/components/AccountLogin.vue'
import PhoneNumberLogin from '@/views/Login/components/PhoneNumberLogin.vue'
import CodeLogin from '@/views/Login/components/CodeLogin.vue'

export default {
  name: 'Login',
  props: ['tenant'],
  components: {CodeLogin, PhoneNumberLogin, AccountLogin},
  data() {
    return {
      activeName: 'accountLogin',
      systemInformation: {},
      qrCodeShow:false,
    }
  },
  created() {},
  mounted() {
    let tenant = this.tenant ? this.tenant : 'platform'
    let url = '${uc}/uc/tenantManage/v1/getTenantByCode?code=' + tenant
    this.$http.get(url).then(resp => {
      this.systemInformation = resp.data || {}
    })
  },
  methods: {
    handleClick() {}
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-icon-close:before{
  font-size: 24px !important;
}
.title-box{
  font-size: 30px;
  font-weight: 500;
  color: #c1d0df;
  text-align: left;
  padding: 0 40px;
  box-sizing: border-box;
}
.title{
  font-size: 1.17em;
}
.little_code{
  position: absolute;
  top: 30px;
  right: 40px;
  width: 60px;
  height: 60px;
  cursor: pointer;
  background: url('~@/assets/img/qrCode.png') no-repeat;
}
.qrCodeBgStyle{
  position: absolute;
  display: none;
  top: 10px;
  width: 130px;
  right: 110px;
}
.little_code:hover + .qrCodeBgStyle{
  display: block;
}
.Super_Big{
  position: fixed;
  top: 10vh;
  left: 50%;
  z-index: 9999;
  width: 80vh;
  height: 80vh;
  background: url('~@/assets/img/qrCodeBg.png') no-repeat 50%;
  background-size: cover;
  transform: translateX(-50%);
  .dialog__close{
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    color: #fff;
  }
}

.login {
  width: 100%;
  height: 100%;
  background: url('~@/assets/img/login/bg.jpg') no-repeat 0 0;
  background-size: 100% 100%;
  //background-size: cover;
  position: relative;
  user-select: none;

  .welcome-text {
    position: absolute;
    left: 4%;
    top: 4.5%;
    width: 500px;
    user-select: none;
    -webkit-user-drag: none;
  }

  .login-box {
    width: 550px;
    //min-height: 500px;
    // background-color: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    right: 11%;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    background: rgba(79, 161, 255, 0.05);
    border: 1px solid rgba(30, 149, 255, 0.3);
    box-shadow: rgba(50, 50, 93, 0.25) 0 6px 12px -2px,
      rgba(0, 0, 0, 0.3) 0 3px 7px -3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;

    .login-change {
      position: absolute;
      width: 70px;
      top: 5px;
      right: 5px;
      cursor: pointer;
    }

    .login-box-header {
      display: flex;
      align-items: center;
      justify-content: center;
      font-family: PingFangSC-Medium;
      color: rgb(18, 100, 189);
      flex-direction: column;
      row-gap: 20px;
      padding: 40px 0 50px 0;

      .title {
        font-size: 30px;
        text-align: center;
        font-family: PingFang SC;
        font-weight: bold;
        color: #c1d0df;
      }

      img {
        width: 120px;
      }
    }

    .login-box-content {
      padding: 0 40px;
      display: flex;
      flex-direction: column;

      ::v-deep .el-input__inner {
        border: 0.10417vw solid rgba(30, 149, 255, 0.4) !important;
        color: #fff;
      }
      ::v-deep .el-tabs {
        height: auto;
        .el-tabs__header {
          margin-bottom: 30px;

          .el-tabs__nav-wrap {
            &::after {
              background-color: transparent;
            }
          }

          .el-tabs__active-bar {
            color: rgb(18, 100, 189);
            height: 2.5px;
          }

          .el-tabs__item {
            height: 45px;
            padding: 0 10px;
            font-size: 18px;
            transition: all 0.2s;

            &:nth-child(2) {
              padding-left: 0;
            }

            &:hover {
              color: rgb(18, 100, 189);
            }

            &.is-active {
              color: rgb(18, 100, 189);
            }
          }
        }

        .el-tabs__content {
          display: none;
        }
      }

      .tab-content {
        flex: 1;
      }
    }

    .login-box-footer {
      flex: 1;
      padding: 20px 0;

      .footer-title {
        text-align: center;
        font-family: PingFangSC-Medium;
        font-size: 15px;
        margin-bottom: 20px;
      }
    }
  }
}
</style>
