Commit c5029e04 authored by 左玲玲's avatar 左玲玲 😬

1539

parent d82b6972
...@@ -152,16 +152,10 @@ export const layout = ({ initialState, setInitialState }) => { ...@@ -152,16 +152,10 @@ export const layout = ({ initialState, setInitialState }) => {
noFound: <div>noFound</div>, noFound: <div>noFound</div>,
// 增加一个 loading 的状态 // 增加一个 loading 的状态
childrenRender: (children, props) => { childrenRender: (children, props) => {
let home, items = initialState?.newMenu?.userHavePermList ?? [];
if (history.location.pathname != "/welcome" && history.location.pathname != "/") {
home = history.location.pathname
} else {
home = items?.length > 0 ? items[0].path.indexOf("/") > -1 ? items[0].path : items[0]?.routes?.length > 0 ? items[0]?.routes[0]?.path : "" : "";
}
return ( return (
<> <>
{initialState?.currentUser && location.pathname !== loginPath ? ( {initialState?.currentUser && location.pathname !== loginPath ? (
<TagView home={home}>{children}</TagView> <TagView home='/welcome'>{children}</TagView>
) : ( ) : (
children children
)} )}
......
...@@ -21,42 +21,42 @@ function strToHump(str) { ...@@ -21,42 +21,42 @@ function strToHump(str) {
} }
let CardItems = (datav, i, getstar, addHistory) => { let CardItems = (datav, i, getstar, addHistory) => {
let name = datav.name, let name = datav.name,
collected = datav.isExist == '1', collected = datav.isExist == '1',
icon = datav.icon ? strToHump(datav.icon) : 'ToolOutlined', icon = datav.icon ? strToHump(datav.icon) : 'ToolOutlined',
ItemIcon = icon ? Ant4Icons[icon] : Ant4Icons['ToolOutlined']; ItemIcon = icon ? Ant4Icons[icon] : Ant4Icons['ToolOutlined'];
return ( return (
<div <div
key={i} key={i}
className={styles.carditem} className={styles.carditem}
onClick={async () => { onClick={async () => {
history.push(datav.path); history.push(datav.path);
await addHistory(datav.key); await addHistory(datav.key);
}} }}
> >
<a className={styles.diylink}> <a className={styles.diylink}>
{' '} {' '}
{React.createElement(Ant4Icons[icon], { style: { marginRight: 6 } })} {React.createElement(Ant4Icons[icon], { style: { marginRight: 6 } })}
{name} {name}
</a> </a>
{collected ? ( {collected ? (
<Ant4Icons.StarFilled <Ant4Icons.StarFilled
className={styles.collected} className={styles.collected}
onClick={async (e) => { onClick={async (e) => {
getstar(e, collected, datav.key); getstar(e, collected, datav.key);
}} }}
/> />
) : ( ) : (
<Ant4Icons.StarOutlined <Ant4Icons.StarOutlined
className={styles.tocollect} className={styles.tocollect}
onClick={async (e) => { onClick={async (e) => {
getstar(e, collected, datav.key); getstar(e, collected, datav.key);
}} }}
/> />
)} )}
</div> </div>
); );
}, },
coles = { xs: 24, sm: 24, md: 12, lg: 8, xl: 6, xxl: 4 }; coles = { xs: 24, sm: 24, md: 12, lg: 8, xl: 6, xxl: 4 };
function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile, name, menuData }) { function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile, name, menuData }) {
...@@ -169,7 +169,6 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile, ...@@ -169,7 +169,6 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
}; };
}); });
}, [collectPerm]); }, [collectPerm]);
return ( return (
<Sider <Sider
trigger={null} trigger={null}
...@@ -237,6 +236,12 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile, ...@@ -237,6 +236,12 @@ function SiderMenu({ logo, collapsed, onCollapse, fixSiderbar, theme, isMobile,
label: '产品与服务', label: '产品与服务',
type: 'sub1', type: 'sub1',
}, },
{
key: '/welcome',
label: '首页',
type: 'sub1',
icon: <Ant4Icons.HomeOutlined />
},
...collectList, ...collectList,
]} ]}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment