leftBar.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="bottom">
  3. <!-- <div
  4. class="item"
  5. @click="clickItem('/')"
  6. :class="{ active: $route.path === '/' }"
  7. >
  8. <p>首页</p>
  9. </div>
  10. <div
  11. class="item"
  12. @click="clickItem('/b')"
  13. :class="{ active: $route.path === '/b' }"
  14. >
  15. <p>学习中心</p>
  16. </div> -->
  17. <el-aside style="width: 180px; font-size: 16px">
  18. <el-row class="tac">
  19. <el-col :span="12">
  20. <el-menu
  21. :default-active="path"
  22. background-color="#fff"
  23. text-color="#777"
  24. active-text-color="#fff"
  25. router
  26. style="text-align: left"
  27. >
  28. <el-menu-item index="/">
  29. <div class="img" style="padding-bottom: 5px" v-if="path == '/'">
  30. <img src="../../assets/icon/home-active.png" alt="" />
  31. </div>
  32. <div class="img" style="padding-bottom: 5px" v-else>
  33. <img src="../../assets/icon/home.png" alt="" />
  34. </div>
  35. <span>首页管理</span>
  36. </el-menu-item>
  37. <el-menu-item index="/curriculum">
  38. <div class="img" v-if="path == '/curriculum'">
  39. <img src="../../assets/icon/course-active.png" alt="" />
  40. </div>
  41. <div class="img" v-else>
  42. <img src="../../assets/icon/course.png" alt="" />
  43. </div>
  44. <span slot="title">课程管理</span>
  45. </el-menu-item>
  46. <el-menu-item index="/template">
  47. <div class="img" v-if="path == '/template'">
  48. <img src="../../assets/icon/works-active.png" alt="" />
  49. </div>
  50. <div class="img" v-else>
  51. <img src="../../assets/icon/works.png" alt="" />
  52. </div>
  53. <span slot="title">模板管理</span>
  54. </el-menu-item>
  55. <el-menu-item index="/notice">
  56. <div class="img" v-if="path == '/notice'">
  57. <img src="../../assets/icon/notice-active.png" alt="" />
  58. </div>
  59. <div class="img" v-else>
  60. <img src="../../assets/icon/notice.png" alt="" />
  61. </div>
  62. <span slot="title">通知公告</span>
  63. </el-menu-item>
  64. <el-menu-item index="/grouping">
  65. <div class="img" v-if="path == '/grouping'">
  66. <img src="../../assets/icon/group-active.png" alt="" />
  67. </div>
  68. <div class="img" v-else>
  69. <img src="../../assets/icon/group.png" alt="" />
  70. </div>
  71. <span slot="title">分组管理</span>
  72. </el-menu-item>
  73. <el-menu-item index="/organization">
  74. <div class="img" v-if="path == '/organization'">
  75. <img src="../../assets/icon/class-active.png" alt="" />
  76. </div>
  77. <div class="img" v-else>
  78. <img src="../../assets/icon/class.png" alt="" />
  79. </div>
  80. <span slot="title">组织管理</span>
  81. </el-menu-item>
  82. <el-menu-item index="/class">
  83. <div class="img" v-if="path == '/class'">
  84. <img src="../../assets/icon/class-active.png" alt="" />
  85. </div>
  86. <div class="img" v-else>
  87. <img src="../../assets/icon/class.png" alt="" />
  88. </div>
  89. <span slot="title">班级管理</span>
  90. </el-menu-item>
  91. </el-menu>
  92. </el-col>
  93. </el-row>
  94. </el-aside>
  95. </div>
  96. </template>
  97. <script>
  98. export default {
  99. props: {
  100. luyou: Number,
  101. },
  102. data() {
  103. return {
  104. path: this.$route.path,
  105. };
  106. },
  107. methods: {
  108. clickItem: function (path) {
  109. this.$router.push(path);
  110. },
  111. },
  112. watch: {
  113. luyou: {
  114. handler(n, o) {
  115. this.path = this.$route.path;
  116. },
  117. deep: true, // 深度监听父组件传过来对象变化
  118. },
  119. },
  120. };
  121. </script>
  122. <style scoped>
  123. .bottom {
  124. position: absolute;
  125. left: 20px;
  126. margin-top: 20px;
  127. background-color: #fff;
  128. width: 180px;
  129. height: calc(100% - 100px);
  130. min-height: 500px;
  131. z-index: 999;
  132. display: inline-block;
  133. border-radius: 5px;
  134. overflow: hidden;
  135. }
  136. .item {
  137. margin: 5px 20%;
  138. float: left;
  139. }
  140. .item p {
  141. margin: 0;
  142. font-size: 15px;
  143. }
  144. .active {
  145. color: #108b70;
  146. }
  147. .bottom >>> .el-menu-item.is-active {
  148. background: #3d67bc !important;
  149. }
  150. .tac >>> .el-col-12 {
  151. width: 100%;
  152. }
  153. .tac >>> .el-menu {
  154. border-right: none;
  155. }
  156. .tac >>> .el-menu-item {
  157. display: flex;
  158. /* justify-content: center; */
  159. align-items: center;
  160. font-size: 16px;
  161. padding-left: 40px !important;
  162. }
  163. .img {
  164. width: 20px;
  165. padding-right: 5px;
  166. /* padding-bottom: 5px; */
  167. }
  168. .img > img {
  169. width: 100%;
  170. height: 100%;
  171. }
  172. </style>