From 280f734f80ce9f9308026604b4fbeb739d63d0c5 Mon Sep 17 00:00:00 2001 From: lehug Date: Thu, 10 Aug 2023 17:40:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=E5=90=8E?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=86=8D=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/axios/service.ts | 5 ++--- src/views/Login/components/LoginForm.vue | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/config/axios/service.ts b/src/config/axios/service.ts index 1a4741b6..3a4635f0 100644 --- a/src/config/axios/service.ts +++ b/src/config/axios/service.ts @@ -31,7 +31,7 @@ let requestList: any[] = [] // 是否正在刷新中 let isRefreshToken = false // 请求白名单,无须token的接口 -const whiteList: string[] = ['/login', '/refresh-token'] +const whiteList: string[] = ['/login', '/refresh-token', '/system/tenant/get-id-by-name'] // 创建axios实例 const service: AxiosInstance = axios.create({ @@ -47,8 +47,7 @@ service.interceptors.request.use( let isToken = (config!.headers || {}).isToken === false whiteList.some((v) => { if (config.url) { - config.url.indexOf(v) > -1 - return (isToken = false) + return (isToken = config.url.indexOf(v) > -1) } }) if (getAccessToken() && !isToken) { diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 82dbe3fc..190c5aa1 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -148,6 +148,8 @@ import { ElLoading } from 'element-plus' import LoginFormTitle from './LoginFormTitle.vue' import type { RouteLocationNormalizedLoaded } from 'vue-router' +import { CACHE_KEY, useCache } from '@/hooks/web/useCache' +const { wsCache } = useCache() import { useIcon } from '@/hooks/web/useIcon' import * as authUtil from '@/utils/auth' @@ -244,6 +246,7 @@ const handleLogin = async (params) => { if (!res) { return } + wsCache.delete(CACHE_KEY.USER) // 清除上次登录用户信息 ElLoading.service({ lock: true, text: '正在加载系统中...',