|
@@ -16,7 +16,7 @@ VueRouter.prototype.replace = function replace (location) {
|
|
import main from '@views/main'
|
|
import main from '@views/main'
|
|
import error404 from '@views/404'
|
|
import error404 from '@views/404'
|
|
import login from '@views/login'
|
|
import login from '@views/login'
|
|
-
|
|
|
|
|
|
+import contents from '@layout/main'
|
|
// 子路由
|
|
// 子路由
|
|
import yRouter from '@router/ylf';
|
|
import yRouter from '@router/ylf';
|
|
import lRouter from '@router/lzx';
|
|
import lRouter from '@router/lzx';
|
|
@@ -30,25 +30,29 @@ const routes = [
|
|
meta: {
|
|
meta: {
|
|
requireAuth: true, // 添加该字段,表示进入这个路由是需要登录的
|
|
requireAuth: true, // 添加该字段,表示进入这个路由是需要登录的
|
|
},
|
|
},
|
|
- component: main,
|
|
|
|
|
|
+ component:contents
|
|
|
|
+ ,
|
|
children: [
|
|
children: [
|
|
- { // 首页
|
|
|
|
- path: '/',
|
|
|
|
- component: r => require.ensure([], () => r(require('@views/index/index')), 'indexM')
|
|
|
|
- },
|
|
|
|
|
|
+ // { // 首页
|
|
|
|
+ // path: '/',
|
|
|
|
+ // component: r => require.ensure([], () => r(require('@views/index/index')), 'indexM')
|
|
|
|
+ // },
|
|
...yRouter,
|
|
...yRouter,
|
|
...lRouter,
|
|
...lRouter,
|
|
...zRouter
|
|
...zRouter
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
|
|
+
|
|
path: '/404', // 页面不存在的情况下会跳到404页面
|
|
path: '/404', // 页面不存在的情况下会跳到404页面
|
|
meta: {
|
|
meta: {
|
|
- requireAuth: true, // 添加该字段,表示进入这个路由是需要登录的 /进路由勾子函数beforeEach
|
|
|
|
|
|
+ requireAuth: false, // 添加该字段,表示进入这个路由是需要登录的 /进路由勾子函数beforeEach
|
|
},
|
|
},
|
|
name: 'error404',
|
|
name: 'error404',
|
|
component: error404,
|
|
component: error404,
|
|
- },
|
|
|
|
|
|
+ components:{rally:error404}
|
|
|
|
+ }
|
|
|
|
+ ,
|
|
{
|
|
{
|
|
path: '/login',
|
|
path: '/login',
|
|
meta: {
|
|
meta: {
|
|
@@ -56,6 +60,7 @@ const routes = [
|
|
},
|
|
},
|
|
name: 'login',
|
|
name: 'login',
|
|
component: login,
|
|
component: login,
|
|
|
|
+ components:{rally:login}
|
|
}
|
|
}
|
|
// { // 健康评价报告 - 临时 /部署单页面
|
|
// { // 健康评价报告 - 临时 /部署单页面
|
|
// path:'/healthAssessmentDetailed2',
|
|
// path:'/healthAssessmentDetailed2',
|
|
@@ -66,12 +71,10 @@ const routes = [
|
|
const router = new VueRouter({
|
|
const router = new VueRouter({
|
|
mode: 'history',
|
|
mode: 'history',
|
|
//base: '/sis/', // 部署单页面 404 history 带井号解决(去掉history 放web-inf)
|
|
//base: '/sis/', // 部署单页面 404 history 带井号解决(去掉history 放web-inf)
|
|
- routes
|
|
|
|
|
|
+ routes,
|
|
})
|
|
})
|
|
|
|
|
|
-/**
|
|
|
|
- * 路由的钩子函数,处理是否登录的判断
|
|
|
|
- * **/
|
|
|
|
|
|
+//路由前置导航
|
|
router.beforeEach((to, from, next) => {
|
|
router.beforeEach((to, from, next) => {
|
|
// 登录后登录处理办法
|
|
// 登录后登录处理办法
|
|
// if (to.path === '/login' && store.getters.authToken) {
|
|
// if (to.path === '/login' && store.getters.authToken) {
|
|
@@ -96,5 +99,9 @@ router.beforeEach((to, from, next) => {
|
|
next('/404') // 如果上级也未匹配到路由则跳转登录页面,如果上级能匹配到则转上级路由
|
|
next('/404') // 如果上级也未匹配到路由则跳转登录页面,如果上级能匹配到则转上级路由
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+/**
|
|
|
|
+ * 路由的钩子函数,处理是否登录的判断
|
|
|
|
+ * **/
|
|
|
|
+
|
|
|
|
|
|
export default router
|
|
export default router
|