jinlin
2024-01-31 9025b9cf7ec8610003d445a31d93e35e7bd73c2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import Vue from 'vue'
import Router from 'vue-router'
import {beforeEach, pageRoutes, setConfig} from './router/router'
import store from '../packages/store'
 
Vue.use(Router)
 
// const originalPush = Router.prototype.push
// // Router.prototype.push = function push(location) {
// //   return originalPush.call(this, location)
// // }
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}
 
// 视频播放页
pageRoutes.push({
  path: '/userHelp',
  name: 'userHelp',
  meta: {title: '帮助页', isTab: true},
  component: () => import('./views/modules/userHelp/userHelp')
})
 
// 登录页
pageRoutes.push({
  path: '/login',
  name: 'login',
  meta: {title: '首页', isTab: true},
  component: () => import('./views/pages/login')
})
// 登录页
pageRoutes.push({
  path: '/index',
  name: 'index',
  meta: {title: '首页', isTab: true},
  component: () => import('./views/pages/login')
})
// 模块路由(基于主入口布局页面)
const moduleRoutes = {
  path: '/',
  component: () => import('./views/layout/main'),
  name: 'main',
  redirect: {name: 'index'},
  meta: {title: '门户'},
  children: [
    // {
    //   path: '/sys-menu',
    //   component: () => import('.././packages/views/modules/sys/menu'),
    //   name: 'SYS_MENU',
    //   meta: {title: '菜单管理', isTab: true}
    // },
    {path: '/home',
      component: () => import('./views/modules/sys/task/taskCenter'),
      name: 'home',
      meta: {title: '首页', isTab: true}
    }
  ]
}
 
const router = new Router({
  mode: 'hash',
  scrollBehavior: () => ({y: 0}),
  routes: pageRoutes.concat(moduleRoutes)
})
 
// 配置router
setConfig(router, moduleRoutes, (url) => import(`./views/modules/${url}`))
 
router.beforeEach((to, from, next) => {
  if(to.name == 'sys-sysPage-digitalData-home'
    || to.name == 'sys-sysPage-replace-home'
    || to.name == 'sys-sysPage-equipment-home'
    || to.name == 'sys-sysPage-technology-home' ){
    store.state.marginTop = true
    store.state.horizontalRouter = false
    store.state.auiWrapperWidth= true
    store.state.showHeader = false
    store.state.horizontalHide = true
  }else {
    store.state.marginTop = false
    store.state.auiWrapperWidth= false
    store.state.showHeader = true
    store.state.horizontalRouter = true
    store.state.horizontalHide = false
  }
  beforeEach(to, from, next)
})
// router.beforeEach((to, from, next) => {
//   store.state.showHeader = to.name !== 'sys-sysPage-digitalData-home'
//   beforeEach(to, from, next)
// })
export default router