header.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 headerArrPhone">
  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="false" :content="child.content" v-if="child.hrefFlag"></mtaLink>
  20. <mtaLink :path="child.keyPath" :instation="true" :content="child.content"></mtaLink>
  21. </el-menu-item>
  22. </el-submenu>
  23. <el-menu-item :index="`${item.keyPath}`" v-else>
  24. <mtaLink :path="item.keyPath" :instation="false" :content="item.content" v-if="item.hrefFlag"></mtaLink>
  25. <mtaLink :path="item.keyPath" :instation="true" :content="item.content"></mtaLink>
  26. </el-menu-item>
  27. </template>
  28. </el-menu>
  29. </div>
  30. <a class="phone-tel-box mta-hidden-sm" href="tel:400-052-2130">咨询电话:400-052-2130</a>
  31. <!-- 手机按钮 -->
  32. <div class="phone-nav-btn mta-hidden-sm" @click="changeHeadNav"></div>
  33. </div>
  34. <div class="head-left mta-hidden-xs">
  35. <a :href="`${baseUrl}`" class="client-head-img"></a>
  36. <div>
  37. <div class="header-left-container">
  38. <a class="phone-tel-box" href="tel:400-052-2130"> <i class="phone-tel-box-icon"></i> <span>咨询电话:400-052-2130</span></a>
  39. <div class="head-right mta-hidden-xs">
  40. <a class="right-tel-btn" href="https://cdnks.mtavip.com/a/register?flug=2" target="_blank" v-if="showBtnFlag">免费试用</a>
  41. <!--<div class="system-box">
  42. <div>
  43. <a rel="nofollow" href="https://cdnks.mtavip.com/a/register?flug=1" target="_blank"><i></i><p>考试系统</p></a>
  44. <span></span>
  45. <a rel="nofollow" href="https://cdnks.mtavip.com/a/register?flug=2" target="_blank"><i></i><p>培训系统</p></a>
  46. </div>
  47. </div>-->
  48. <a rel="nofollow" href="https://cdnks.mtavip.com/a/registerLogin" target="_blank" v-if="showBtnFlag">管理员登录</a>
  49. </div></div>
  50. <div>
  51. <div @click="navChange">
  52. <el-menu
  53. :default-active="activeNav"
  54. :class="navClass"
  55. mode="horizontal"
  56. :router="false"
  57. >
  58. <template v-for="(item,index) in headerArr">
  59. <el-submenu :index="`${item.keyPath}`" v-if="item.children && item.children.length > 0"
  60. popper-class="mta-menu-two">
  61. <template slot="title">{{item.content}}</template>
  62. <el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
  63. :key="child.keyPath">
  64. <mtaLink :path="child.keyPath" :instation="false" :content="child.content" v-if="child.hrefFlag"></mtaLink>
  65. <mtaLink :path="child.keyPath" :instation="true" :content="child.content" v-else></mtaLink>
  66. </el-menu-item>
  67. </el-submenu>
  68. <el-menu-item :index="`${item.keyPath}`" v-else>
  69. <mtaLink :path="item.keyPath" :instation="false" :content="item.content" v-if="item.hrefFlag"></mtaLink>
  70. <mtaLink :path="item.keyPath" :instation="true" :content="item.content" v-else></mtaLink>
  71. </el-menu-item>
  72. </template>
  73. </el-menu>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </nav>
  80. </template>
  81. <script>
  82. import mtaLink from '~/components/mtaLink/index';
  83. import { mapGetters } from 'vuex';
  84. let _ = require('lodash');
  85. export default {
  86. name: 'mtaHeader',
  87. components: {
  88. mtaLink,
  89. },
  90. computed: {
  91. activeNav() {
  92. return this.getActiveNav;
  93. },
  94. baseUrl() {
  95. return this.getBaseUrl;
  96. },
  97. ...mapGetters(['getActiveNav','getBaseUrl'])
  98. },
  99. data() {
  100. return {
  101. showBtnFlag:false,
  102. navClass:'head-nav-up',
  103. headerArrPhone: [
  104. {
  105. content: '首页',
  106. keyPath: '/',
  107. },
  108. {
  109. content: '考试系统',
  110. keyPath: '/examsystem',
  111. children: [],
  112. },
  113. {
  114. content: '培训系统',
  115. keyPath: '/trainsystem',
  116. children: [],
  117. },
  118. /* {
  119. content: '课程资源',
  120. keyPath: '/resources',
  121. children: [],
  122. },*/
  123. {
  124. content: '课程资源',
  125. keyPath: 'https://p.qiao.baidu.com/cps/chat?siteId=17930048&userId=40179606&siteToken=e767a987c8404575246ab0084fb2c9bd',
  126. children: [],
  127. hrefFlag:true,
  128. },
  129. {
  130. content: '课程开发',
  131. keyPath: '/courseware',
  132. children: [],
  133. },
  134. {
  135. content: '客户案例',
  136. keyPath: '/news',
  137. children: [],
  138. },
  139. /* {
  140. content: '帮助中心',
  141. keyPath: '/helpCenter',
  142. children: [],
  143. },*/
  144. {
  145. content: '关于我们',
  146. keyPath: '/introduction',
  147. children: [],
  148. },
  149. ],
  150. headerArr: [
  151. {
  152. content: '首页',
  153. keyPath: '/',
  154. },
  155. {
  156. content: '考试系统',
  157. keyPath: '/examsystem',
  158. children: [],
  159. },
  160. {
  161. content: '培训系统',
  162. keyPath: '/trainsystem',
  163. children: [],
  164. },
  165. /* {
  166. content: '课程资源',
  167. keyPath: '/resources',
  168. children: [],
  169. },*/
  170. {
  171. content: '课程资源',
  172. keyPath: 'https://www.lliedu.com/c/mainPage',
  173. children: [],
  174. hrefFlag:true,
  175. },
  176. {
  177. content: '课程开发',
  178. keyPath: '/courseware',
  179. children: [],
  180. },
  181. {
  182. content: '客户案例',
  183. keyPath: '/news',
  184. children: [],
  185. },
  186. /* {
  187. content: '帮助中心',
  188. keyPath: '/helpCenter',
  189. children: [],
  190. },*/
  191. {
  192. content: '关于我们',
  193. keyPath: '/introduction',
  194. children: [],
  195. },
  196. ],
  197. };
  198. },
  199. methods:{
  200. // 点击按钮菜单变化
  201. changeHeadNav(){
  202. if(this.navClass ==='head-nav-up' ){
  203. this.navClass = 'head-nav-down'
  204. }else{
  205. this.navClass = 'head-nav-up'
  206. }
  207. },
  208. navChange(){
  209. this.navClass = 'head-nav-up'
  210. },
  211. },
  212. created() {
  213. let str = this.$route.fullPath;
  214. //注意:!=-1即为为真,可以找到得情况
  215. if(str.indexOf('trainsystem') !== -1){
  216. this.showBtnFlag = true;
  217. }else if(str.indexOf('examsystem') !== -1){
  218. this.showBtnFlag = true;
  219. }else {
  220. this.showBtnFlag = false;
  221. }
  222. }
  223. };
  224. </script>