<template>
  <div class="blank-layout" v-if="show">
    <router-view></router-view>
  </div>
</template>

<script>
import { PERSON_INFO } from '@/apis/base'
export default {
  data () {
    return {
      show: false
    }
  },
  methods: {
    getUserInfo() {
      this.$post(
        PERSON_INFO,
        {},
        data => {
          sessionStorage.setItem('user', JSON.stringify(data.data))
          this.$store.commit('user', data.data)
          // 重新加载按钮权限
          Vue.prototype.$isCode = this.$getResourceCode()
          this.show = true
        },
        error => {
          this.$message.error(error.msg)
          this.show = true
        }
      )
    }
  },
  created () {
    let code = this.$route.query.code
    if (this.$route.query.code) {
      sessionStorage.setItem('token', code)
		  this.$store.commit('token', code)
      this.getUserInfo()
    }
    window.document.title = '建协云'
  }
}
</script>
