/** * Created by HaijunZhang on 2019/12/18. */
<template>
  <el-header class="common-header" :style="style">
    <div class="header-logo">
      <img :src="pageConfigs.headerLogo" alt="" class="pull-left" />
    </div>
    <el-divider class="czhj-split-line" direction="vertical"></el-divider>
    <el-icon class="home-icon" v-if="homePath" @click="goHome"><icon-ep-home-filled /></el-icon>
    <HeaderMenu :page-configs="pageConfigs"></HeaderMenu>
    <RightContent />
  </el-header>
</template>

<script lang="ts" setup>
import RightContent from './RightContent.vue'
import HeaderMenu from './HeaderMenu.vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'

const store = useStore()
const pageConfigs = computed(() => store.getters.pageConfig)
const style = computed(() => {
  return {
    backgroundColor: pageConfigs.value.headerBgColour,
    color: pageConfigs.value.headerFontColour
  }
})
const homePath = computed(() => `${store.getters.appConfigs.homePath}`)
const router = useRouter()
function goHome () {
  router.push(`${homePath.value}?date=${new Date().getTime()}`)
}
</script>

<style lang="scss" scoped>
.common-header {
  display: flex;
  align-items: center;
  -webkit-box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  box-sizing: border-box;
  width: 100%;
  height: 50px !important;
  font-size: 22px;
  padding: 0 0 0 10px;
  overflow: hidden;
  background: #2c2e3b;
  color: #b9b9ba;
  & :deep(.el-dropdown) {
    color: inherit !important;
  }
  .header-logo {
    min-width: 120px;
    max-width: 260px;
    img {
      height: 30px;
      margin: 4.5px 10px;
    }
  }
  .home-icon {
    font-size: 18px;
    margin-right: 15px;
    cursor: pointer;
  }
  .czhj-split-line {
    height: 20px;
    margin-left: 30px;
    margin-right: 15px;
    border-color: #999999;
  }
  .toggle-class {
    height: 50px;
    line-height: 43px;
    cursor: pointer;
    margin-left: 15px;
  }
}
</style>
