SuperComponent.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <el-col :span="24" class="">
  3. <el-col :span="2" :offset="2">
  4. <img class="logoImg" src="../assets/img/log.png"/>
  5. </el-col>
  6. <!--v-show="roles.indexOf(item.id) >= 0"-->
  7. <el-col :span="3" v-for="(item, index) of menuData" :key="item.id"
  8. @click.native="secondNavClick(item,index)" style="text-align: center">
  9. <span class="lineStyle" :class="{active:index == checkindex,menu_item:true}">{{item.name}}</span>
  10. </el-col>
  11. <el-col :span="4" class="aside-right">
  12. <div class="login">
  13. <img class="userstyle" :src="BASE_URL + avatar" alt="">
  14. <!-- <img class="userstyle" src="../assets/img/user.jpg"> -->
  15. <span>{{name}}</span>
  16. <i class="el-icon-caret-bottom"></i>
  17. </div>
  18. <div class="out">
  19. <img src="../assets/img/out.png" alt class="out-img">
  20. <span @click="Loginout">退出</span>
  21. </div>
  22. </el-col>
  23. </el-col>
  24. </template>
  25. <script>
  26. import {mapGetters} from 'vuex'
  27. export default {
  28. name: "navMenu",
  29. // props: {
  30. // navsData: Array
  31. // },
  32. data() {
  33. return {
  34. BASE_URL: "https://xt.sharingschool.com/upload/",
  35. menuData: [ {
  36. id: "1",
  37. name: "校区管理员",
  38. href: "SuperAdmin",
  39. },
  40. {
  41. id: "2",
  42. name: " 批改老师注册审核",
  43. href: "CheckTeacherAudit",
  44. },
  45. {
  46. id: "3",
  47. name: "批改老师薪酬表",
  48. href: "CheckTeacherPay",
  49. },
  50. {
  51. id: "4",
  52. name: "作业回收站",
  53. href: "HomeworkRecycle",
  54. },
  55. ],
  56. checkindex: 0
  57. };
  58. },
  59. watch: {
  60. navsData(n) {
  61. this.navsData = n;
  62. this.initNav();
  63. }
  64. },
  65. methods: {
  66. // 初始化处理
  67. // initNav() {
  68. // this.menuData = JSON.parse(JSON.stringify(this.navsData));
  69. // },
  70. secondNavClick(val, index) {
  71. this.$router.push("/super/" + val.href);
  72. this.checkindex = index;
  73. },
  74. // 账号管理、退出登录
  75. Loginout() {
  76. this.$confirm("您确定退出吗?", "提示", {
  77. confirmButtonText: "确定",
  78. cancelButtonText: "取消",
  79. type: "warning"
  80. })
  81. .then(() => {
  82. localStorage.removeItem("accessToken");
  83. this.$store.dispatch("LogOut").then(() => {
  84. location.reload(); // 为了重新实例化vue-router对象 避免bug
  85. });
  86. })
  87. .catch(() => {
  88. // console.log(err)
  89. this.$message("已取消操作!");
  90. });
  91. }
  92. },
  93. computed: {
  94. ...mapGetters(['name', 'avatar','roles'])
  95. },
  96. mounted() {
  97. // this.initNav();
  98. }
  99. };
  100. </script>
  101. <style scoped>
  102. /*.mainHeader{*/
  103. /*height: 110px;*/
  104. /*line-height:110px;*/
  105. /*}*/
  106. .menu_item {
  107. cursor: pointer;
  108. color:#999999;
  109. font-size: 9px;
  110. font-family: serif;
  111. box-sizing:border-box;
  112. height: 80%;
  113. text-align:center;
  114. padding-bottom:19px ;
  115. /*display: inline-block;*/
  116. }
  117. .menu_item:hover {
  118. color:#52CC60 ;
  119. border-bottom:2px solid #52cc60;
  120. }
  121. .active {
  122. color:#52CC60 !important;
  123. border-bottom:2px solid #52cc60;
  124. }
  125. .menu_item+.menu_item {
  126. border-left: 1px solid #ffffff;
  127. }
  128. .logoImg{
  129. width:136px;
  130. height:52px;
  131. }
  132. .sishuLogo{
  133. margin-left:125px;
  134. }
  135. .userstyle{
  136. width:50px;
  137. height:50px;
  138. border-radius: 25px;
  139. }
  140. .lineStyle{
  141. color: #999999;
  142. font-size: 18px;
  143. text-align: center;
  144. }
  145. .login{
  146. color: #333333;
  147. font-size: 14px;
  148. display: inline-block;
  149. }
  150. .out{
  151. margin-left: 20px;
  152. font-size: 14px;
  153. color: #666666;
  154. display: inline-block;
  155. cursor: pointer;
  156. }
  157. .out-img{
  158. width: 16px;
  159. height: 18px;
  160. }
  161. .aside-right{
  162. float: right;
  163. margin-right: 0%;
  164. }
  165. </style>