<template>
  <div class="loginContainer">
    <div class="loginLogoTop">
      <div class="loginLeft">
        <img
          src="@/assets/img/logo-21249f@2x.png"
          alt="六牛科技"
          class="logoimg"
        />
        <span class="loginWordLeft"></span>
        <span class="loginWordRight">欢迎登录</span>
      </div>
    </div>
    <div class="login-wrapper">
      <div class="account-wrapper">
        <div class="account-title">
          <p
            v-if="tab_on === 'forgetPwd'"
            class="account-title-item login-title"
          >
            忘记密码
          </p>
          <p
            v-else
            class="account-title-item login-title"
            :class="[tab_on !== 'login_form' ? 'no-active' : '']"
            @click="tab_on = 'login_form'"
          >
            {{ tab_on === "login_form" ? "账号密码登录" : "账号登录" }}
          </p>
          <p
            class="account-title-item register-title"
            :class="[tab_on !== 'login_register' ? 'no-active' : '']"
            @click="tab_on = 'login_register'"
          >
            注册账户
          </p>
        </div>
      </div>
      <div class="login-container">
        <!--          登录-->
        <div v-if="tab_on === 'login_form'" class="login-com">
          <LoginView
            @forgetPwd="tab_on = 'forgetPwd'"
            @register="tab_on = 'login_register'"
          />
        </div>
        <!--          注册-->
        <div v-if="tab_on === 'login_register'">
          <RegisterView @registerSuccess="tab_on = 'login_form'" />
        </div>
        <!--          忘记密码-->
        <div v-if="tab_on === 'forgetPwd'">
          <ForgetPwd @loginTab="tab_on = 'login_form'" />
        </div>
      </div>
      <div v-if="tab_on === 'login_form' && isQN" class="scan">
        <el-popover placement="right" width="200" trigger="hover">
          <div slot="reference">
            <i class="iconfont icon-lianjie"></i>
            扫码体验六牛科技小程序
          </div>
          <img
            style="width: 150px; display: block; margin: 0 auto"
            src="@/assets/img/wxcode.jpg"
            alt="六牛科技小程序"
          />
        </el-popover>
      </div>
    </div>
    <div class="LoginBottom">
      <div class="LoginBottomT">
        {{ systemDesc }}
      </div>
      <div class="LoginBottomB">
        <div v-if="isQN" style="display: inline-block">
          <span class="LoginBottomBParticularsA">
            <a
              href="https://www.qianniaovip.com/pages/aboutus.html"
              target="_blank"
            >
              关于六牛科技
            </a>
          </span>
          <span class="LoginBottomBParticularsA">
            <a href="https://www.qianniaovip.com/index.html" target="_blank">
              用户协议
            </a>
          </span>
          <span class="LoginBottomBParticularsA">
            <a
              href="https://www.kancloud.cn/qianniaoyunshang/houtaishiyongliucheng/2002038"
              target="_blank"
            >
              帮助中心
            </a>
          </span>
          <span class="LoginBottomBParticularsA">
            <a
              href="https://www.kancloud.cn/qianniaoyunshang/houtaishiyongliucheng/2002038"
              target="_blank"
            >
              用户手册
            </a>
          </span>
        </div>
        <span class="LoginBottomBParticularsB">
          Copyright © 2019-{{ fullYear }} {{ companyName }} 版权所有
        </span>
      </div>
    </div>
  </div>
</template>
<script>
  import LoginView from "./components/login";
  import RegisterView from "./components/register";
  import ForgetPwd from "./components/forgetPwd";
  import {
    companyName,
    icCase,
    companyAddress,
    systemDesc,
    isQN,
  } from "@/config/settings";
  export default {
    name: "Login",
    components: {
      LoginView,
      RegisterView,
      ForgetPwd,
    },
    data() {
      return {
        fullYear: new Date().getFullYear(),
        tab_on: "login_form",
        case_text: icCase,
        companyAddress: companyAddress,
        systemDesc: systemDesc,
        companyName: companyName,
        isQN: isQN,
      };
    },
  };
</script>

<style scoped lang="scss">
  .loginContainer {
    font-family: SourceHanSansCN-Normal, SourceHanSansCN;
    min-height: 730px;
    height: 100vh;
    background: url("../../assets/img/marshalling5.png") no-repeat center center;
    background-size: 100% 100%;
    .loginLogoTop {
      width: 100%;
      height: 80px;
      background-color: #fff;
      position: fixed;
      top: 0;
      left: 0;
      line-height: 80px;
      .loginLeft {
        margin-left: 200px;
        .logoimg {
          height: 36px;
          cursor: pointer;
          display: inline-block;
          vertical-align: middle;
          margin-right: 6px;
        }
        .loginWordLeft {
          margin: 0 14px;
          width: 1px;
          height: 24px;
          display: inline-block;
          background-color: #e6e6e6;
          vertical-align: middle;
        }
        .loginWordRight {
          display: inline-block;
          font-size: 18px;
          vertical-align: middle;
          font-weight: 400;
        }
      }
    }
  }
  .login-wrapper {
    width: 400px;
    position: fixed;
    top: 50%;
    right: 18%;
    transform: translateY(-50%);
    .account-wrapper {
      .account-title {
        height: 66px;
        position: relative;
        transform: translateY(10px);
        .account-title-item {
          position: absolute;
          width: 276px;
          /*background: #ffffff;*/
          font-size: 18px;
          cursor: pointer;
          line-height: 66px;
          font-weight: bold;
          color: #2d405e;
          border-top-left-radius: 12px;
          border-top-right-radius: 12px;
          z-index: 1;
        }

        .login-title {
          top: 0;
          left: 0;
          padding-left: 40px;
          background: linear-gradient(
            240deg,
            transparent 50px,
            rgb(255, 255, 255) 0
          );
          &.no-active {
            padding-left: 0;
            top: 12px;
            left: 16px;
          }
        }
        .register-title {
          top: 0;
          right: 0;
          text-align: right;
          padding-right: 40px;
          background: linear-gradient(
            115deg,
            transparent 50px,
            rgb(255, 255, 255) 0
          );
          &.no-active {
            padding-right: 0;
            top: 12px;
            right: 16px;
          }
        }
        .no-active {
          z-index: -1;
          color: #ffffff;
          font-size: 16px;
          font-weight: 400;
          background: #5c79b0;
          line-height: 44px;
          width: 173px;
          text-align: center;
        }
      }
    }
    .login-container {
      width: 400px;
      padding: 30px 40px 53px;
      border-radius: 12px;
      background: #ffffff;
      position: relative;
      .login-com {
        padding-bottom: 65px;
      }
      ::-webkit-input-placeholder {
        /* WebKit browsers */
        font-size: 14px;
        font-weight: 400;
        color: #879bba;
      }

      ::-moz-placeholder {
        /* Mozilla Firefox 19+ */
        font-size: 14px;
        font-weight: 400;
        color: #879bba;
        padding-left: 16px;
      }

      :-ms-input-placeholder {
        /* Internet Explorer 10+ */
        font-size: 14px;
        font-weight: 400;
        color: #879bba;
      }
    }
    .scan {
      width: 400px;
      height: 56px;
      cursor: pointer;
      background-color: #d7e5f9;
      position: absolute;
      bottom: 0;
      left: 0;
      border-radius: 0 0 12px 12px;
      text-align: center;
      line-height: 56px;
      font-size: 14px;
      font-weight: 400;
      color: #2d405e;
      .icon-lianjie {
        font-size: 14px;
      }
    }
  }
  .LoginBottom {
    width: 100%;
    height: 98px;
    position: absolute;
    bottom: 0;
    left: 0;
    .LoginBottomT {
      width: 100%;
      height: 46px;
      background-color: #ecf0f7;
      text-align: center;
      font-size: 16px;
      line-height: 46px;
      font-weight: 400;
      color: #2d405e;
    }
    .LoginBottomB {
      width: 100%;
      height: 52px;
      background-color: #fff;
      text-align: center;
      line-height: 52px;
      font-size: 12px;
      font-weight: 400;
      color: #4f5e7b;
      .LoginBottomBParticularsA {
        margin-left: 20px;
        a {
          color: #4f5e7b;
        }
      }
      .LoginBottomBParticularsB {
        margin-left: 32px;
      }
    }
  }
  @media screen and (max-width: 1450px) {
    .login-wrapper {
      right: 10%;
    }
  }
</style>
