From 8c1d2eeabe41efd4b04641b8c9be34ced4e6fee7 Mon Sep 17 00:00:00 2001 From: lilinyuan <1084668738@qq.com> Date: Mon, 29 Apr 2024 09:58:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=87=8D=E5=AE=9A=E5=90=91=E4=B9=8B=E5=89=8D=E8=A2=AB?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E7=9A=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 1 + src/views/home/index.vue | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index 9c643ac..a4118d1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -188,6 +188,7 @@ router.beforeEach(async (to, form, next) => { next() NProgress.done() } else { + sessionStorage.setItem('toView', JSON.stringify(to)) next({path: '/login'}) } } else { diff --git a/src/views/home/index.vue b/src/views/home/index.vue index bb427b8..679461a 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -51,6 +51,9 @@ import * as echarts from 'echarts' import homeImage from "@/assets/home/home.png" import coffee from "@/assets/home/coffee.png" +import { useRouter } from 'vue-router'; + +const router = useRouter() const list=ref([ { title: '在线用户量', @@ -172,8 +175,22 @@ const init = () => { data.pieCharts = echarts.init(document.getElementById('pie3')).setOption(pieOption) } +const redirectView = () => { + const toView = sessionStorage.getItem('toView') + console.log(toView, 'toView'); + toView ? + router.push({ + path: JSON.parse(toView).path, + query: { + ...JSON.parse(toView).query + } + }) : + null +} + onMounted(() => { init() + redirectView() }) window.addEventListener('resize', () => { From 29ea0d5fe45a77f9a1541a16f327f65e4eaf9c2b Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Mon, 29 Apr 2024 10:03:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat=20:=20=E6=B5=8B=E8=AF=95sso=E5=8D=95?= =?UTF-8?q?=E7=82=B9=E7=99=BB=E5=BD=95=E4=B9=8B=E5=90=8E=E7=9A=84=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index a4118d1..f1fe3af 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -189,7 +189,7 @@ router.beforeEach(async (to, form, next) => { NProgress.done() } else { sessionStorage.setItem('toView', JSON.stringify(to)) - next({path: '/login'}) + next({path: '/cas/login'}) } } else { if (to.path === '/login'|| to.path === '/cas/login') {