|
@@ -1,7 +1,7 @@
|
|
/*
|
|
/*
|
|
* @Author: your name
|
|
* @Author: your name
|
|
* @Date: 2022-01-06 15:25:39
|
|
* @Date: 2022-01-06 15:25:39
|
|
- * @LastEditTime: 2022-07-08 16:29:17
|
|
|
|
|
|
+ * @LastEditTime: 2022-07-11 17:10:52
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @LastEditors: code4eat awesomedema@gmail.com
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
|
|
@@ -10,21 +10,33 @@
|
|
import { IRouteComponentProps, useModel, Helmet } from 'umi';
|
|
import { IRouteComponentProps, useModel, Helmet } from 'umi';
|
|
// import { CrownOutlined, UserOutlined, SmileOutlined } from '@ant-design/icons';
|
|
// import { CrownOutlined, UserOutlined, SmileOutlined } from '@ant-design/icons';
|
|
import ProLayout, { PageContainer } from '@ant-design/pro-layout';
|
|
import ProLayout, { PageContainer } from '@ant-design/pro-layout';
|
|
-import { getPlatformMenu } from '@/service/menu';
|
|
|
|
|
|
+import { getPlatformMenu, getSpecifyMenuDetail } from '@/service/menu';
|
|
import './index.less';
|
|
import './index.less';
|
|
import { TreeItemType } from '@/utils';
|
|
import { TreeItemType } from '@/utils';
|
|
import { SpacicalPageParamsType } from '@/typings';
|
|
import { SpacicalPageParamsType } from '@/typings';
|
|
-import { useEffect, useState } from 'react';
|
|
|
|
|
|
+import { Key, useEffect, useState } from 'react';
|
|
|
|
|
|
export default function Layout({ children, location, route, history, match, ...rest }: IRouteComponentProps) {
|
|
export default function Layout({ children, location, route, history, match, ...rest }: IRouteComponentProps) {
|
|
const { initialState, setInitialState } = useModel('@@initialState');
|
|
const { initialState, setInitialState } = useModel('@@initialState');
|
|
const [openKeys, set_openKeys] = useState<string[]>([]);
|
|
const [openKeys, set_openKeys] = useState<string[]>([]);
|
|
const [selectedKeys, set_selectedKeys] = useState<string[]>([]);
|
|
const [selectedKeys, set_selectedKeys] = useState<string[]>([]);
|
|
const [emptyPageContent, set_emptyPageContent] = useState('');
|
|
const [emptyPageContent, set_emptyPageContent] = useState('');
|
|
- const isShowMenu = localStorage.getItem('isChildShowMenu');
|
|
|
|
|
|
+ const [isShowPageMenu,set_isShowPageMenu] = useState(true);
|
|
|
|
+
|
|
|
|
+ //const isShowMenu = localStorage.getItem('isChildShowMenu');
|
|
// console.log({ children, location, route, history, match});
|
|
// console.log({ children, location, route, history, match});
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ const setEmptyPageContent =async (menuId:Key) => {
|
|
|
|
+ const menuItem = await getSpecifyMenuDetail(menuId);
|
|
|
|
+ if(menuItem.isSetupMenu){
|
|
|
|
+ set_isShowPageMenu(false);
|
|
|
|
+ }
|
|
|
|
+ set_emptyPageContent(menuItem.description);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<ProLayout
|
|
<ProLayout
|
|
style={{
|
|
style={{
|
|
@@ -36,7 +48,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
location={{
|
|
location={{
|
|
|
|
|
|
}}
|
|
}}
|
|
- siderWidth={isShowMenu == 'true' ? 220 : 0}
|
|
|
|
|
|
+ // siderWidth={isShowPageMenu? 220 : 0}
|
|
pageTitleRender={false}
|
|
pageTitleRender={false}
|
|
disableContentMargin
|
|
disableContentMargin
|
|
menuItemRender={(item, dom) => {
|
|
menuItemRender={(item, dom) => {
|
|
@@ -44,8 +56,8 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
<a
|
|
<a
|
|
onClick={() => {
|
|
onClick={() => {
|
|
// console.log('_layout',item);
|
|
// console.log('_layout',item);
|
|
- set_emptyPageContent(item.description);
|
|
|
|
- history.push(`${item.path}${item.contentType == 4 ? `?isEmpty=true&menuId=${item.key}` : ''}` || '/');
|
|
|
|
|
|
+ setEmptyPageContent(item.key as string);
|
|
|
|
+ history.push(`${item.path}${item.contentType == '4' ? `?isEmpty=true&menuId=${item.key}` : ''}` || '/');
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
{dom}
|
|
{dom}
|
|
@@ -71,7 +83,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
if (initialState) {
|
|
if (initialState) {
|
|
const systemId = initialState.currentSelectedSys?.menuId;
|
|
const systemId = initialState.currentSelectedSys?.menuId;
|
|
if (systemId) {
|
|
if (systemId) {
|
|
- const menuData = await getPlatformMenu(Number(systemId));
|
|
|
|
|
|
+ const menuData = await getPlatformMenu(systemId);
|
|
// console.log({menuData});
|
|
// console.log({menuData});
|
|
if (menuData.length > 0) {
|
|
if (menuData.length > 0) {
|
|
set_openKeys([menuData[0].key]);
|
|
set_openKeys([menuData[0].key]);
|
|
@@ -123,7 +135,7 @@ export default function Layout({ children, location, route, history, match, ...r
|
|
>
|
|
>
|
|
{
|
|
{
|
|
location.query.isEmpty == 'true' && (
|
|
location.query.isEmpty == 'true' && (
|
|
- <div style={{ textAlign: 'center', paddingTop: 100 }}>
|
|
|
|
|
|
+ <div className='emptyContainer' style={{ textAlign: 'center', paddingTop: 100 }}>
|
|
<h1>{emptyPageContent}</h1>
|
|
<h1>{emptyPageContent}</h1>
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|