wente
2023-12-07 d3b33741326d9e6cfc1b0e113e9cc5ec33abec11
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
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: '/TestDjxlHome',
  name: 'TestDjxlHome',
  meta: {title: '登录页', isTab: true},
  component: () => import('./views/pages/TestDjxlHome')
})
pageRoutes.push({
  path: '/szDjxlHome',
  name: 'szDjxlHome',
  meta: {title: '登录页', isTab: true},
  component: () => import('./views/pages/szDjxlHome')
})
// 登录页
pageRoutes.push({
  path: '/index',
  name: 'index',
  meta: {title: '登录页', isTab: true},
  component: () => import('./views/pages/login')
})
// 视频播放页
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: '/single',
  name: 'single',
  meta: {title: '首页', isTab: true},
  component: () => import('./views/pages/single-sign')
})
pageRoutes.push({
  path: '/auth',
  name: 'auth',
  meta: {title: 'SSO登录', isTab: true},
  component: () => import('./views/pages/auth')
})
// pageRoutes.push({
//   path: '/index',
//   component: () => import('./views/modules/index'),
//   name: 'index',
//   meta: {
//     title: '门户',
//     isTab: true
//   }
// })
pageRoutes.push({
  path: '/dashboard',
  component: () => import('./views/modules/index/dashboard'),
  name: 'dashboard',
  meta: {
    title: '态势感知',
    isTab: true
  }
})*/
// 登录页
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}
    },
/*    {path: '/single',
      component: () => import('./views/modules/home'),
      name: 'single',
      meta: {title: '首页', isTab: true}
    },*/
    /*{
      path: '/miantainHome-home',
      component: () => import('./views/modules/home'),
      name: 'home_wx',
      meta: {title: '首页', isTab: true}
    },
    {
      path: '/replaceProblemHome-home',
      component: () => import('./views/modules/replaceProblemHome/home'),
      name: 'home_ghz',
      meta: {title: '首页', isTab: true}
    },
    {
      path: '/technology-home',
      component: () => import('./views/modules/sys/sysPage/technology-home'),
      name: 'home_jszt',
      meta: {title: '首页', isTab: true}
    },
    {
      path: '/repair-outline',
      component: () => import('./views/modules/prevent/repair-outline'),
      name: 'home_yfxwx',
      meta: {title: '大纲', isTab: true}
    },*/
    // {
    //   path: '/eqmmt-index',
    //   component: () => import('./views/modules/eqmmt/home/home'),
    //   name: 'home_qc',
    //   meta: {title: '首页', isTab: true}
    // },
    // {
    //   path: '/train-home',
    //   component: () => import('./views/modules/sys/sysPage/train-home'),
    //   name: 'home_qc',
    //   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