<template>
  <div id="frame">
    <el-container style="height:100vh">
      <el-header class="header">
        <el-col :span="20" class="left">
          环南湖科创先导区双创服务平台-管理中心
        </el-col>
        <el-col :span="4" class="right">
          <span>{{ user ? user.name : '游客' }}</span>
          <span @click="logoutBtn"><i class="el-icon-switch-button"></i></span>
        </el-col>
      </el-header>
      <el-container class="container">
        <el-aside width="200px" class="aside">
          <el-menu
            :default-active="$route.path"
            class="el-menu-vertical-demo"
            background-color="#242f42"
            text-color="#fff"
            active-text-color="#409eff"
            router
            overflow-y:
            scroll
          >
            <el-menu-item index="/adminCenter/homeIndex">首页</el-menu-item>
            <el-menu-item index="/adminCenter/news">新闻管理</el-menu-item>
            <el-menu-item index="/adminCenter/product">科技成果管理</el-menu-item>
          </el-menu>
        </el-aside>
        <el-main class="main">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'frame',
  props: {},
  components: {},
  data: function() {
    return {};
  },
  created() {},
  methods: {
    // 退出登录
    logoutBtn() {
      localStorage.removeItem('token');
      this.$router.push({ path: '/' });
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  border-bottom: 1px solid #f1f1f1;
  background-color: #242f42;
  .left {
    height: 60px;
    line-height: 60px;
    font-size: 25px;
    font-family: cursive;
    font-weight: bold;
    color: #fff;
  }
  .right {
    height: 60px;
    line-height: 60px;
    font-size: 20px;
    text-align: right;
    color: #fff;
    span {
      padding: 0 10px;
      i {
        font-weight: bold;
      }
    }
    span:hover {
      cursor: pointer;
      i {
        color: #ff0000;
      }
    }
  }
}
.container {
  .aside {
    background-color: #242f42;
  }
}
</style>
