pcNav.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="header-nav">
  3. <nuxt-link to="/" :class="{active : curActive === 'shouye'}">首页</nuxt-link>
  4. <nuxt-link to="/examsystem" class="xwzx-row" :class="{'active': curActive === 'examsystem'}">考试系统</nuxt-link>
  5. <nuxt-link to="/trainsystem" class="xwzx-row" :class="{'active': curActive === 'trainsystem'}">培训系统</nuxt-link>
  6. <el-popover
  7. placement="bottom"
  8. trigger="click"
  9. popper-class="head-popper-box cp-popper-box"
  10. >
  11. <nuxt-link :to="item.url" v-for="(item,index) in kckfList" :key="index" class="head-popper-item">
  12. <i></i>
  13. <span class="head-popper-title">{{ item.title }}</span>
  14. <!--<span class="head-popper-des">{{ item.des }}</span>-->
  15. </nuxt-link>
  16. <span class="head-nav-btn" slot="reference" :class="{active: curActive === 'courseware'}">课程开发<i class="el-icon-arrow-down el-icon--right"></i></span>
  17. </el-popover>
  18. <nuxt-link to="/news" :class="{active: curActive === 'news'}">新闻资讯</nuxt-link>
  19. <nuxt-link to="/introduction" :class="{active: curActive === 'introduction'}">关于我们</nuxt-link>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: "pcNav",
  25. data() {
  26. return {
  27. kckfList: [
  28. {
  29. img: '#',
  30. title: '课程开发',
  31. // des: '为企业量身定做专属课程',
  32. url: '/courseware/synopsis'
  33. },
  34. {
  35. img: '#',
  36. title: '微课制作',
  37. // des: '海量精品课程专业定制',
  38. url: '/courseware/custom'
  39. },
  40. {
  41. img: '#',
  42. title: '高端动画',
  43. // des: '完善的平台运营体系',
  44. url: '/courseware/animation'
  45. },
  46. {
  47. img: '#',
  48. title: '课件PPT',
  49. // des: '助力企业推动培训学习进程',
  50. url: '/courseware/ppt'
  51. }
  52. ],
  53. }
  54. },
  55. methods:{
  56. headNavClick(){
  57. this.$emit('headNavClick')
  58. },
  59. },
  60. computed: {
  61. curActive() {
  62. const courseware = this.kckfList.map(item => item.url);
  63. const routerPath = this.$route.path
  64. // 首页
  65. if (routerPath === '/' || routerPath === '/index') {
  66. return 'shouye'
  67. } else if (routerPath === '/examsystem') {
  68. return 'examsystem'
  69. }else if (routerPath === '/trainsystem') {
  70. return 'trainsystem'
  71. } else if (routerPath === '/news') {
  72. return 'news'
  73. } else if (routerPath === '/introduction') {
  74. return 'introduction'
  75. } else if (courseware.some(path => path === routerPath)) {
  76. return 'courseware'
  77. }
  78. }
  79. },
  80. watch: {
  81. '$route.path': {
  82. handler(newVal) {
  83. console.log(newVal)
  84. this.$emit('navChange',newVal)
  85. },
  86. immediate: true,
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. //头部导航
  93. .header-nav {
  94. > span, > a {
  95. height: 60px;
  96. line-height: 60px;
  97. font-size: 18px;
  98. margin: 0 42px;
  99. color: #333333;
  100. cursor: pointer;
  101. }
  102. > a:last-child {
  103. margin-right: 0;
  104. }
  105. > a:visited {
  106. color: #333333;
  107. }
  108. > a.active {
  109. color: #2b5cfd;
  110. position: relative;
  111. }
  112. .active:before {
  113. content: '';
  114. width: 100%;
  115. bottom: -10px;
  116. left: 0;
  117. height: 2px;
  118. background-color: #2b5cfd;
  119. display: block;
  120. position: absolute;
  121. }
  122. // 导航按钮
  123. .head-nav-btn.active {
  124. position: relative;
  125. }
  126. .head-nav-btn.active:before {
  127. width: 70%;
  128. bottom: -10px;
  129. left: 4%;
  130. }
  131. }
  132. /* 导航二级菜单 */
  133. .head-popper-box {
  134. width: 620px;
  135. display: flex;
  136. align-items: center;
  137. top:104px!important;
  138. // 箭头
  139. .popper__arrow::after {
  140. content: ' ';
  141. width: 0;
  142. height: 0;
  143. overflow: hidden;
  144. position: absolute;
  145. border-width: 6px;
  146. border-style: dashed dashed solid;
  147. border-color: transparent transparent #2b5cfd !important;
  148. top: -12px;
  149. }
  150. // 列表
  151. .head-popper-item {
  152. width: 23%;
  153. display: flex;
  154. margin: 16px 1%;
  155. align-items: center;
  156. i {
  157. width: 28px;
  158. height: 28px;
  159. background-size: contain;
  160. display: inline-block;
  161. margin-right: 12px;
  162. background-repeat: no-repeat;
  163. background-position: center;
  164. }
  165. .head-popper-title {
  166. font-size: 16px;
  167. line-height: 16px;
  168. color: #333;
  169. /*margin-bottom: 4px;*/
  170. display: inline-block;
  171. }
  172. .head-popper-des {
  173. display: block;
  174. font-size: 12px;
  175. color: #9c9c9c;
  176. }
  177. }
  178. // 列表
  179. .head-popper-item:nth-child(1) {
  180. i {
  181. background-image:url("~static/images/client/component/head-cp-icon1.png");
  182. }
  183. }
  184. .head-popper-item:nth-child(2) {
  185. i {
  186. background-image:url("~static/images/client/component/head-cp-icon2.png");
  187. }
  188. }
  189. .head-popper-item:nth-child(3) {
  190. i {
  191. background-image:url("~static/images/client/component/head-cp-icon3.png");
  192. }
  193. }
  194. .head-popper-item:nth-child(4) {
  195. i {
  196. background-image:url("~static/images/client/component/head-cp-icon4.png");
  197. }
  198. }
  199. }
  200. .head-popper-box:before {
  201. content: ' ';
  202. width: 100%;
  203. height: 2px;
  204. position: absolute;
  205. left: 0;
  206. top: 0;
  207. background-color: #2b5cfd;
  208. border-radius: 4px 4px 0 0;
  209. }
  210. </style>