header.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <nav class="client-head">
  3. <div class="client-container head-layout">
  4. <div class="head-left">
  5. <a :href="`${baseUrl}`" class="client-head-img"></a>
  6. <div @click="navChange">
  7. <el-menu
  8. :default-active="activeNav"
  9. :class="navClass"
  10. mode="horizontal"
  11. :router="false"
  12. >
  13. <template v-for="(item,index) in headerArr">
  14. <el-submenu :index="`${item.keyPath}`" v-if="item.children && item.children.length > 0"
  15. popper-class="mta-menu-two">
  16. <template slot="title">{{item.content}}</template>
  17. <el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
  18. :key="child.keyPath">
  19. <mtaLink :path="child.keyPath" :instation="true" :content="child.content"></mtaLink>
  20. </el-menu-item>
  21. </el-submenu>
  22. <el-menu-item :index="`${item.keyPath}`" v-else>
  23. <mtaLink :path="item.keyPath" :instation="true" :content="item.content"></mtaLink>
  24. </el-menu-item>
  25. </template>
  26. </el-menu>
  27. </div>
  28. <a class="phone-tel-box mta-hidden-sm" href="tel:400-052-2130">咨询电话:400-052-2130</a>
  29. <!-- 手机按钮 -->
  30. <div class="phone-nav-btn mta-hidden-sm" @click="changeHeadNav"></div>
  31. </div>
  32. <div class="head-right mta-hidden-xs">
  33. <a @click="xtTyBtn">系统体验中心</a>
  34. </div>
  35. </div>
  36. </nav>
  37. </template>
  38. <script>
  39. import mtaLink from '~/components/mtaLink/index';
  40. import { mapGetters } from 'vuex';
  41. let _ = require('lodash');
  42. export default {
  43. name: 'mtaHeader',
  44. components: {
  45. mtaLink,
  46. },
  47. computed: {
  48. activeNav() {
  49. return this.getActiveNav;
  50. },
  51. baseUrl() {
  52. return this.getBaseUrl;
  53. },
  54. ...mapGetters(['getActiveNav','getBaseUrl'])
  55. },
  56. data() {
  57. return {
  58. navClass:'head-nav-up',
  59. headerArr: [
  60. {
  61. content: '首页',
  62. keyPath: '/',
  63. },
  64. {
  65. content: '考试系统',
  66. keyPath: '/examsystem',
  67. children: [],
  68. },
  69. {
  70. content: '培训系统',
  71. keyPath: '/trainsystem',
  72. children: [],
  73. },
  74. /* {
  75. content: '课程资源',
  76. keyPath: '/resources',
  77. children: [],
  78. },*/
  79. {
  80. content: '课程开发',
  81. keyPath: '/courseware',
  82. children: [],
  83. },
  84. {
  85. content: '课程资源',
  86. keyPath: '/courseResource',
  87. children: [],
  88. },
  89. {
  90. content: '新闻资讯',
  91. keyPath: '/news',
  92. children: [],
  93. },
  94. /* {
  95. content: '帮助中心',
  96. keyPath: '/helpCenter',
  97. children: [],
  98. },*/
  99. {
  100. content: '关于我们',
  101. keyPath: '/introduction',
  102. children: [],
  103. },
  104. ],
  105. };
  106. },
  107. methods:{
  108. // 点击按钮菜单变化
  109. changeHeadNav(){
  110. if(this.navClass ==='head-nav-up' ){
  111. this.navClass = 'head-nav-down'
  112. }else{
  113. this.navClass = 'head-nav-up'
  114. }
  115. },
  116. navChange(){
  117. this.navClass = 'head-nav-up'
  118. },
  119. // 系统体验中心
  120. xtTyBtn(){
  121. this.$router.push({ name: 'tiyanCenter' });
  122. },
  123. },
  124. };
  125. </script>