From 2715681e076da62bc555cfd5676ba0d6c265398c Mon Sep 17 00:00:00 2001 From: Linzp Date: Wed, 8 Apr 2026 13:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/Account/Account/DoLogin.js | 2 +- src/components/Account/Account/Forget.js | 2 +- src/components/Account/Account/Modify.js | 2 +- src/components/Account/Account/Register.js | 2 +- src/components/Account/Login/index.js | 2 +- src/components/Authenticate/Authenticate.js | 5 +- src/components/Authenticate/MainLayout.js | 33 ++++++- src/components/UserTool/UserTool.js | 103 ++++++++++---------- 9 files changed, 93 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index ed189cd..686460a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kne-components/components-admin", - "version": "1.1.26", + "version": "1.1.28", "description": "用于实现一个后台管理系统的必要组件", "scripts": { "init": "husky", diff --git a/src/components/Account/Account/DoLogin.js b/src/components/Account/Account/DoLogin.js index 82c2d99..d4348d2 100644 --- a/src/components/Account/Account/DoLogin.js +++ b/src/components/Account/Account/DoLogin.js @@ -9,7 +9,7 @@ import { useIntl } from '@kne/react-intl'; import withLocale from '../withLocale'; const DoLoginInner = createWithRemoteLoader({ - modules: ['component-core:Global@usePreset'] + modules: ['components-core:Global@usePreset'] })(({ remoteModules, children }) => { const [usePreset] = remoteModules; const { formatMessage } = useIntl(); diff --git a/src/components/Account/Account/Forget.js b/src/components/Account/Account/Forget.js index 305a405..2669fcc 100644 --- a/src/components/Account/Account/Forget.js +++ b/src/components/Account/Account/Forget.js @@ -5,7 +5,7 @@ import { createWithRemoteLoader } from '@kne/remote-loader'; import { useProps } from './context'; const Forget = createWithRemoteLoader({ - modules: ['component-core:Global@usePreset'] + modules: ['components-core:Global@usePreset'] })(({ remoteModules }) => { const [usePreset] = remoteModules; const { apis: presetApis, ajax } = usePreset(); diff --git a/src/components/Account/Account/Modify.js b/src/components/Account/Account/Modify.js index 4858258..5c6fa5b 100644 --- a/src/components/Account/Account/Modify.js +++ b/src/components/Account/Account/Modify.js @@ -10,7 +10,7 @@ import { useIntl } from '@kne/react-intl'; import withLocale from '../withLocale'; const ModifyInner = createWithRemoteLoader({ - modules: ['component-core:Global@usePreset'] + modules: ['components-core:Global@usePreset'] })(({ remoteModules }) => { const [usePreset] = remoteModules; const { apis: presetApis, ajax } = usePreset(); diff --git a/src/components/Account/Account/Register.js b/src/components/Account/Account/Register.js index e67783b..e450e0c 100644 --- a/src/components/Account/Account/Register.js +++ b/src/components/Account/Account/Register.js @@ -9,7 +9,7 @@ import { useIntl } from '@kne/react-intl'; import withLocale from '../withLocale'; const RegisterInner = createWithRemoteLoader({ - modules: ['component-core:Global@usePreset'] + modules: ['components-core:Global@usePreset'] })(({ remoteModules }) => { const [usePreset] = remoteModules; const { formatMessage } = useIntl(); diff --git a/src/components/Account/Login/index.js b/src/components/Account/Login/index.js index fc0a722..a3a4f20 100644 --- a/src/components/Account/Login/index.js +++ b/src/components/Account/Login/index.js @@ -9,7 +9,7 @@ import withLocale from '../withLocale'; export const LOGIN_REMEMBER_ACCOUNT = 'LOGIN_REMEMBER_ACCOUNT'; const LoginInner = createWithRemoteLoader({ - modules: ['component-core:FormInfo'] + modules: ['components-core:FormInfo'] })(({ remoteModules, ...p }) => { const { formatMessage } = useIntl(); const { title, registerUrl, forgetUrl, type, onSubmit } = Object.assign( diff --git a/src/components/Authenticate/Authenticate.js b/src/components/Authenticate/Authenticate.js index 8016a6a..d333c3a 100644 --- a/src/components/Authenticate/Authenticate.js +++ b/src/components/Authenticate/Authenticate.js @@ -1,6 +1,7 @@ import { createWithRemoteLoader } from '@kne/remote-loader'; import { Navigate, useLocation } from 'react-router-dom'; import Fetch from '@kne/react-fetch'; +import merge from 'lodash/merge'; const CheckAccountIsInit = ({ data, baseUrl, children }) => { const location = useLocation(); @@ -18,12 +19,12 @@ const CheckAccountIsInit = ({ data, baseUrl, children }) => { export const CustomUserInfo = createWithRemoteLoader({ modules: ['components-core:Global@SetGlobal'] -})(({ remoteModules, cache, baseUrl, children, api }) => { +})(({ remoteModules, cache, baseUrl, children, api, ...props }) => { const [SetGlobal] = remoteModules; return ( { return ( diff --git a/src/components/Authenticate/MainLayout.js b/src/components/Authenticate/MainLayout.js index d51cb9a..7803ed2 100644 --- a/src/components/Authenticate/MainLayout.js +++ b/src/components/Authenticate/MainLayout.js @@ -1,9 +1,10 @@ import { createWithRemoteLoader } from '@kne/remote-loader'; import { Outlet } from 'react-router-dom'; +import { LoginOutlined } from '@ant-design/icons'; import { SuperAdminInfo, UserInfo, CustomUserInfo } from './Authenticate'; import UserTool from '@components/UserTool'; import Language from '@components/Account/Language'; -import { Flex } from 'antd'; +import { Flex, Button } from 'antd'; export const MainLayout = createWithRemoteLoader({ modules: ['components-core:Layout'] @@ -82,6 +83,36 @@ export const AfterUserLoginLayout = ({ baseUrl, navigation, children, ...props } ); }; +export const Layout = props => { + return ( + ( + } + onClick={() => { + props.login(); + }} + iconPosition="end"> + 登录 + + ) + })}> + + + )}> + + + ); +}; + export const AfterUserLogin = ({ baseUrl, children, ...props }) => { return {children || }; }; diff --git a/src/components/UserTool/UserTool.js b/src/components/UserTool/UserTool.js index 8dacde7..d6508b1 100644 --- a/src/components/UserTool/UserTool.js +++ b/src/components/UserTool/UserTool.js @@ -4,61 +4,62 @@ import { useLogout } from '@components/Account'; import style from './style.module.scss'; import withLocale from './withLocale'; import { useIntl } from '@kne/react-intl'; +import classnames from 'classnames'; const UserTool = createWithRemoteLoader({ modules: ['components-core:Image', 'components-core:Icon'] -})(withLocale(({ remoteModules, avatar, name, email, storeKeys = { token: 'X-User-Token' }, domain, list, children = null }) => { - const [Image, Icon] = remoteModules; - const logout = useLogout({ storeKeys, domain }); - const { formatMessage } = useIntl(); - return ( - ( - - - -
-
{name || formatMessage({ id: 'UserToolUnnamed' })}
-
{email || '-'}
-
+})( + withLocale(({ remoteModules, avatar, name, email, storeKeys = { token: 'X-User-Token' }, domain, list, children = null }) => { + const [Image, Icon] = remoteModules; + const logout = useLogout({ storeKeys, domain }); + const { formatMessage } = useIntl(); + return ( + ( + + + +
+
{name || formatMessage({ id: 'UserToolUnnamed' })}
+
{email || '-'}
+
+
+ + {children} + + {list && + list.length > 0 && + list.map((item, index) => { + return ( + + + {item.iconType && } + {item.label} + + + ); + })} + + + + {formatMessage({ id: 'UserToolLogout' })} + + +
- - {children} - - {list && - list.length > 0 && - list.map((item, index) => { - return ( - - - {item.iconType && } - {item.label} - - - ); - })} - - - - {formatMessage({ id: 'UserToolLogout' })} - - - + )} + arrow={false} + transitionName={'ant-slide-up'}> + + +
{name || formatMessage({ id: 'UserToolUnnamed' })}
+
- )} - arrow={false} - transitionName={'ant-slide-up'}> - - -
{name || formatMessage({ id: 'UserToolUnnamed' })}
- -
-
- ); -})); +
+ ); + }) +); export default UserTool;