Kaynağa Gözat

fix: 登录修改

outaozhen 3 yıl önce
ebeveyn
işleme
8fd89980ae

+ 3 - 3
src/app.tsx

@@ -171,9 +171,9 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
   return {
     rightContentRender: () => <RightContent />,
     disableContentMargin: false,
-    waterMarkProps: {
-      content: initialState?.currentUser?.name
-    },
+    // waterMarkProps: {
+    //   content: initialState?.currentUser?.name
+    // },
     onPageChange: () => {
       // const { location } = history
       // // 如果没有登录,重定向到 login

+ 1 - 0
src/components/RightContent/AvatarDropdown.tsx

@@ -44,6 +44,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
       const { key } = event
       if (key === 'logout' && initialState) {
         setInitialState({ ...initialState, currentUser: undefined })
+        localStorage.removeItem('TOKEN_ID')
         loginOut()
         return
       }

+ 2 - 2
src/pages/user/Login/index.tsx

@@ -4,7 +4,7 @@ import React, { useState } from 'react'
 import ProForm, { ProFormCheckbox, ProFormText } from '@ant-design/pro-form'
 import { useIntl, Link, history, FormattedMessage, SelectLang, useModel, useRequest } from 'umi'
 import { login } from '@/services/api/login'
-import { currentAccount as querycurrentAccount } from '@/services/api/login'
+import { queryCurrentUser } from '@/services/api/login'
 import consts from '@/utils/consts'
 import styles from './index.less'
 
@@ -37,7 +37,7 @@ const Login: React.FC = () => {
   const [type, setType] = useState<string>('account')
   const { initialState, setInitialState } = useModel('@@initialState')
 
-  const { run, loading } = useRequest(querycurrentAccount, {
+  const { run, loading } = useRequest(queryCurrentUser, {
     manual: true,
     onSuccess: async result => {
       setInitialState({