header.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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" href="https://cdnks.mtavip.com/a/register?flug=2" target="_blank">免费试用</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="false" :content="child.content" v-if="child.hrefFlag"></mtaLink>
  63. <mtaLink :path="child.keyPath" :instation="true" :content="child.content" v-else></mtaLink>
  64. </el-menu-item>
  65. </el-submenu>
  66. <el-menu-item :index="`${item.keyPath}`" v-else>
  67. <mtaLink :path="item.keyPath" :instation="false" :content="item.content" v-if="item.hrefFlag"></mtaLink>
  68. <mtaLink :path="item.keyPath" :instation="true" :content="item.content" v-else></mtaLink>
  69. </el-menu-item>
  70. </template>
  71. </el-menu>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </nav>
  78. </template>
  79. <script>
  80. import mtaLink from '~/components/mtaLink/index';
  81. import { mapGetters } from 'vuex';
  82. let _ = require('lodash');
  83. export default {
  84. name: 'mtaHeader',
  85. components: {
  86. mtaLink,
  87. },
  88. computed: {
  89. activeNav() {
  90. return this.getActiveNav;
  91. },
  92. baseUrl() {
  93. return this.getBaseUrl;
  94. },
  95. ...mapGetters(['getActiveNav','getBaseUrl'])
  96. },
  97. data() {
  98. return {
  99. navClass:'head-nav-up',
  100. headerArr: [
  101. {
  102. content: '首页',
  103. keyPath: '/',
  104. },
  105. {
  106. content: '考试系统',
  107. keyPath: '/examsystem',
  108. children: [],
  109. },
  110. {
  111. content: '培训系统',
  112. keyPath: '/trainsystem',
  113. children: [],
  114. },
  115. /* {
  116. content: '课程资源',
  117. keyPath: '/resources',
  118. children: [],
  119. },*/
  120. {
  121. content: '课程资源',
  122. keyPath: 'https://www.lliedu.com/c/mainPage',
  123. children: [],
  124. hrefFlag:true,
  125. },
  126. {
  127. content: '课程开发',
  128. keyPath: '/courseware',
  129. children: [],
  130. },
  131. {
  132. content: '客户案例',
  133. keyPath: '/news',
  134. children: [],
  135. },
  136. /* {
  137. content: '帮助中心',
  138. keyPath: '/helpCenter',
  139. children: [],
  140. },*/
  141. {
  142. content: '关于我们',
  143. keyPath: '/introduction',
  144. children: [],
  145. },
  146. ],
  147. };
  148. },
  149. methods:{
  150. // 点击按钮菜单变化
  151. changeHeadNav(){
  152. if(this.navClass ==='head-nav-up' ){
  153. this.navClass = 'head-nav-down'
  154. }else{
  155. this.navClass = 'head-nav-up'
  156. }
  157. },
  158. navChange(){
  159. this.navClass = 'head-nav-up'
  160. },
  161. },
  162. };
  163. </script>