免登录处理
This commit is contained in:
parent
8f4c349c90
commit
59f2bd3095
22
src/app.tsx
22
src/app.tsx
@ -95,6 +95,8 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|||||||
fetchUserInfo?.(setInitialState);
|
fetchUserInfo?.(setInitialState);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
pure: !!new URLSearchParams(window.location.search), // 删除自带页面
|
||||||
|
// pure:true,
|
||||||
links: isDev
|
links: isDev
|
||||||
? [
|
? [
|
||||||
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
|
<Link key="openapi" to="/umi/plugin/openapi" target="_blank">
|
||||||
@ -123,17 +125,17 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// initialState.currentUser 中包含了所有用户信息
|
// initialState.currentUser 中包含了所有用户信息
|
||||||
let menus = await getRoutersInfo();
|
const menus = await getRoutersInfo();
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const hideInMenu = urlParams.get('hideInMenu'); // 替换 'hideInMenu' 为你要获取的参数名
|
// const hideInMenu = urlParams.get('hideInMenu'); // 替换 'hideInMenu' 为你要获取的参数名
|
||||||
if (hideInMenu) {
|
// if (hideInMenu) {
|
||||||
menus = menus.map((item) => {
|
// menus = menus.map((item) => {
|
||||||
return {
|
// return {
|
||||||
...item,
|
// ...item,
|
||||||
hideInMenu: true,
|
// hideInMenu: true,
|
||||||
};
|
// };
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
setInitialState((preInitialState: any) => ({
|
setInitialState((preInitialState: any) => ({
|
||||||
...preInitialState,
|
...preInitialState,
|
||||||
menus,
|
menus,
|
||||||
|
@ -222,7 +222,7 @@ const KeepAliveTabs = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
// <div className={styles.tabs} style={{ width: initialState?.collapsed ? "calc(100vw - 41px)" : "calc(100vw - 249px)" }}>
|
// <div className={styles.tabs} style={{ width: initialState?.collapsed ? "calc(100vw - 41px)" : "calc(100vw - 249px)" }}>
|
||||||
<div className={styles.tabs} id="contentContainer">
|
<div className={!!new URLSearchParams(window.location.search) ? 'hideContent' : styles.tabs} id="contentContainer">
|
||||||
{tabList.length > 0 && <SortableList onSortEnd={onSortEnd} axis={'x'} distance={1} />}
|
{tabList.length > 0 && <SortableList onSortEnd={onSortEnd} axis={'x'} distance={1} />}
|
||||||
<div className={`${styles.tabLeftMenu} ${tabList.length >= showTabs && styles.boxShadow}`}>
|
<div className={`${styles.tabLeftMenu} ${tabList.length >= showTabs && styles.boxShadow}`}>
|
||||||
{tabList.length > showTabs && (
|
{tabList.length > showTabs && (
|
||||||
|
@ -27,6 +27,11 @@ body {
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.hideContent{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
ul,
|
ul,
|
||||||
ol {
|
ol {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@ -25,7 +25,7 @@ import './style/index.less';
|
|||||||
const Welcome = React.memo(({ prefix, getUserData, config, ...restProps }) => {
|
const Welcome = React.memo(({ prefix, getUserData, config, ...restProps }) => {
|
||||||
const currentPrefix = getPrefix(prefix);
|
const currentPrefix = getPrefix(prefix);
|
||||||
return (
|
return (
|
||||||
<div className={`${currentPrefix}-welcome`}>
|
<div className={!!new URLSearchParams(window.location.search) ? '' : `${currentPrefix}-welcome`}>
|
||||||
{
|
{
|
||||||
<ConfigContent.Provider value={config}>
|
<ConfigContent.Provider value={config}>
|
||||||
<Home config={config} {...restProps} />
|
<Home config={config} {...restProps} />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user