Skip to content

Commit

Permalink
Merge branch 'master' of github.com:uiwjs/uiw-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SunLxy committed Jan 16, 2022
2 parents 4440a6d + d6bb593 commit 4bb0e3a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
3 changes: 2 additions & 1 deletion examples/base/mocker/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const { login, verify, logout, selectDemoPage, reloadAuth } = require('./login');


const proxy = {
'GET /api/user': { id: 1, username: 'kenny', sex: 6 },
'POST /api/user': { id: 1, username: 'kenny', sex: 6 },
'POST /api/login': login,
'POST /api/logout': logout,
'GET /api/user/verify': verify,
'POST /api/selectDemoPage': selectDemoPage,
"POST /api/reloadAuth": reloadAuth
"POST /api/reloadAuth": reloadAuth,
};

module.exports = proxy;
15 changes: 11 additions & 4 deletions packages/basic-layouts/src/HeaderRightMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react'
import { Menu, Avatar, Popover } from 'uiw';
import { useNavigate } from 'react-router-dom';
import { HeaderMenuItemsProps } from '../'
import './index.css';


export interface HeaderMenuItemsProps {
title: React.ReactNode;
icon: JSX.Element | string | false | null;
onClick?: () => void;
divider?: boolean;
render?: React.ReactNode;
}
export interface HeaderRightProps {
/**
* 菜单
Expand All @@ -27,7 +34,7 @@ export default function HeaderRightMenu(props: HeaderRightProps) {

const navigate = useNavigate()

const { menus = [], profile = {} } = props
const { menus = [], profile = {}, onReloadAuth } = props

const menuData: Array<HeaderMenuItemsProps & any> = [
{
Expand All @@ -40,7 +47,7 @@ export default function HeaderRightMenu(props: HeaderRightProps) {
{
title: '刷新权限',
icon: "reload",
onClick: props.onReloadAuth,
onClick: onReloadAuth?.(),
},
{
title: '修改密码',
Expand All @@ -54,7 +61,7 @@ export default function HeaderRightMenu(props: HeaderRightProps) {
{
title: '退出登录',
icon: "logout",
onClick: () => navigate("/", { replace: true })
onClick: () => navigate("/login", { replace: true })
},
];

Expand Down
12 changes: 2 additions & 10 deletions packages/basic-layouts/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ import FullScreen from './FullScreen'

const { Header, Footer, Sider, Content } = Layout;


export interface HeaderMenuItemsProps {
title: React.ReactNode;
icon: JSX.Element | string | false | null;
onClick?: () => void;
divider?: boolean;
render?: React.ReactNode;
}

export type BasicLayoutProps = {
logo?: string;
projectName?: string;
Expand All @@ -41,6 +32,7 @@ export default function BasicLayout(props: BasicLayoutProps) {
projectName = 'UIW Admin',
profile = {},
menus = [],
onReloadAuth
} = props || {};

const [collapsed, setCollapsed] = useState(false);
Expand All @@ -62,7 +54,7 @@ export default function BasicLayout(props: BasicLayoutProps) {
<div style={{ display: 'flex', justifyItems: 'center', alignItems: "center" }}>
{profile?.menuLeft}
<FullScreen />
<HeaderRightMenu onReloadAuth={props.onReloadAuth} profile={profile} menus={menus} />
<HeaderRightMenu onReloadAuth={onReloadAuth} profile={profile} menus={menus} />
</div>
)
}, [profile, menus])
Expand Down

0 comments on commit 4bb0e3a

Please sign in to comment.