<template>
  <div class="sso">
    <h2>正在跳转...</h2>
  </div>
</template>

<script>
export default {
  mounted() {
    let token = this.$route.query.token;
    console.log("token:" + token);
    if (token) {
      window.sessionStorage.setItem("token", token);
      this.$route.query.sysName
        ? localStorage.setItem("sysName", this.$route.query.sysName)
        : "";
      this.$route.query.sysName
        ? (document.title = this.$route.query.sysName)
        : "";
      this.$route.query.sysLogo
        ? localStorage.setItem("sysLogo", this.$route.query.sysLogo)
        : "";

      this.$router.push("/index"); // 有token直接跳转首页
    } else {
      this.$message({
        message: "没有权限，正在跳转登录页面...",
        center: true,
      });
      setTimeout(function() {
        window.location.href =
          process.env.VUE_APP_PORTAL_URL == "undefined"
            ? "http://192.168.0.98:11072"
            : process.env.VUE_APP_PORTAL_URL;
        //this.$router.push('/login')
      }, 3000);
    }
  },
};
</script>

<style>
.sso {
  width: 300px;
  height: 100px;
}
</style>
