<template lang="html">
  <div clss="">
    <center-navbar :user="userInfo"></center-navbar>
    <div class="p-wrap-full m-content clear body-bg">
      <center-menu :user="userInfo"></center-menu>
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
import { mapGetters,mapActions } from "vuex";
import CenterNavbar from "./components/navbar/index.vue";
import CenterMenu from "./components/menu/index.vue";

export default {
  components: {
    CenterNavbar,
    CenterMenu
  },
  data() {
    return {
    };
  },
  computed: {
  	...mapGetters("user", ["userInfo"])
  },
  created(){
    this.loadAllPromise()
  },
  beforeMount(){
    console.log("enter", this.userInfo )
    if( !this.userInfo || !this.userInfo.token){
      this.doLogout().then( res=>{
        this.$router.push('/')
      })
    }
  },
  methods: {
    ...mapActions("user", ["loadBaseInfo", "doLogout", "loadAllPromise"]),
    handleCommand(command) {
      if (command == "exit") {
        this.doLogout().then( res=>{
          this.$router.push('/')
        } )
      }
    }
  }
};
</script>
<style lang="css">
  .m-right-block .right-block-bd {
    padding: 13px 20px;
  }

</style>
