<template>
  <div id="app" v-if="showPage">
    <router-view></router-view>
  </div>
</template>

<script>
import '../../common/css/reset.css'
import { mapState, createNamespacedHelpers } from 'vuex'
const { mapActions: actions } = createNamespacedHelpers('userCenter')
export default {
  name: 'app',
  data () {
    return {
      showPage: false
    }
  },
  components: {},
  computed: {
    ...mapState({
      userInfo: x => x.userCenter.userInfo,
      org: x => x.app.orgId
    })
  },
  created () {
    if (location.search && this.toolClass.UrlSearch(location.search).code) {
      this.code = this.toolClass.UrlSearch(location.search).code
    } else {
      this.code = null
    }
    this.getUserInfo({ org: this.org, code: this.code }).then(() => {
      this.showPage = true
    })
  },
  methods: {
    ...actions(['getUserInfo'])
  }
}
</script>

<style>
#app {
  width: 100%;
  height: 100%;
  position: relative;
}
</style>
