Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

241 linhas
7.5 KiB

  1. <template>
  2. <el-container>
  3. <el-header class="header linear">
  4. <el-menu :default-active="activeIndex" mode="horizontal" style="position: relative;padding-left: 100px;width: 960px;text-align: center;margin: 0 auto;border: none;background: transparent;overflow: visible">
  5. <div class="logo">
  6. <img src="../../assets/images/logo.jpg" style="width: 260px; height: 60px;">
  7. </div>
  8. <el-menu-item index="1"><router-link to="/overview">首页</router-link></el-menu-item>
  9. <el-menu-item index="2"><router-link to="/about">关于我们</router-link></el-menu-item>
  10. <el-menu-item index="3"><router-link to="/vip-service">协会会员</router-link></el-menu-item>
  11. <el-menu-item index="4"><router-link to="/company">企业认定</router-link></el-menu-item>
  12. <el-menu-item index="5"><router-link to="/news">新闻资讯</router-link></el-menu-item>
  13. <el-menu-item index="6"><router-link to="/policy">产业政策</router-link></el-menu-item>
  14. <el-menu-item index="7"><router-link to="/trode">行业动态</router-link></el-menu-item>
  15. <el-menu-item index="8"><router-link to="/exchange">合作交流</router-link></el-menu-item>
  16. <el-menu-item index="9"><router-link to="/km">知识产权</router-link></el-menu-item>
  17. <el-menu-item index="10"><router-link to="/member">会员产品</router-link></el-menu-item>
  18. <el-menu-item index="11"><router-link to="/people">人力资源</router-link></el-menu-item>
  19. <el-menu-item index="12"><router-link to="/data">数据上报</router-link></el-menu-item>
  20. <el-menu-item index="13"><router-link to="/connect">联系我们</router-link></el-menu-item>
  21. </el-menu>
  22. </el-header>
  23. <router-view/>
  24. <el-footer style="height: 100px;flex: 0 0 auto;width: 100%" class="linear">
  25. <div class="footer">
  26. <div class="footer-bar">
  27. <span @click="clickItem(index)"
  28. v-for="(item, index) in menuLists" :key="index" >{{item.text}}</span>
  29. </div>
  30. <div class="copyright">版权所有&nbsp;©&nbsp;上海市集成电路行业协会&nbsp;保留所有权利<br />技术支持:锐赢技术&nbsp;&nbsp;沪ICP备11022172号-1</div>
  31. </div>
  32. </el-footer>
  33. </el-container>
  34. </template>
  35. <script>
  36. import SideMenu from './components/side-menu'
  37. import HeaderBar from './components/header-bar'
  38. import TagsNav from './components/tags-nav'
  39. import User from './components/user'
  40. import Fullscreen from './components/fullscreen'
  41. import Language from './components/language'
  42. import {mapMutations, mapActions} from 'vuex'
  43. import {getNextRoute, routeEqual} from '@/libs/util'
  44. import minLogo from '@/assets/images/logo-min.jpg'
  45. import maxLogo from '@/assets/images/logo.jpg'
  46. import './main.less'
  47. import Layout from 'iview/src/components/layout/layout'
  48. import customBreadCrumb from './components/header-bar/custom-bread-crumb'
  49. import CommonIcon from '../../components/common-icon/common-icon'
  50. export default {
  51. name: 'Main',
  52. components: {
  53. CommonIcon,
  54. Layout,
  55. SideMenu,
  56. HeaderBar,
  57. Language,
  58. TagsNav,
  59. Fullscreen,
  60. User,
  61. customBreadCrumb
  62. },
  63. data () {
  64. return {
  65. activeIndex:"1",
  66. collapsed: true,
  67. minLogo,
  68. maxLogo,
  69. isFullscreen: false,
  70. height: 'height:'+((document.documentElement.clientHeight || document.body.clientHeight) - 50)+'px',
  71. menuLists: [
  72. {text: '首页', path: '/overview'},
  73. {text: '关于我们', path: '/about'},
  74. {text: '协会会员', path: '/vip-service'},
  75. {text: '企业认定', path: '/company'},
  76. {text: '新闻资讯', path: '/news'},
  77. {text: '产业政策', path: '/policy'},
  78. {text: '行业动态', path: '/trode'},
  79. {text: '合作交流', path: '/exchange'},
  80. {text: '知识产权', path: '/km'},
  81. {text: '会员产品', path: '/member'},
  82. {text: '人力资源', path: '/people'},
  83. {text: '数据上报', path: '/data'},
  84. {text: '联系我们', path: '/connect'},
  85. ]
  86. }
  87. },
  88. computed: {
  89. tagNavList () {
  90. return this.$store.state.app.tagNavList
  91. },
  92. tagRouter () {
  93. return this.$store.state.app.tagRouter
  94. },
  95. userAvator () {
  96. return this.$store.state.user.avatorImgPath
  97. },
  98. cacheList () {
  99. return this.tagNavList.length ? this.tagNavList.filter(item => !(item.meta && item.meta.notCache)).map(item => item.name) : []
  100. },
  101. menuList () {
  102. return this.$store.getters.menuList
  103. },
  104. breadCrumbList () {
  105. return this.$store.state.app.breadCrumbList
  106. },
  107. local () {
  108. return this.$store.state.app.local
  109. }
  110. },
  111. methods: {
  112. ...mapMutations([
  113. 'setBreadCrumb',
  114. 'setTagNavList',
  115. 'addTag',
  116. 'setLocal'
  117. ]),
  118. ...mapActions([
  119. 'handleLogin'
  120. ]),
  121. clickItem(index){
  122. this.activeIndex = index + 1 + ""
  123. this.$router.push(this.menuList[index].path)
  124. this.$forceUpdate()
  125. },
  126. turnToPage (route) {
  127. let {name, params, query} = {}
  128. if (typeof route === 'string') name = route
  129. else {
  130. name = route.name
  131. params = route.params
  132. query = route.query
  133. }
  134. if (name.indexOf('isTurnByHref_') > -1) {
  135. window.open(name.split('_')[1])
  136. return
  137. }
  138. this.$router.push({
  139. name,
  140. params,
  141. query
  142. })
  143. },
  144. handleCloseTag (res, type, route) {
  145. let openName = ''
  146. if (type === 'all') {
  147. this.turnToPage('home')
  148. openName = 'home'
  149. } else if (routeEqual(this.$route, route)) {
  150. if (type === 'others') {
  151. openName = route.name
  152. } else {
  153. const nextRoute = getNextRoute(this.tagNavList, route)
  154. this.$router.push(nextRoute)
  155. openName = nextRoute.name
  156. }
  157. }
  158. this.setTagNavList(res)
  159. this.$refs.sideMenu.updateOpenName(openName)
  160. },
  161. handleCollapsedChange (state) {
  162. this.collapsed = state
  163. },
  164. handleClick (item) {
  165. this.turnToPage(item)
  166. }
  167. },
  168. watch: {
  169. '$route' (newRoute) {
  170. // console.log(newRoute)
  171. this.menuLists.map((item, index) => {
  172. if(newRoute.path.indexOf(item.path) > -1){
  173. this.activeIndex = index+1+""
  174. }
  175. })
  176. this.setBreadCrumb(newRoute)
  177. }
  178. },
  179. mounted () {
  180. /**
  181. * @description 初始化设置面包屑导航和标签导航
  182. */
  183. this.setTagNavList()
  184. this.addTag({
  185. route: this.$store.state.app.homeRoute
  186. })
  187. this.setBreadCrumb(this.$route)
  188. // 设置初始语言
  189. this.setLocal(this.$i18n.locale)
  190. let path = location.href;
  191. if(path.indexOf('overview')>=0){
  192. this.activeIndex = '1';
  193. }
  194. if(path.indexOf('about')>=0){
  195. this.activeIndex = '2';
  196. }
  197. if(path.indexOf('vip-service')>=0){
  198. this.activeIndex = '3';
  199. }
  200. if(path.indexOf('company')>=0){
  201. this.activeIndex = '4';
  202. }
  203. if(path.indexOf('news')>=0){
  204. this.activeIndex = '5';
  205. }
  206. if(path.indexOf('policy')>=0){
  207. this.activeIndex = '6';
  208. }
  209. if(path.indexOf('trode')>=0){
  210. this.activeIndex = '7';
  211. }
  212. if(path.indexOf('exchange')>=0){
  213. this.activeIndex = '8';
  214. }
  215. if(path.indexOf('km')>=0){
  216. this.activeIndex = '9';
  217. }
  218. if(path.indexOf('member')>=0){
  219. this.activeIndex = '10';
  220. }
  221. if(path.indexOf('people')>=0){
  222. this.activeIndex = '11';
  223. }
  224. if(path.indexOf('data')>=0){
  225. this.activeIndex = '12';
  226. }
  227. }
  228. }
  229. </script>
  230. <style>
  231. .logo{
  232. display: flex;
  233. flex-direction: row;
  234. align-items: center;
  235. justify-content: center;
  236. }
  237. </style>