<template>
  <div id="app">
    <router-view v-if="signIn"></router-view>
  </div>
</template>

<script>
import { getXAccessToken } from "@/api/index";
export default {
  name: "App",
  components: {},
  data() {
    return {
      signIn: false,
    };
  },
  methods: {
    getXAccessToken() {
      if (this.$route.query.token_code != localStorage.getItem("token")) {
        getXAccessToken(this.$route.query.token_code).then((res) => {
          if (res.status == 200) {
            localStorage.setItem("token", this.$route.query.token_code);
            localStorage.setItem("Authorization", res.data.access_token);
            this.$nextTick(() => {
              this.signIn = true;
            });
          }
        });
      } else {
        this.signIn = true;
      }
    },
  },
  mounted() {
    this.getXAccessToken();
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
}
body {
  margin: 0px;
  background: url(assets/background.png) no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
  min-height: 100vh;
}
#app {
  height: 100%;
}

*::-webkit-scrollbar {
  display: none;
}
</style>
