<template>
  <div id="app">
    <Index ref="index"></Index>
  </div>
</template>

<script>
import md5 from "js-md5";
import { getToken } from "@/api/index";
import Index from "./components/Index.vue";
export default {
  components: { Index },
  name: "App",
  data() {
    return {};
  },
  methods: {},
  mounted() {
    if (
      !this.$route.query.redirectUrl ||
      this.$route.query.redirectUrl.indexOf("_") == -1
    ) {
      this.$refs.index.bindText = "url参数错误";

      return this.$message.error("url参数错误");
    }
    getToken({
      ticketId: this.$route.query.redirectUrl.split("_")[1],
    }).then((res) => {
      if (res.status == 200) {
        localStorage.setItem(
          "Authorization",
          `${res.data.token_type} ${res.data.access_token}`
        );
        this.$refs.index.autoLogin();
      }
    });
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
}
body {
  min-width: 1400px;
  margin: 0px;
}
#app {
  height: 100%;
}
</style>
