diff --git a/src/main.js b/src/main.js
index 1d3c216..5f7700f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -47,18 +47,22 @@ const router = new VueRouter({
router.beforeEach((to, from, next) => {
//NProgress.start();
let user = JSON.parse(sessionStorage.getItem('user'));
- if (!user && to.path != '/login') {
- if (/yyyfLoginBack/.test(to.path)) {
+ if (!user && to.path != '/login' && !/yyyfLoginBack/.test(to.path)) {
+ next({path: '/login'})
+ } else if (user && to.path == '/login') {
+ if (user.userType == 3) {
+ next({name: 'Index'})
+ } else {
+ next({path: '/yyyfLoginBack'})//next()
+ }
+ } else if (user && user.userType == 3 && to.path == '/yyyfLoginBack') {//学校管理员
+ if (to.query && (to.query.userType == 1 || to.query.userType == 2)) {
next()
- // } else if (/train/.test(to.path)) {//暂时这么写,user是需要有值的,这里先方便页面
- // next()
} else {
- next({path: '/login'})
+ next({name: 'Index'})
}
- }else if(user && to.path =='/login'){
- next({name:'Index'})
- } else if (user && user.userType == 3 && to.path == '/yyyfLoginBack') {
- next({name: 'Index'})
+ } else if (user && (user.userType == 1 || user.userType == 2) && to.path == '/') {
+ next({path: '/yyyfLoginBack'})//next({path: '/login'})
} else {
next()
}
diff --git a/src/views/TrainHome.vue b/src/views/TrainHome.vue
index 4dd1d0b..cdf6f49 100644
--- a/src/views/TrainHome.vue
+++ b/src/views/TrainHome.vue
@@ -3,7 +3,7 @@