<template>
  <!-- Login 代理页面 -->
  <div>
  </div>
</template>
<script>

export default {
  layout: 'login',
  mounted () {
    this.crossBefore()
  },
  methods: {
    async crossBefore () {
      try {
        let { data } = await this.$http.get('/logout/crossBefore')
        const params = data || {}
        this.proxyLogout(params.askUrl, params.returnUrl)
      } catch (err) {
        this.$router.replace('/')
        console.log(err)
      }
    },
    proxyLogout (askUrl, returnUrl) {
      this.$jsonp(`${askUrl}`, function (err, data) {
        if (err) throw err
        console.log(data)

        window.location.href = returnUrl && returnUrl !== 'null' ? returnUrl : '/'
      })
    }
  }
}
</script>
