<template>
  <div id="app">
    <bd-menu class="outmenu"></bd-menu>
    <router-view />
  </div>
</template>

<script>
import bdMenu from "./components/menu";
export default {
  data: () => ({}),
  components: {
    bdMenu,
  },
  methods: {
    getCurrentUser() {
      this.$api.user.getNowUser().then(({ data }) => {
        if (data.success == 1) {
          this.$store.commit("userInfofun", data.data);
        } else {
          console.log(data.errMsg);
        }
      });
    },
    getMessage() {
      this.$http
        .get("/apaas/service/v3/mymsg/unread", {
          params: {
            size: 10,
            page: 1,
          },
        })
        .then(({ data }) => {
          if (data.success === 1) {
            this.$store.commit("setUnreadMessageCount", data.data.total || 0);
          }
        });
    },
  },
  created() {
    this.getCurrentUser();
    this.getMessage();
  },
};
</script>

<style scoped>
.outmenu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
}
#app {
  background-color: #f6f7fb;
  font-size: 14px;
}
</style>
