pcNav.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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="hover"
  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'}" @click="kckfBtn">课程开发<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. kckfBtn(){
  60. this.$router.push({ path: '/courseware/synopsis' });
  61. },
  62. },
  63. computed: {
  64. curActive() {
  65. const courseware = this.kckfList.map(item => item.url);
  66. const routerPath = this.$route.path
  67. // 首页
  68. if (routerPath === '/' || routerPath === '/index') {
  69. return 'shouye'
  70. } else if (routerPath === '/examsystem') {
  71. return 'examsystem'
  72. }else if (routerPath === '/trainsystem') {
  73. return 'trainsystem'
  74. } else if (routerPath === '/news') {
  75. return 'news'
  76. } else if (routerPath === '/introduction') {
  77. return 'introduction'
  78. } else if (courseware.some(path => path === routerPath)) {
  79. return 'courseware'
  80. }
  81. }
  82. },
  83. watch: {
  84. '$route.path': {
  85. handler(newVal) {
  86. console.log(newVal)
  87. this.$emit('navChange',newVal)
  88. },
  89. immediate: true,
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss">
  95. //头部导航
  96. .header-nav {
  97. > span, > a {
  98. height: 60px;
  99. line-height: 60px;
  100. font-size: 18px;
  101. margin: 0 42px;
  102. color: #333333;
  103. cursor: pointer;
  104. }
  105. > a:last-child {
  106. margin-right: 0;
  107. }
  108. > a:visited {
  109. color: #333333;
  110. }
  111. > a.active {
  112. color: #0066cc;
  113. position: relative;
  114. }
  115. .active:before {
  116. content: '';
  117. width: 100%;
  118. bottom: -10px;
  119. left: 0;
  120. height: 2px;
  121. background-color: #0066cc;
  122. display: block;
  123. position: absolute;
  124. }
  125. // 导航按钮
  126. .head-nav-btn.active {
  127. position: relative;
  128. }
  129. .head-nav-btn.active:before {
  130. width: 70%;
  131. bottom: -10px;
  132. left: 4%;
  133. }
  134. }
  135. /* 导航二级菜单 */
  136. .head-popper-box {
  137. width: 620px;
  138. display: flex;
  139. align-items: center;
  140. top:104px!important;
  141. // 箭头
  142. .popper__arrow::after {
  143. content: ' ';
  144. width: 0;
  145. height: 0;
  146. overflow: hidden;
  147. position: absolute;
  148. border-width: 6px;
  149. border-style: dashed dashed solid;
  150. border-color: transparent transparent #0066cc !important;
  151. top: -12px;
  152. }
  153. // 列表
  154. .head-popper-item {
  155. width: 23%;
  156. display: flex;
  157. margin: 16px 1%;
  158. align-items: center;
  159. justify-content: center;
  160. i {
  161. width: 30px;
  162. height: 30px;
  163. background-size: contain;
  164. display: inline-block;
  165. margin-right: 12px;
  166. background-repeat: no-repeat;
  167. background-position: center;
  168. }
  169. .head-popper-title {
  170. font-size: 16px;
  171. line-height: 16px;
  172. color: #333;
  173. /*margin-bottom: 4px;*/
  174. display: inline-block;
  175. }
  176. .head-popper-des {
  177. display: block;
  178. font-size: 12px;
  179. color: #9c9c9c;
  180. }
  181. }
  182. // 列表
  183. .head-popper-item:nth-child(1) {
  184. i {
  185. background-image:url("~static/images/client/component/head-cp-icon1.png");
  186. }
  187. }
  188. .head-popper-item:nth-child(2) {
  189. i {
  190. background-image:url("~static/images/client/component/head-cp-icon2.png");
  191. }
  192. }
  193. .head-popper-item:nth-child(3) {
  194. i {
  195. background-image:url("~static/images/client/component/head-cp-icon3.png");
  196. }
  197. }
  198. .head-popper-item:nth-child(4) {
  199. i {
  200. background-image:url("~static/images/client/component/head-cp-icon4.png");
  201. }
  202. }
  203. }
  204. .head-popper-box:before {
  205. content: ' ';
  206. width: 100%;
  207. height: 2px;
  208. position: absolute;
  209. left: 0;
  210. top: 0;
  211. background-color: #0066cc;
  212. border-radius: 4px 4px 0 0;
  213. }
  214. </style>