header.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. @select="headMenuSelect"
  58. >
  59. <template v-for="(item,index) in headerArr">
  60. <el-submenu :index="`${item.keyPath}`" v-if="item.children && item.children.length > 0"
  61. popper-class="mta-menu-two">
  62. <template slot="title">{{item.content}}</template>
  63. <el-menu-item :index="`${child.keyPath}`" v-for="child of item.children"
  64. :key="child.keyPath">
  65. <mtaLink :path="child.keyPath" :instation="false" :content="child.content" v-if="child.hrefFlag" target="_blank"></mtaLink>
  66. <mtaLink :path="child.keyPath" :instation="true" :content="child.content" v-else></mtaLink>
  67. </el-menu-item>
  68. </el-submenu>
  69. <el-menu-item :index="`${item.keyPath}`" v-else>
  70. <mtaLink :path="item.keyPath" :instation="false" :content="item.content" v-if="item.hrefFlag" target="_blank"></mtaLink>
  71. <mtaLink :path="item.keyPath" :instation="true" :content="item.content" v-else></mtaLink>
  72. </el-menu-item>
  73. </template>
  74. </el-menu>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </nav>
  81. </template>
  82. <script>
  83. import mtaLink from '~/components/mtaLink/index';
  84. import { mapGetters } from 'vuex';
  85. let _ = require('lodash');
  86. export default {
  87. name: 'mtaHeader',
  88. components: {
  89. mtaLink,
  90. },
  91. computed: {
  92. activeNav() {
  93. return this.getActiveNav;
  94. },
  95. baseUrl() {
  96. return this.getBaseUrl;
  97. },
  98. ...mapGetters(['getActiveNav','getBaseUrl'])
  99. },
  100. data() {
  101. return {
  102. showBtnFlag:false,
  103. navClass:'head-nav-up',
  104. headerArrPhone: [
  105. {
  106. content: '首页',
  107. keyPath: '/',
  108. },
  109. {
  110. content: '考试系统',
  111. keyPath: '/examsystem',
  112. children: [],
  113. },
  114. {
  115. content: '培训系统',
  116. keyPath: '/trainsystem',
  117. children: [],
  118. },
  119. /* {
  120. content: '课程资源',
  121. keyPath: '/resources',
  122. children: [],
  123. },*/
  124. {
  125. content: '课程资源',
  126. keyPath: 'https://p.qiao.baidu.com/cps/chat?siteId=17930048&userId=40179606&siteToken=e767a987c8404575246ab0084fb2c9bd',
  127. children: [],
  128. hrefFlag:true,
  129. },
  130. {
  131. content: '课程开发',
  132. keyPath: '/courseware',
  133. children: [],
  134. },
  135. {
  136. content: '客户案例',
  137. keyPath: '/news',
  138. children: [],
  139. },
  140. /* {
  141. content: '帮助中心',
  142. keyPath: '/helpCenter',
  143. children: [],
  144. },*/
  145. {
  146. content: '关于我们',
  147. keyPath: '/introduction',
  148. children: [],
  149. },
  150. ],
  151. headerArr: [
  152. {
  153. content: '首页',
  154. keyPath: '/',
  155. },
  156. {
  157. content: '考试系统',
  158. keyPath: '/examsystem',
  159. children: [],
  160. },
  161. {
  162. content: '培训系统',
  163. keyPath: '/trainsystem',
  164. children: [],
  165. },
  166. /* {
  167. content: '课程资源',
  168. keyPath: '/resources',
  169. children: [],
  170. },*/
  171. {
  172. content: '课程资源',
  173. keyPath: 'https://www.lliedu.com/c/mainPage',
  174. children: [],
  175. hrefFlag:true,
  176. },
  177. {
  178. content: '课程开发',
  179. keyPath: '/courseware',
  180. children: [],
  181. },
  182. {
  183. content: '客户案例',
  184. keyPath: '/news',
  185. children: [],
  186. },
  187. /* {
  188. content: '帮助中心',
  189. keyPath: '/helpCenter',
  190. children: [],
  191. },*/
  192. {
  193. content: '关于我们',
  194. keyPath: '/introduction',
  195. children: [],
  196. },
  197. ],
  198. };
  199. },
  200. methods:{
  201. headMenuSelect(index){
  202. if(index.indexOf('trainsystem') !== -1 || index.indexOf('examsystem') !== -1){
  203. this.showBtnFlag = true;
  204. }else {
  205. this.showBtnFlag = false;
  206. }
  207. },
  208. // 点击按钮菜单变化
  209. changeHeadNav(){
  210. if(this.navClass ==='head-nav-up' ){
  211. this.navClass = 'head-nav-down'
  212. }else{
  213. this.navClass = 'head-nav-up'
  214. }
  215. },
  216. navChange(){
  217. this.navClass = 'head-nav-up'
  218. },
  219. },
  220. created() {
  221. let str = this.$route.fullPath;
  222. //注意:!=-1即为为真,可以找到得情况
  223. if(str.indexOf('trainsystem') !== -1 || str.indexOf('examsystem') !== -1){
  224. this.showBtnFlag = true;
  225. }else {
  226. this.showBtnFlag = false;
  227. }
  228. }
  229. };
  230. </script>