<template>
  <div class="bottom">
    <!-- <div
      class="item"
      @click="clickItem('/')"
      :class="{ active: $route.path === '/' }"
    >
      <p>首页</p>
    </div>
    <div
      class="item"
      @click="clickItem('/b')"
      :class="{ active: $route.path === '/b' }"
    >
      <p>学习中心</p>
    </div> -->
    <el-row class="tac">
      <el-col :span="12">
        <el-menu
          :default-active="path"
          background-color="#fff"
          text-color="#777"
          active-text-color="#fff"
          router
        >
          <el-menu-item index="/course">
            <div class="img" v-if="path == '/course'">
              <img src="../../assets/icon/course-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/course.png" alt="" />
            </div>
            <span>课程课程管理</span>
          </el-menu-item>
          <el-menu-item index="/student">
            <div class="img" v-if="path == '/student'">
              <img src="../../assets/icon/student-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/user.png" alt="" />
            </div>
            <span slot="title">学生管理</span>
          </el-menu-item>
          <el-menu-item index="/works">
            <div class="img" v-if="path == '/works'">
              <img src="../../assets/icon/work-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/works.png" alt="" />
            </div>
            <span slot="title">评价管理</span>
          </el-menu-item>
          <el-menu-item index="/class">
            <div class="img" v-if="path == '/class'">
              <img src="../../assets/icon/class-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/class.png" alt="" />
            </div>
            <span slot="title">班级管理</span>
          </el-menu-item>
          <el-menu-item index="/data">
            <div class="img" v-if="path == '/data'">
              <img src="../../assets/icon/data-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/data.png" alt="" />
            </div>
            <span slot="title">我的资料</span>
          </el-menu-item>
          <el-menu-item index="/notice">
            <div class="img" v-if="path == '/notice'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">通知公告</span>
          </el-menu-item>
          <el-menu-item index="/library">
            <div class="img" v-if="path == '/library'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">素材库</span>
          </el-menu-item>
          <el-menu-item index="/classRoom">
            <div class="img" v-if="path == '/classRoom'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">课堂备课</span>
          </el-menu-item>
          <el-menu-item index="/liveRoom">
            <div class="img" v-if="path == '/liveRoom'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">实时课堂</span>
          </el-menu-item>
          <el-menu-item index="/addPPt">
            <div class="img" v-if="path == '/addPPt'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">添加备课</span>
          </el-menu-item>
          <el-menu-item index="/studyLibrary">
            <div class="img" v-if="path == '/studyLibrary'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">学习资料</span>
          </el-menu-item>
          <el-menu-item index="/GridList">
            <div class="img" v-if="path == '/GridList'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">思维网格列表</span>
          </el-menu-item>
          <el-menu-item index="/wordList">
            <div class="img" v-if="path == '/wordList'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">思维网格列表</span>
          </el-menu-item>
          <el-menu-item index="/Ttype">
            <div class="img" v-if="path == '/Ttype'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">分组管理</span>
          </el-menu-item>
          <el-menu-item index="/banner">
            <div class="img" v-if="path == '/banner'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">Banner管理</span>
          </el-menu-item>
          <el-menu-item index="/eventCenter">
            <div class="img" v-if="path == '/eventCenter'">
              <img src="../../assets/icon/new-active.svg" alt="" />
            </div>
            <div class="img" v-else>
              <img src="../../assets/icon/notice.png" alt="" />
            </div>
            <span slot="title">赛事中心管理</span>
          </el-menu-item>
          <!-- <el-menu-item index="/ask">
            <div class="img" v-if="path == '/ask'">
              <img
                src="../../assets/icon/ask-active.png"
                style="width: 110%; height: 110%; margin-left: -3px"
                alt=""
              />
            </div>
            <div class="img" v-else>
              <img
                src="../../assets/icon/ask.png"
                style="width: 110%; height: 110%; margin-left: -3px"
                alt=""
              />
            </div>
            <span slot="title">问卷调查</span>
          </el-menu-item> -->
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: {
    luyou: Number,
  },
  data() {
    return {
      path: this.$route.path,
    };
  },
  methods: {
    clickItem: function (path) {
      this.$router.push(path);
    },
  },
  watch: {
    luyou: {
      handler(n, o) {
        this.path = this.$route.path;
      },
      deep: true, // 深度监听父组件传过来对象变化
    },
  },
};
</script>

<style scoped>
.bottom {
  position: absolute;
  left: 20px;
  margin-top: 20px;
  background-color: #fff;
  width: 180px;
  height: calc(100% - 100px);
  min-height: 500px;
  z-index: 999;
  display: inline-block;
  border-radius: 5px;
  overflow: hidden;
}
.item {
  margin: 5px 20%;
  float: left;
}
.item p {
  margin: 0;
  font-size: 15px;
}
.active {
  color: #108b70;
}
.bottom >>> .el-menu-item.is-active {
  background: #3d67bc !important;
}
.tac >>> .el-col-12 {
  width: 100%;
}
.tac >>> .el-menu {
  border-right: none;
}
.tac >>> .el-menu-item {
  display: flex;
  justify-content: center;
  align-items: center;
}
.img {
  width: 20px;
  padding-right: 5px;
  padding-bottom: 3px;
}
.img > img {
  width: 100%;
  height: 100%;
}
</style>
