From c0b47e0aab3788260f6099f40c85aef053b4cf21 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 29 Aug 2024 17:39:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BB=BB=E5=8A=A1=E5=8F=91?= =?UTF-8?q?=E9=80=81=E4=BF=A1=E6=81=AF=E5=A4=A7=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 24 +++++++++++++++++++++--- src/views/task/list/unit.vue | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/permission.js b/src/permission.js index 7e4416e..8d6cd45 100644 --- a/src/permission.js +++ b/src/permission.js @@ -76,10 +76,28 @@ router.beforeEach(async (to, from, next) => { if (whiteList.indexOf(to.path) !== -1) { // in the free login whitelist, go directly next() - } else { + } else { + console.log("to",to) // other pages that do not have permission to access are redirected to the login page. - next(`/login?redirect=${to.path}`) - NProgress.done() + if (to.query.token && to.query.tp) { + try { + await store.dispatch('user/loginskip', { + token: to.query.token, + tp: to.query.tp + }) + console.log("to.path",to.path) + next(to.path || '/') + } catch (e) { + console.log("/login",e) + next('/login') + } + } else { + // other pages that do not have permission to access are redirected to the login page. + next(`/login?redirect=${to.path}`) + NProgress.done() + } + // next(`/login?redirect=${to.path}`) + // NProgress.done() } } }) diff --git a/src/views/task/list/unit.vue b/src/views/task/list/unit.vue index 03f630d..afd65b0 100644 --- a/src/views/task/list/unit.vue +++ b/src/views/task/list/unit.vue @@ -372,6 +372,26 @@ } }, computed: { + }, + mounted(){ + // var query = this.$route; + // var rediret = this.$route.path?this.$route.path:'/' + // console.log("query",query) + // if (query.token && query.userid) { + // this.loading = true + // this.$store.dispatch('user/loginskip', { + // token: query.token, + // tp: query.tp, + // }).then(() => { + // this.$router.push({ + // path: rediret + // }) + // this.loading = false + // }).catch((error) => { + // console.log(error) + // this.loading = false + // }) + // } }, created() { this.getLeads()