From 6203566058ea22acc578ac45e4b8d1e9fa59890f Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Mon, 10 Oct 2022 14:53:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/router/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/src/router/index.js b/front/src/router/index.js index 9c0f4ca9..536d6b37 100644 --- a/front/src/router/index.js +++ b/front/src/router/index.js @@ -575,13 +575,13 @@ router.beforeEach((to, from, next) => { // 定义失效时间 const timeOver = 2 * 60 * 60 * 1000 let date = new Date().getTime() - if (date - tokenStartTime > timeOver) { + if (date - tokenStartTime > timeOver && token) { + message.warning('登录失效,请重新登录!') token = null } console.log('判断token失效', token, date - tokenStartTime > timeOver) if (!token) { if (to.path == '/login') return next() - message.warning('登录失效,请重新登录!') return next('/login') } else if (to.path == '/login') { return next('/home')