iheader.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div class="nav">
  3. <ul>
  4. <li :class="{'navfirst': isActive('/login')}">
  5. <a href="#/" @click="goto('/login')"> 回到主页</a>
  6. </li>
  7. <li :class="{'navfirst': isActive('/center/home')}">
  8. <a href="#/center/home" @click="goto('/center/home')"> 学员中心</a>
  9. </li>
  10. <li :class="{'navfirst': isActive('/center/setting')}">
  11. <a href="#/center/setting" @click="goto('/center/setting')">账号设置</a>
  12. </li>
  13. <li :class="{'navfirst': isActive('/center/class/train')}">
  14. <a href="#/center/class/train" @click="goto('/center/class/train')">我的学习</a>
  15. </li>
  16. <li :class="{'navfirst': isActive('/center/market')}">
  17. <a href="#/center/market" @click="goto('/center/market')">推荐课程</a>
  18. </li>
  19. <li :class="{'navfirst': isActive('/center/myOrder')}" >
  20. <a href="#/center/myOrder" @click="goto('/center/myOrder')">我的订单</a>
  21. </li>
  22. <li :class="{'navfirst': isActive('/center/sign')}" >
  23. <a href="#/center/sign" @click="goto('/center/sign')">学时证明</a>
  24. </li>
  25. </ul>
  26. </div>
  27. </template>
  28. <script>
  29. import menu from './menu.js'
  30. export default {
  31. props: {
  32. user: {
  33. type: Object,
  34. default: {
  35. nickanme: ''
  36. }
  37. }
  38. },
  39. data() {
  40. return {
  41. exportLoading: false,
  42. menu:menu,
  43. listLoading: false,
  44. groups: [],
  45. tableData: []
  46. };
  47. },
  48. methods: {
  49. goState( item ){
  50. if( item.children){
  51. this.goSubState( item.children[0] );
  52. }else{
  53. this.goSubState( item );
  54. }
  55. },
  56. goto( path ){
  57. if( this.$route.path != path){
  58. this.$router.push({path})
  59. }
  60. },
  61. goSubState(item){
  62. if(item.path == this.$route.path) return;
  63. this.$router.push(item.path);
  64. },
  65. isActive( path ){
  66. let rpath = this.$route.path;
  67. return rpath.indexOf( path )> -1;
  68. }
  69. }
  70. }
  71. </script>
  72. <style>
  73. @import url("./index.css");
  74. .nav{ height:50px; background:#4679fe; margin:1px auto; width:1009px;}
  75. .nav ul li{ float:left; line-height:50px;}
  76. .nav ul li a{ padding:0 27px; color:#FFF; display:block; height:50px;}
  77. .nav ul li a:hover{ background:greenyellow; text-decoration:none;}
  78. .navfirst a{ background:#ffa200; display:block;}
  79. </style>