From e4e703830d63223b9ba34e4096a43b9dd0676cfd Mon Sep 17 00:00:00 2001 From: zhengzhou Date: Tue, 10 Aug 2021 10:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=B0=E4=BD=8F=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E9=80=BB=E8=BE=91;=E5=8E=BB=E6=8E=89=E6=8E=A8?= =?UTF-8?q?=E7=99=BB=E6=97=B6=E7=9A=84=E5=AF=86=E7=A0=81=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppHeader/components/userCenter/UserCenter.tsx | 4 ++-- src/pages/login/index.tsx | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/AppHeader/components/userCenter/UserCenter.tsx b/src/components/AppHeader/components/userCenter/UserCenter.tsx index c3e5aa3..26538e6 100644 --- a/src/components/AppHeader/components/userCenter/UserCenter.tsx +++ b/src/components/AppHeader/components/userCenter/UserCenter.tsx @@ -67,8 +67,8 @@ function PopContent(props: PopContentProps) { const tryLogout = useCallback(() => { if (hidePop) hidePop(); - storage.remove('account'); - storage.remove('password'); + // storage.remove('account'); + // storage.remove('password'); confirm({ onOk() { logout(); diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index e24be2f..329d5ee 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -59,9 +59,14 @@ export default function Login() { }) .success(() => { // 记录账号密码 - if (isClient && keepPass) { - storage.set('account', account, true); - storage.set('password', password, true); + if (isClient) { + if (keepPass) { + storage.set('account', account, true); + storage.set('password', password, true); + } else { + storage.remove('account'); + storage.remove('password'); + } } // history.push('/'); // window.location.href = '/'; @@ -69,7 +74,7 @@ export default function Login() { refresh(); // window.location.reload(); }); - }, [account, password]); + }, [account, password, keepPass]); useEffect(() => { setErrText('');