teacherCompoent.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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="2" 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" :offset="9">
  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 :span="1"></el-col>
  24. </el-col>
  25. </template>
  26. <script>
  27. import {mapGetters} from 'vuex'
  28. import { IMG_BASE_URL } from '@/ImgConfig'
  29. export default {
  30. name: "navMenu",
  31. // props: {
  32. // navsData: Array
  33. // },
  34. data() {
  35. return {
  36. accessToken:localStorage.getItem("accessToken"), //token
  37. BASE_URL:IMG_BASE_URL,
  38. menuData: [ {
  39. id: "1",
  40. name: "在线批改老师",
  41. href: "onlineteacher",
  42. },
  43. ],
  44. checkindex: 0
  45. };
  46. },
  47. watch: {
  48. navsData(n) {
  49. this.navsData = n;
  50. this.initNav();
  51. }
  52. },
  53. methods: {
  54. // 初始化处理
  55. // initNav() {
  56. // this.menuData = JSON.parse(JSON.stringify(this.navsData));
  57. // },
  58. secondNavClick(val, index) {
  59. this.$router.push("/Onteacher/" + val.href);
  60. this.checkindex = index;
  61. },
  62. // 账号管理、退出登录
  63. Loginout() {
  64. this.$confirm("您确定退出吗?", "提示", {
  65. confirmButtonText: "确定",
  66. cancelButtonText: "取消",
  67. type: "warning"
  68. })
  69. .then(() => {
  70. this.$store.dispatch("LogOut", {
  71. accessToken: this.accessToken
  72. });
  73. })
  74. .catch(() => {
  75. // console.log(err)
  76. this.$message("已取消操作!");
  77. });
  78. }
  79. },
  80. computed: {
  81. ...mapGetters(['name', 'avatar','roles'])
  82. },
  83. mounted() {
  84. // this.initNav();
  85. }
  86. };
  87. </script>
  88. <style scoped>
  89. /*.mainHeader{*/
  90. /*height: 110px;*/
  91. /*line-height:110px;*/
  92. /*}*/
  93. .menu_item {
  94. cursor: pointer;
  95. color:#999999;
  96. font-size: 9px;
  97. font-family: serif;
  98. box-sizing:border-box;
  99. height: 80%;
  100. text-align:center;
  101. padding-bottom:19px ;
  102. /*display: inline-block;*/
  103. }
  104. .menu_item:hover {
  105. color:#52CC60 ;
  106. border-bottom:2px solid #52cc60;
  107. }
  108. .active {
  109. color:#52CC60 !important;
  110. border-bottom:2px solid #52cc60;
  111. }
  112. .menu_item+.menu_item {
  113. border-left: 1px solid #ffffff;
  114. }
  115. .logoImg{
  116. width:136px;
  117. height:52px;
  118. }
  119. .sishuLogo{
  120. margin-left:125px;
  121. }
  122. .userstyle{
  123. width:26px;
  124. height:26px;
  125. border-radius: 15px;
  126. }
  127. .lineStyle{
  128. color: #999999;
  129. font-size: 18px;
  130. text-align: center;
  131. }
  132. .login{
  133. color: #333333;
  134. font-size: 14px;
  135. display: inline-block;
  136. }
  137. .out{
  138. margin-left: 20px;
  139. font-size: 14px;
  140. color: #666666;
  141. display: inline-block;
  142. cursor: pointer;
  143. }
  144. .out-img{
  145. width: 16px;
  146. height: 18px;
  147. }
  148. </style>