From af35ad1d1ea9791cb92d96a659ccdac42ad70600 Mon Sep 17 00:00:00 2001 From: Jo <479214531@qq.com> Date: Mon, 24 Jan 2022 11:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E6=8A=8AschoolId?= =?UTF-8?q?=E5=8A=A0=E5=9C=A8url=E4=B8=8A=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E5=86=B2=E7=AA=81=E5=AF=BC=E8=87=B4=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E7=BC=93=E5=AD=98=E9=87=8C=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/stat/list/index.vue | 6 +++--- src/router/permission.js | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/stat/list/index.vue b/src/pages/stat/list/index.vue index 7961775..739eb3c 100644 --- a/src/pages/stat/list/index.vue +++ b/src/pages/stat/list/index.vue @@ -188,9 +188,9 @@ export default { }, mounted() { // 如果是从用户那边跳过来的,schoolId会因为加载顺序的问题,获取不到,所以要从url里去获取schoolId - if(!this.schoolId){ - let schoolId = this.$route.query.schoolId - if(schoolId) schoolId = atob(decodeURI(schoolId)) + let schoolId = this.$route.query.schoolId + if(schoolId){ + schoolId = atob(decodeURI(schoolId)) this.setInfo({ schoolId }) diff --git a/src/router/permission.js b/src/router/permission.js index 3ce21be..eca9919 100644 --- a/src/router/permission.js +++ b/src/router/permission.js @@ -14,9 +14,10 @@ router.beforeEach((to, from, next) => { } else if(role && to.path == '/login') { next('/index') } else { - let mg = from.query.mg - let routes = store.state.auth.routes - let toPath = to.path + const mg = from.query.mg + const schoolId = from.query.schoolId + const routes = store.state.auth.routes + const toPath = to.path // mg是判断是否是管理员的参数,base64解码后如果等于true则为管理员,否则为普通用户。 // 如果是管理员则需要从获取的路由权限里判断当前访问页面是否有权限访问,如果没权限访问则跳转到403 if((mg && atob(decodeURI(mg)) === 'true') || (to.query.mg && atob(decodeURI(to.query.mg)) === 'true')){ @@ -28,7 +29,10 @@ router.beforeEach((to, from, next) => { if(!to.query.mg){ next({ path: toPath, - query: {mg} + query: { + mg, + schoolId + } }) }else{ next()