<template>
  <div class="home">
    <!-- 标题栏 -->
    <HeaderCon :username="username"></HeaderCon>

    <div class="home_main">
      <div class="sider">
        <div
          :class="[current == item.name ? 'sider_item active' : 'sider_item ']"
          v-for="item in siderArr"
          :key="item.name"
          @click="changepage(item.name)"
        >
          <img
            :src="current == item.name ? item.img_select : item.img"
            alt=""
            class="sider_item_img"
          />
          <div
            :class="[
              current == item.name
                ? ' sider_item_name active '
                : 'sider_item_name',
            ]"
          >
            {{ item.name }}
          </div>
        </div>
      </div>
      
      <router-view />
    </div>
   
  </div>
</template>
<script>
import HeaderCon from "../../components/HeaderCon";
import SiderBar from "../../components/SiderBar";
export default {
  name: "home",
  data() {
    return {
      current: "首页",
      searchValue: "",
      siderArr: [
        {
          name: "首页",
          img: require("@/static/home/index/icon-nav01.png"),
          img_select: require("@/static/home/index/icon-nav01-select.png"),
        },
        {
          name: "专利",
          img: require("@/static/home/index/icon-nav02.png"),
          img_select: require("@/static/home/index/icon-nav02-select.png"),
        },
        {
          name: "企业",
          img: require("@/static/home/index/icon-nav03.png"),
          img_select: require("@/static/home/index/icon-nav03-select.png"),
        },
        {
          name: "历史记录",
          img: require("@/static/home/index/icon-nav04.png"),
          img_select: require("@/static/home/index/icon-nav04-select.png"),
        },
        {
          name: "我的关注",
          img: require("@/static/home/index/icon-nav05.png"),
          img_select: require("@/static/home/index/icon-nav05-select.png"),
        },
      ],
      followList: [],
      innovateList: [
        "山煤国际能源集团股份有限公司",
        "山煤国际能源集团股份有限公司",
        "山煤国际能源集团股份有限公司",
      ],
    };
  },
  components: {
    HeaderCon,
    SiderBar,
  },
  methods: {
    changepage(name) {
      // console.log(name)

      switch (name) {
        case "企业":
          this.$router.push({
            path: "/company",
          });
          break;
        case "首页":
          this.$router.push({
            path: "/home",
          });
          break;
        case "专利":
          this.$router.push({
            path: "/patent",
          });
          break;
        case "历史记录":
          this.$router.push({
            path: "/history",
          });
          break;
        case "我的关注":
          this.$router.push({
            path: "/follow",
          });
          break;
      }
      this.current = name;
    },
  },
  mounted() {},
  created() {
    this.username = this.$store.state.username;
  },
};
</script>
<style lang="less" scoped>
.home {
  // height: calc(100% - 80px);
  width: calc(100% );
  .home_main {
    // height: 100%;
    width: 100%;
    background-color: #ebebeb;
    display: flex;
    .home_con {
      background-color: #ebebeb;
      padding-left: 30px;
      width: calc(100% -80px);
      flex: 1;
      .nav_bread {
        height: 50px;
        padding: 20px 3px;
        background-color: #ebebeb;
      }
    }
  }
}
.sider {
  // height: calc(100% - 70px);
  background-color: #002d70;
  width: 80px;
  .sider_item {
    height: 100px;
    text-align: center;
    padding: 20px 10px 20px 0;
    .sider_item_img {
      width: 27px;
    }
    .sider_item_name {
      margin-top: 10px;
      color: #848bad;
      font-size: 14px;
      text-align: center;
    }
    .active {
      color: #fff;
    }
  }
  .active {
    background-color: #124795;
    color: #fff;
  }
}
</style>
