<template>
  <div
    class="details-margin-top-120 islogin"
    v-loading="isLoading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading"
    element-loading-background="rgba(0, 0, 0, 0.5)"
  ></div>
</template>

<script>
import Login from '@/pages/login/index.vue'
import Apply from '@/pages/apply/index.vue'
export default {
  name: 'apply-for',
  components: { Login, Apply },
  data() {
    return {
      isLoading: true,
      UserInfo: {}
    }
  },
  methods: {
    setData() {
      const self = this
      this.isLoading = true
      setTimeout(() => {
        this.UserInfo = window.G.UserInfo
        if (
          this.UserInfo &&
          this.UserInfo.data &&
          Object.keys(this.UserInfo.data).length > 0
        ) {
          this.$router.push({
            name: 'apply'
          })
        } else {
          this.$router.push({
            name: 'login'
          })
        }
        self.isLoading = false
      }, 200)
    }
  },
  mounted() {
    this.setData()
  }
}
</script>

<style lang="scss" scoped>
.islogin {
  height: 100%;
  width: 100%;
}
</style>
