<template>
  <div class="rpm-login other-container" style="margin-top: 200px;  padding: 12px;">

      <div class="rpm-login-info" >
        <div data-options="novalidate:true">
          <div style="width:410px; height: 400px; background-color: #fff; position: absolute; right: 0px; top:0px;">
              <SignInForm v-if="visibleForm === 'signIn'" @show-form="showForm" />
          </div>
        </div>
      </div>

<!--
    <div >


       <div class="rpm-contact" >
        <div class="rpm-contact__title">{{settings.title}}</div>
        <div class="rpm-contact__item">
          <img src="../../assets/qrcode.jpg" fit="scale-down" lazy style="margin: 20px auto;"/>
        </div>
      </div>
      <SignInForm v-if="visibleForm === 'signIn'" @show-form="showForm" />
      <SignUpForm v-if="visibleForm === 'signUp'" @show-form="showForm" />
      <ForgotPwdForm v-if="visibleForm === 'forgotPwd'" @show-form="showForm" />
      <ResetPwdForm v-if="visibleForm === 'resetPwd'" @show-form="showForm" />
    </div> -->
  </div>
</template>

<script>
//import logo from '@/icons/img/logo.png'
import logo from '@/icons/img/logo.jpg'
import SignInForm from './components/SignInForm'
import SignUpForm from './components/SignUpForm'
import ForgotPwdForm from './components/ForgotPwdForm'
import ResetPwdForm from './components/ResetPwdForm'
import IHeader from "../other/components/IHeader";
import IFooter from "../other/components/IFooter";
import settings from '@/settings'


export default {
  name: 'Login',
  components: { SignInForm, SignUpForm, ForgotPwdForm, ResetPwdForm,IHeader, IFooter},
  data() {
    return {
      url: logo,
      visibleForm: 'signIn',
      settings
    }
  },
  watch: {
    $route: {
      handler: function(route) {
        const query = route.query
        if (query) {
          this.redirect = query.redirect
          this.otherQuery = this.getOtherQuery(query)
        }
      },
      immediate: true
    }
  },
  methods: {
    showForm(form) {
      //console.log('form', form)
      this.visibleForm = form;
    },
    getOtherQuery(query) {
      return Object.keys(query).reduce((acc, cur) => {
        if (cur !== 'redirect') {
          acc[cur] = query[cur]
        }
        return acc
      }, {})
    }
  }
}
</script>

<style lang="scss" scoped>
@import "@/styles/variables.scss";

.rpm-login {

  width: 100%;
  height: 530px;
  background-image:url('../../assets/login_bg.jpg');

  position: relative;
  margin-left: auto;
  margin-right: auto;

  .rpm-login-info{
    width: 100%;
    height: 400px;
    margin: auto;
    background-image: url("../../assets/login_bg1.png");
    position: relative;
    top:50px;
    box-shadow: 0px 1px 15px 0px rgba(20, 108, 197, 0.8);
  }

  .rpm-logo {
    padding-top: 30px;
    height: 40px;
    text-align: center;
    .el-image, .el-avatar {
      margin-right: 20px;
      background-color: $rpm-theme-color;
    }
    .rpm-logo__title {
      line-height: 40px;
      display: inline-block;
      font-size: 30px;
      font-weight: bold;
      color: $rpm-theme-color;
      overflow: hidden;
    }
  }
  .rpm-contact {
    position: absolute;
    top: 200px;
    left: 100px;
    .rpm-contact__title {
      margin-left: 0px;
      margin-bottom: 40px;
      font-size: 24px;
      font-weight: bold;
    }
    .rpm-contact__item {
      position: relative;
      margin-top: 10px;
      padding-left: 36px;
      height: 40px;
      line-height: 40px;
      font-size: 16px;
      .el-avatar {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        background-color: $rpm-theme-color;
        color: white;
      }
    }
  }
}
</style>
