<template>
  <div>
    <div class="top">
      <Menu class="menu"/>
      <img :src="logo" alt="" class="logo" @click="toIndex">
      <Search/>
    </div>
    <div class="shadow">
    </div>
    <div class="content" id="content">
      <router-view></router-view>
    </div>
    <div class="FloatingWindow">
      <div class="item mailAn">
        <i class="el-icon-message" style="color:#fff;font-size: 20px"></i>
        <div class="mail">hwwlxxxxxxxx@xxxx.con</div>
      </div>
      <div class="item">
        <img :src="qrcode" alt="" width="30px" height="30px" style="vertical-align: middle;">
        <div class="qrcode">
          <img :src="qrcode" alt="" width="100px" height="100px" style="vertical-align: middle;">
        </div>
      </div>
      <div class="item" @click="toService" style="cursor: pointer;">
        <i class="el-icon-chat-dot-square" style="color:#fff;font-size: 20px"></i>
      </div>
      <div class="item" @click="toTop" style="cursor: pointer;line-height: 20px">
        <i class="el-icon-caret-top" style="color:#fff;font-size: 20px"></i>
        <div style=" color: #fff">top</div>
      </div>
    </div>
    <Chat/>
  </div>
</template>

<script>
import qrcode from '@/assets/icon/QRCode.png'
import Menu from '@/components/menu/index'
import Search from '@/components/search/index'
import Chat from "@/components/chat/index.vue";
import logo from '@/assets/logo.png'

export default {
  name: 'Index',
  components: {
    Menu,
    Chat,
    Search
  },
  methods: {
    toIndex(){
      this.$router.push('/index')
    },
    toTop() {
      // window.scrollTo({top: 0, behavior: 'smooth'});
      document.getElementById('content').scrollTo({
        top: 0,
        behavior: 'smooth'
      });
    },
    toService() {
      this.$router.push('/serviceSupport')
    },
  },
  mounted() {
  },
  data() {
    return {
      logo,
      qrcode,
    }
  }
}
</script>

<style lang="less" scoped>
@import "~@/style.less";

.top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: @top-height;
  background-image: radial-gradient(transparent 1px, #fff 1px);
  backdrop-filter: saturate(50%) blur(4px);
  z-index: 2;
}
.shadow{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: @top-height;
  box-shadow: 0 -30px 40px rgba(0, 0, 0, 0.8);
  z-index: 3;
  pointer-events: none
}

.menu {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 100%;
  transform: translateX(-50%);
  z-index: 4;
}

.logo {
  position: absolute;
  top: 50%;
  left: 3%;
  transform: translateY(-50%);
  height: 50%;
  cursor: pointer;
}

.experience {
  position: absolute;
  top: 0;
  right: 0;
  width: 9vw;
  height: 100%;
  font-size: 1vw;
  letter-spacing: 2px;
  line-height: @top-height;
  text-align: center;
  color: #fff;
  background-color: #3372ff;
  cursor: pointer;
}

.content {
  position: absolute;
  top: @top-height;
  left: 0;
  width: 100%;
  height: calc(100vh - @top-height);
  z-index: 1;
  overflow: auto;
}

.FloatingWindow {
  z-index: 999;
  position: fixed;
  bottom: 10%;
  right: 0;
  //transform: translateY(-50%);

  .item {
    margin-bottom: 1px;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    width: 50px;
    height: 50px;
    background-color: #41B5EA;
    text-align: center;
    line-height: 50px;
    position: relative;

    .mail {
      position: absolute;
      top: 0;
      left: 50px;
      height: 50px;
      line-height: 50px;
      width: 150px;
      color: #fff;
      background-color: #41B5EA;
      font-size: 12px;
    }

    &:hover {
      .qrcode {
        display: block;
      }
    }

    .qrcode {
      position: absolute;
      top: -30px;
      right: 60px;
      height: 120px;
      line-height: 120px;
      width: 120px;
      background-color: #41B5EA;
      display: none;
    }
  }

  .mailAn {
    transition: all 0.3s ease-in-out;

    &:hover {
      transform: translateX(-150px);
    }
  }
}

</style>
