<template>
  <div style="display: flex;line-height: 60px;">
    <div style="margin-top: 8px;">
      <i :class="icon" style="font-size: 20px;cursor: pointer" @click="collapse"></i>
    </div>
    <div style="flex:1px;text-align: center;font-size: 34px;">
      <span>中微WMS查询平台</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "Header",
  data() {
    return {
      user: JSON.parse(sessionStorage.getItem('user'))
    }
  },
  props: {
    icon: String
  },
  methods: {
    toUser() {
      this.$router.push('/home')
    },
    logOut() {
      this.$confirm('您确认是否退出登录?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$router.replace('/login')
        sessionStorage.clear();
        this.$message({
          type: 'success',
          message: '已退出!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消操作'
        });
      });
    },
    collapse() {
      this.$emit('doCollapse')
    }
  },
  created() {
    this.$router.push('/home')
  }

}
</script>

<style scoped>

</style>
