<template>
  <div v-loading.body.fullscreen="fullscreenLoading" element-loading-background="rgba(255, 255, 255, 0)">
    <joined v-if="status == 2 && loaded"/>
    <homeView v-if="status != 2 && loaded" :status="status"/>
  </div>
</template>
<script>
import { getAgent } from "@/api/user";
import homeView from "./home/index.vue";
import joined from "./joined/index";
export default {
  components: {
    homeView,
    joined
  },
  data () {
    return {
      uid: '',
      status: '',
      loaded: false
    }
  },
  created () {
    this.uid = this.$route.params.uid
    this.getAgent()
  },
  methods: {
    getAgent() {
      this.fullscreenLoading = true
      getAgent({
        uid: this.uid
      }).then((res) => {
        this.status = res
      }).catch((err) => {
        if (err.code == 4000) {
          this.$notify({
            // message: '账号不存在',
            message: this.$t('join.l39'),
            type: 'danger',
            duration: 1500
          })
        }
      }).finally(() => {
        this.fullscreenLoading = false
        this.loaded = true
      })
    }
  }
}
</script>
<style lang="less" scoped>
</style>