<template>
  <div>
    <el-card style="width: 90%;margin-left: 5%;margin-top: 20px">
      <h3>内部登录中...</h3>
    </el-card>
  </div>
</template>

<script>

export default {
  name: "innerLoginPage",
  // beforeRouteEnter(to, from, next) {
  //   console.log(from)
  //   if (to.params.flush || to.query.flush) {
  //     next(vm => {
  //       if (from.fullPath.includes('sso')){
  //         this.loginBack()
  //       }
  //     })
  //   } else {
  //     next(vm => {
  //       if (from.fullPath.includes('sso')){
  //         this.loginBack()
  //       }
  //     })
  //   }
  // },
  mounted() {
    console.log(document.referrer)
    console.log(document)
    if (document.referrer.includes('sso')){
      this.loginBack()
    }
  },
  methods: {
    //登录成功回调
    loginBack() {
      console.log('内部登录')
      this.$store.dispatch('user/innerLogin').then(() => {
        this.$router.push({path: this.redirect || '/'})
      }).catch((res) => {
        window.open(process.env.VUE_APP_LOGIN_PAGE, '_self')
      })

    }
  }
}
</script>

<style scoped>

</style>
