From 60c0689f69a65bea7fe4f413bf9520820e521cec Mon Sep 17 00:00:00 2001
From: CherrysChang <1935003650@qq.com>
Date: Fri, 5 Jun 2020 14:49:51 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=99=BB=E5=BD=95=E5=90=8E?=
=?UTF-8?q?=E5=8F=B0=E3=80=81=E6=A1=88=E4=BE=8B=E5=90=8C=E6=AD=A5=E5=88=B0?=
=?UTF-8?q?=E5=B9=B3=E5=8F=B0=20=E6=94=B9=E9=80=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main.js | 22 +++++++++++++---------
src/views/TrainHome.vue | 2 +-
src/views/train/case-detail.vue | 17 +++++++++--------
src/views/train/case-list.vue | 18 +++++++++---------
4 files changed, 32 insertions(+), 27 deletions(-)
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 @@