<template>
  <div class="banner">
    <div class="block">
      <el-carousel indicator-position="none" arrow="never">
        <el-carousel-item v-for="item in 3" :key="item">
          <div class="wrap">
            <button class="ask-for" @click="goApply()">申请经纪商</button>
          </div>
        </el-carousel-item>
      </el-carousel>
      <div class="wrap-block">
        <LoginWindow></LoginWindow>
      </div>
      <div :class="{'black-line':true,'fix-bottom':scrolled}">
        <button class="line-button" @click="goApply()">申请经纪商</button>
        <span class="phoneNum">热线电话：+86 173 5471 8363</span>
      </div>

    </div>

  </div>
</template>

<script>
import LoginWindow from './LoginWindow'
export default {
  name: 'Banner',
  components: {LoginWindow},
  data () {
    return {
      scrolled:false
      }
    },
  methods:{
    handleScroll () {
      if (window.scrollY > 900) {
        this.scrolled = true;
      }else{
        this.scrolled = false;
      }
    },
    goApply: function () {
          this.$router.push('/apply')
        }
      },
  mounted () {
    window.addEventListener('scroll', this.handleScroll)
  }
}
</script>

<style scoped>
  .banner{
    text-align: left;
  }
  .el-carousel__item{
    background-size: auto 100%;
  }

  .el-carousel__item:nth-of-type(1) {
    background: url("../../static/images/banner1/banner.png") no-repeat 50%;
    background-size: auto 100%;
  }

  .el-carousel__item:nth-of-type(2) {
    background: url("../../static/images/banner1/banner1.png")  no-repeat 50%;
    background-size: auto 100%;
  }
  .el-carousel__item:nth-of-type(3) {
    background: url("../../static/images/banner1/banner2.png")  no-repeat 50%;
    background-size: auto 100%;
  }
  button.ask-for{
    margin: 425px 0 0 8px;
    width: 150px;
    height: 40px;
    font-size: 16px;
    color: #1f52c9;
    background: #fede00;
    border: none;
    cursor: pointer;
  }
  .wrap-block{
    width: 1200px;
    margin: 0 auto;
    position: absolute;
    left: 50%;
    margin-left: -600px;
    top: 0;
    margin-top: 180px;
  }
  .black-line{
    height: 100px;
    background-color: rgba(0,0,0,.5);
    width: 100%;
    margin: 0 auto;
    line-height: 100px;
    position: absolute;
    top: 800px;
    z-index: 100;
    text-align: center;
  }
  .fix-bottom{
    position: fixed;
    bottom: 0;
    top: auto;
  }
  .line-button{
    width: 140px;
    height: 40px;
    border-radius: 20px;
    border: 0;
    font-size: 18px;
    font-weight: 700;
    margin-right: 60px;
    cursor: pointer;
    background-color: #1a6fa6;
    color: #fff;
  }
  .phoneNum{
    color: #fff;
    font-size: 25px;
    font-weight: 700;
  }
</style>
