<template>
  <div v-if="isDisplay" class="body">
    <div class="download_component" style="display: block">
      <div class="float_logo"></div>
      <div class="download_web">
        <div class="header_box">
          <div class="qrcode_box">
            <vue-qr :text="url" :size="220"></vue-qr>
          </div>
          <div class="title_img"></div>
        </div>
        <img class="mian_img" src="../assets/images/web-main-img.png.webp" />
      </div>
    </div>
  </div>
</template>

<script>
import VueQr from "vue-qr";
export default {
  name: "IndexPage",
  components: { VueQr },
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) {
        vm.$router.push({ name: "m_index" });
      } else {
        vm.isDisplay = true;
      }
    });
  },
  data() {
    return {
      isDisplay: false,
    };
  },
  computed: {
    url() {
      return location.href;
    },
  },
};
</script>
<style>
body {
  margin: 0;
  padding: 0;
}
</style>
<style scoped>
.body {
  width: 100%;
  height: 100%;
}
.download_component {
  width: 100%;
  height: 100%;
}
.float_logo {
  background: url(../assets/images/web-float-logo.png.webp);
  position: fixed;
  left: 0;
  top: 0;
  background-size: 100% 100%;
  width: 184px;
  height: 195px;
  z-index: 1;
}
.download_web {
  width: 100%;
  height: 100vh;
  margin: 0 auto;
  background: url(../assets/images/web-bg.jpg.webp) top center no-repeat;
  background-size: cover;
  background-position: center bottom;
  overflow: auto;
}
.header_box {
  padding-top: 50px;
  display: flex;
  justify-content: center;
}
.qrcode_box {
  margin-top: 35px;
  width: 236px;
  height: 238px;
  margin-right: 87px;
  border-radius: 10px;
  box-shadow: 0 5px 12px 0 rgb(0 0 0 / 13%);
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.title_img {
  background: url(../assets/images/web-title-img.png.webp);
  margin-top: 17px;
  width: 326px;
  height: 270px;
  background-size: 100% 100%;
}
.mian_img {
  height: calc(100% - 390px);
  width: auto;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
</style>
