header.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <nav class="client-head">
  3. <div class="client-container head-layout">
  4. <div class="head-left mta-hidden-sm">
  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-left mta-hidden-xs">
  33. <a :href="`${baseUrl}`" class="client-head-img"></a>
  34. <div>
  35. <div class="header-left-container">
  36. <a class="phone-tel-box" href="tel:400-052-2130"> <i class="phone-tel-box-icon"></i> <span>咨询电话:400-052-2130</span></a>
  37. <div class="head-right mta-hidden-xs">
  38. <a class="right-tel-btn">免费注册</a>
  39. <div class="system-box">
  40. <div>
  41. <a rel="nofollow" href="https://cdnks.mtavip.com/a/register?flug=1" target="_blank"><i></i><p>考试系统</p></a>
  42. <span></span>
  43. <a rel="nofollow" href="https://cdnks.mtavip.com/a/register?flug=2" target="_blank"><i></i><p>培训系统</p></a>
  44. </div>
  45. </div>
  46. <a rel="nofollow" href="https://cdnks.mtavip.com/a/registerLogin" target="_blank">登录</a>
  47. </div></div>
  48. <div>
  49. <div @click="navChange">
  50. <el-menu
  51. :default-active="activeNav"
  52. :class="navClass"
  53. mode="horizontal"
  54. :router="false"
  55. >
  56. <template v-for="(item,index) in headerArr">
  57. <el-submenu :index="`${item.keyPath}`" v-if="item.children && item.children.length > 0"
  58. popper-class="mta-menu-two">
  59. <template slot="title">{{item.content}}</template>
  60. <el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
  61. :key="child.keyPath">
  62. <mtaLink :path="child.keyPath" :instation="true" :content="child.content"></mtaLink>
  63. </el-menu-item>
  64. </el-submenu>
  65. <el-menu-item :index="`${item.keyPath}`" v-else>
  66. <mtaLink :path="item.keyPath" :instation="true" :content="item.content"></mtaLink>
  67. </el-menu-item>
  68. </template>
  69. </el-menu>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </nav>
  76. </template>
  77. <script>
  78. import mtaLink from '~/components/mtaLink/index';
  79. import { mapGetters } from 'vuex';
  80. let _ = require('lodash');
  81. export default {
  82. name: 'mtaHeader',
  83. components: {
  84. mtaLink,
  85. },
  86. computed: {
  87. activeNav() {
  88. return this.getActiveNav;
  89. },
  90. baseUrl() {
  91. return this.getBaseUrl;
  92. },
  93. ...mapGetters(['getActiveNav','getBaseUrl'])
  94. },
  95. data() {
  96. return {
  97. navClass:'head-nav-up',
  98. headerArr: [
  99. {
  100. content: '首页',
  101. keyPath: '/',
  102. },
  103. {
  104. content: '考试系统',
  105. keyPath: '/examsystem',
  106. children: [],
  107. },
  108. {
  109. content: '培训系统',
  110. keyPath: '/trainsystem',
  111. children: [],
  112. },
  113. /* {
  114. content: '课程资源',
  115. keyPath: '/resources',
  116. children: [],
  117. },*/
  118. {
  119. content: '体验中心',
  120. keyPath: '/tiyanCenter',
  121. children: [],
  122. },
  123. {
  124. content: '课程开发',
  125. keyPath: '/courseware',
  126. children: [],
  127. },
  128. {
  129. content: '客户案例',
  130. keyPath: '/news',
  131. children: [],
  132. },
  133. /* {
  134. content: '帮助中心',
  135. keyPath: '/helpCenter',
  136. children: [],
  137. },*/
  138. {
  139. content: '关于我们',
  140. keyPath: '/introduction',
  141. children: [],
  142. },
  143. ],
  144. };
  145. },
  146. methods:{
  147. // 点击按钮菜单变化
  148. changeHeadNav(){
  149. if(this.navClass ==='head-nav-up' ){
  150. this.navClass = 'head-nav-down'
  151. }else{
  152. this.navClass = 'head-nav-up'
  153. }
  154. },
  155. navChange(){
  156. this.navClass = 'head-nav-up'
  157. },
  158. },
  159. };
  160. </script>