<template>
  <div class="logout">
    <loading/>
    <p>退出中，请稍后...</p>
  </div>
</template>

<script>
  import Loading from '~components/common/loading/Loading.vue'
  export default {
    name: 'logout',
    layout: 'mobile',
    components: {
      Loading
    },
    mounted () {
      this.$nextTick(() => {
        this.logquit()
      })
    },
    methods: {
      logquit () {
        this.$http.get('/sso/login/logout', {params: this.$route.query})
          .then(response => {
            if (response.data.success) {
              for (let i = 0; i < response.data.content.logoutUrls.length; i++) {
                if (response.data.content.logoutUrls[i]) {
                  this.$jsonp(`${response.data.content.logoutUrls[i]}`, function (err) {
                    if (err) throw err
                  })
                }
              }
              setTimeout(function () {
                window.location.href = `${response.data.content.returnURL}`
              }, 1000)
            }
          })
      }
    }
  }
</script>
<style type="text/scss" lang="scss" scoped>
  .logout{
    p{
      position: fixed;
      left: 0;
      right:0;
      top: 54%;
      z-index: 1000;
      text-align: center;
      font-size: 14px;
      color:#333;
    }
  }
</style>
