SuperComponent.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. <!--<div class="box" v-if="index==1||index==3">-->
  11. <!--<span class="box-text">{{index==1?2+'项任务':3+'份作业'}}</span>-->
  12. <!--</div>-->
  13. </el-col>
  14. <el-col :span="4" class="aside-right">
  15. <div class="login">
  16. <img class="userstyle" :src="BASE_URL + avatar" alt="">
  17. <!-- <img class="userstyle" src="../assets/img/user.jpg"> -->
  18. <span>{{name}}</span>
  19. <i class="el-icon-caret-bottom"></i>
  20. </div>
  21. <div class="out">
  22. <img src="../assets/img/out.png" alt class="out-img">
  23. <span @click="Loginout">退出</span>
  24. </div>
  25. </el-col>
  26. </el-col>
  27. </template>
  28. <script>
  29. import {mapGetters} from 'vuex'
  30. export default {
  31. name: "navMenu",
  32. // props: {
  33. // navsData: Array
  34. // },
  35. data() {
  36. return {
  37. BASE_URL: "https://xt.sharingschool.com/upload/",
  38. menuData: [ {
  39. id: "1",
  40. name: "校区管理员",
  41. href: "SuperAdmin",
  42. },
  43. {
  44. id: "2",
  45. name: " 批改老师注册审核",
  46. href: "CheckTeacherAudit",
  47. },
  48. {
  49. id: "3",
  50. name: "批改老师薪酬表",
  51. href: "CheckTeacherPay",
  52. },
  53. {
  54. id: "4",
  55. name: "作业回收站",
  56. href: "HomeworkRecycle",
  57. },
  58. ],
  59. checkindex:''
  60. };
  61. },
  62. watch: {
  63. navsData(n) {
  64. this.navsData = n;
  65. this.initNav();
  66. }
  67. },
  68. methods: {
  69. // 初始化处理
  70. // initNav() {
  71. // this.menuData = JSON.parse(JSON.stringify(this.navsData));
  72. // },
  73. secondNavClick(val, index) {
  74. sessionStorage.setItem('tabIndex',index);
  75. this.checkindex = sessionStorage.getItem('tabIndex');
  76. console.log(sessionStorage.getItem('tabIndex'))
  77. if (sessionStorage.getItem('tabIndex') == 0){
  78. this.$router.push("/super/" + 'SuperAdmin');
  79. } else if (sessionStorage.getItem('tabIndex') == 1){
  80. this.$router.push("/super/" + 'CheckTeacherAudit');
  81. } else if (sessionStorage.getItem('tabIndex') == 2){
  82. this.$router.push("/super/" + 'CheckTeacherPay');
  83. } else if (sessionStorage.getItem('tabIndex') == 3){
  84. this.$router.push("/super/" + 'HomeworkRecycle');
  85. }
  86. // this.$router.push("/super/" + val.href);
  87. // this.checkindex = index;
  88. },
  89. // 账号管理、退出登录
  90. Loginout() {
  91. this.$confirm("您确定退出吗?", "提示", {
  92. confirmButtonText: "确定",
  93. cancelButtonText: "取消",
  94. type: "warning"
  95. })
  96. .then(() => {
  97. localStorage.removeItem("accessToken");
  98. this.$store.dispatch("LogOut").then(() => {
  99. location.reload(); // 为了重新实例化vue-router对象 避免bug
  100. });
  101. })
  102. .catch(() => {
  103. // console.log(err)
  104. this.$message("已取消操作!");
  105. });
  106. }
  107. },
  108. computed: {
  109. ...mapGetters(['name', 'avatar','roles'])
  110. },
  111. mounted() {
  112. this.checkindex = sessionStorage.getItem('tabIndex');
  113. // this.initNav();
  114. }
  115. };
  116. </script>
  117. <style scoped>
  118. /*.mainHeader{*/
  119. /*height: 110px;*/
  120. /*line-height:110px;*/
  121. /*}*/
  122. .menu_item {
  123. cursor: pointer;
  124. color:#999999;
  125. font-size: 9px;
  126. font-family: serif;
  127. box-sizing:border-box;
  128. height: 80%;
  129. text-align:center;
  130. padding-bottom:19px ;
  131. /*display: inline-block;*/
  132. }
  133. .menu_item:hover {
  134. color:#52CC60 ;
  135. border-bottom:2px solid #52cc60;
  136. }
  137. .active {
  138. color:#52CC60 !important;
  139. border-bottom:2px solid #52cc60;
  140. }
  141. .menu_item+.menu_item {
  142. border-left: 1px solid #ffffff;
  143. }
  144. .logoImg{
  145. width:136px;
  146. height:52px;
  147. }
  148. .sishuLogo{
  149. margin-left:125px;
  150. }
  151. .userstyle{
  152. width:50px;
  153. height:50px;
  154. border-radius: 25px;
  155. }
  156. .lineStyle{
  157. color: #999999;
  158. font-size: 18px;
  159. text-align: center;
  160. }
  161. .login{
  162. color: #333333;
  163. font-size: 14px;
  164. display: inline-block;
  165. }
  166. .out{
  167. margin-left: 40px;
  168. font-size: 14px;
  169. color: #666666;
  170. display: inline-block;
  171. cursor: pointer;
  172. }
  173. .out-img{
  174. width: 16px;
  175. height: 18px;
  176. }
  177. .aside-right{
  178. float: right;
  179. margin-right: 0%;
  180. }
  181. .box-items{
  182. position: relative;
  183. }
  184. .box-text{
  185. color: #FFFFFF;
  186. font-size: 14px;
  187. position: absolute;
  188. top:-37px;
  189. left: 0;
  190. height:34px;
  191. min-width: 75px;
  192. display: inline-block;
  193. }
  194. .box{
  195. position: relative;
  196. top:0px;
  197. left:0px;
  198. min-width:75px;
  199. height:34px;
  200. background: #FF6767;
  201. -moz-border-radius: 12px;
  202. -webkit-border-radius: 12px;
  203. border-radius: 17px;
  204. display: inline-block;
  205. }
  206. .box:before{
  207. position: absolute;
  208. content: "";
  209. width: 0;
  210. height: 0;
  211. right: 100%;
  212. top: 25px;
  213. left: -5px;
  214. border-top: 5px solid transparent;
  215. border-right: 18px solid #FF6767;
  216. border-bottom: 5px solid transparent;
  217. transform: rotate(-45deg);
  218. }
  219. </style>