<template>
  <GlobalHeader v-if="globalVisibility"/>
  <div class="main-body">
    <router-view/>
  </div>
  <GlobalFooter v-if="globalVisibility"/>
</template>

<script>

import GlobalHeader from "@/components/GlobalHeader/GlobalHeader.vue";
import GlobalFooter from "@/components/GlobalFooter";

export default {
  components: {GlobalFooter, GlobalHeader},
  created() {
    const that = this;
    if (sessionStorage.token) {
      that.$store.commit("storage_load_user");
      that.$store.commit("storage_delete_user");
    }
    window.onbeforeunload = function () {
      if (that.$store.state.user.token) {
        that.$store.commit("storage_save_user");
      }
      return null;
    };
  },
  computed:{
    globalVisibility(){
      const pageRoutes = ["/login", "/completephone"];
      return pageRoutes.indexOf(this.$route.path) === -1;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "main.css";
/*Zhurui修改，消除底部对主体元素的覆盖*/
.main-body {
  //margin-bottom: 250px;
}
</style>

<style>
html{
  height: 100%;
}

body{
  height: 100%;
}

#app{
  min-height: calc(100% - 220px);
  position: relative;
}

/*规定门户所有的Tag的样式*/
.el-tag {
  border-radius: 15px;
}
</style>
