Commit 59e86911 authored by 曾婧's avatar 曾婧

华农主题提交本地一版本2

parent 715215a2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2022-04-14 10:25:39 * @Date: 2022-04-14 10:25:39
* @LastEditTime: 2022-04-14 10:30:09 * @LastEditTime: 2022-04-14 10:30:09
* @LastEditors: ZengJing * @LastEditors: ZengJing
* @Description: * @Description:
* @FilePath: \CivWeb\src\components\GlobalHeader\HNRightContent.js * @FilePath: \CivWeb\src\components\GlobalHeader\HNRightContent.js
*/ */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
......
...@@ -5,8 +5,8 @@ import classNames from 'classnames'; ...@@ -5,8 +5,8 @@ import classNames from 'classnames';
import { ReactSVG } from 'react-svg'; import { ReactSVG } from 'react-svg';
import useMergedState from 'rc-util/lib/hooks/useMergedState'; import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
const LoadingSkeleton = (props) => { const LoadingSkeleton = props => {
const route = props.route; const { route } = props;
return ( return (
<div style={{ padding: route && !route.routes ? '20px 6px 6px 6px' : '0px' }}> <div style={{ padding: route && !route.routes ? '20px 6px 6px 6px' : '0px' }}>
<Skeleton loading={route && !route.routes} active title={false} paragraph={{ rows: 10 }}> <Skeleton loading={route && !route.routes} active title={false} paragraph={{ rows: 10 }}>
...@@ -16,23 +16,16 @@ const LoadingSkeleton = (props) => { ...@@ -16,23 +16,16 @@ const LoadingSkeleton = (props) => {
); );
}; };
const Menu = (props) => { const Menu = props => {
const { const { prefixCls, collapsed, onCollapse, onMenuClick, menuHeaderRender, onMenuHeaderClick } = props;
prefixCls, const { route } = props;
collapsed,
onCollapse,
onMenuClick,
menuHeaderRender,
onMenuHeaderClick,
} = props;
const route = props.route;
const history = useHistory(); const history = useHistory();
const [selectIndex, setSelectIndex] = useMergedState(() => -1, { const [selectIndex, setSelectIndex] = useMergedState(() => -1, {
value: props.active, value: props.active,
onChange: props.onActiveChange, onChange: props.onActiveChange,
}); });
const toLink = (path) => { const toLink = path => {
if (!window.__POWERED_BY_QIANKUN__) { if (!window.__POWERED_BY_QIANKUN__) {
history.push(path); history.push(path);
} else { } else {
...@@ -61,7 +54,7 @@ const Menu = (props) => { ...@@ -61,7 +54,7 @@ const Menu = (props) => {
} }
onMenuClick && onMenuClick(current, childrenRoutes, index); onMenuClick && onMenuClick(current, childrenRoutes, index);
}; };
return ( return (
<LoadingSkeleton {...props}> <LoadingSkeleton {...props}>
{route && route.routes && route.routes.length > 0 && ( {route && route.routes && route.routes.length > 0 && (
...@@ -70,23 +63,13 @@ const Menu = (props) => { ...@@ -70,23 +63,13 @@ const Menu = (props) => {
menuHeaderRender(props) menuHeaderRender(props)
) : ( ) : (
<> <>
<ul <ul className={classNames(`${prefixCls}-menu`)} style={{ minHeight: '0px', marginBottom: '0px' }}>
className={classNames(`${prefixCls}-menu`)}
style={{ minHeight: '0px', marginBottom: '0px' }}
>
<li className={`${prefixCls}-menu-item`} onClick={onMenuHeaderClick}> <li className={`${prefixCls}-menu-item`} onClick={onMenuHeaderClick}>
<Tooltip placement="right" title={collapsed ? route.name : ''}> <Tooltip placement="right" title={collapsed ? route.name : ''}>
<a> <a>
{route && route.extData && route.extData.icon && ( {route && route.extData && route.extData.icon && <img src={route.extData.icon} />}
<img src={route.extData.icon} />
)}
{collapsed ? null : ( {collapsed ? null : (
<span <span className={classNames(`${prefixCls}-menu-item-text`, `${prefixCls}-menu-item-current`)}>
className={classNames(
`${prefixCls}-menu-item-text`,
`${prefixCls}-menu-item-current`,
)}
>
{route && route.name} {route && route.name}
</span> </span>
)} )}
...@@ -100,60 +83,58 @@ const Menu = (props) => { ...@@ -100,60 +83,58 @@ const Menu = (props) => {
<ul className={classNames(`${prefixCls}-menu ${prefixCls}-menu-vertical`)}> <ul className={classNames(`${prefixCls}-menu ${prefixCls}-menu-vertical`)}>
{route && {route &&
(route.routes || []) (route.routes || [])
.filter((item) => !item.hideInMenu) .filter(item => !item.hideInMenu)
.map((item, index) => { .map((item, index) => (
return ( <React.Fragment key={index}>
<React.Fragment key={index}> <li
<li key={index}
key={index} className={classNames(`${prefixCls}-menu-item`, {
className={classNames(`${prefixCls}-menu-item`, { [`${prefixCls}-menu-item-active`]: index === selectIndex,
[`${prefixCls}-menu-item-active`]: index === selectIndex, })}
})} onClick={() => onSelectItem(item, index)}
onClick={() => onSelectItem(item, index)} >
> <Tooltip placement="right" title={collapsed ? item.name : ''}>
<Tooltip placement="right" title={collapsed ? item.name : ''}> <a>
<a> {item.icon ? (
{item.icon ? ( item.icon
item.icon ) : item.extData && /.svg/.test(item.extData.icon) ? (
) : item.extData && /.svg/.test(item.extData.icon) ? ( <ReactSVG
<ReactSVG src={item.extData.icon}
src={item.extData.icon} style={{ width: '20px', height: '20px' }}
style={{ width: '20px', height: '20px' }} className={`${prefixCls}-menu-item-icon`}
className={`${prefixCls}-menu-item-icon`} />
/> ) : (
) : ( item.extData && <img src={item.extData.icon} />
item.extData && <img src={item.extData.icon} /> )}
)} {collapsed ? (
{collapsed ? ( item.extData && (
item.extData && ( <span className={`${prefixCls}-menu-item-text`}>
<span className={`${prefixCls}-menu-item-text`}> {(item.extData.shortName || item.name).substr(0, 2)}
{(item.extData.shortName || item.name).substr(0, 2)} </span>
</span> )
) ) : (
) : ( <span className={`${prefixCls}-menu-item-text`}>{item.name}</span>
<span className={`${prefixCls}-menu-item-text`}>{item.name}</span> )}
)} </a>
</a> </Tooltip>
</Tooltip> </li>
</li> <Divider
<Divider style={{
style={{ border: '1px solid rgb(49, 53, 62, 0.3)',
border: '1px solid rgb(49, 53, 62, 0.3)', margin: '0 auto',
margin: '0 auto', minWidth: '80%',
minWidth: '80%', width: '80%',
width: '80%', }}
}} />
/> </React.Fragment>
</React.Fragment> ))}
);
})}
</ul> </ul>
</React.Fragment> </React.Fragment>
)} )}
</LoadingSkeleton> </LoadingSkeleton>
); );
}; };
export default (props) => { export default props => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('layout-slider'); const prefixCls = getPrefixCls('layout-slider');
const { menuItemRender, menuHeaderRender, siderWidth } = props; const { menuItemRender, menuHeaderRender, siderWidth } = props;
...@@ -178,14 +159,9 @@ export default (props) => { ...@@ -178,14 +159,9 @@ export default (props) => {
})} })}
> >
<div className={`${prefixCls}-children`}> <div className={`${prefixCls}-children`}>
<div <div className={`${prefixCls}-wrapper`} style={{ flex: '1 1 0%', overflow: 'hidden auto' }}>
className={`${prefixCls}-wrapper`} {/* {LoadingSkeleton(props)} */}
style={{ flex: '1 1 0%', overflow: 'hidden auto' }} {menuItemRender ? menuItemRender(props) : Menu(Object.assign({}, props, { prefixCls }))}
>
{/*{LoadingSkeleton(props)}*/}
{menuItemRender
? menuItemRender(props)
: Menu(Object.assign({}, props, { prefixCls: prefixCls }))}
</div> </div>
{route && route.routes && route.routes.length > 0 && ( {route && route.routes && route.routes.length > 0 && (
<div className={`${prefixCls}-pro-sider-links`}> <div className={`${prefixCls}-pro-sider-links`}>
...@@ -216,7 +192,7 @@ export default (props) => { ...@@ -216,7 +192,7 @@ export default (props) => {
fill="currentColor" fill="currentColor"
aria-hidden="true" aria-hidden="true"
> >
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z"></path> <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z" />
</svg> </svg>
</span> </span>
</span> </span>
......
/* /*
* @Author: ZengJing * @Author: ZengJing
* @Date: 2022-04-15 09:34:03 * @Date: 2022-04-15 09:34:03
* @LastEditTime: 2022-04-15 18:06:00 * @LastEditTime: 2022-04-15 18:16:26
* @LastEditors: ZengJing * @LastEditors: ZengJing
* @Description: * @Description:
* @FilePath: \CivWeb\src\layouts\AppLayout\components\SlideMenu\index.js * @FilePath: \CivWeb\src\layouts\AppLayout\components\SlideMenu\index.js
...@@ -15,7 +15,7 @@ import ProLayout, { getPageTitle } from '@ant-design/pro-layout'; ...@@ -15,7 +15,7 @@ import ProLayout, { getPageTitle } from '@ant-design/pro-layout';
import useMergedState from 'rc-util/lib/hooks/useMergedState'; import useMergedState from 'rc-util/lib/hooks/useMergedState';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
const LoadingSkeleton = props => { const LoadingSkeleton = props => {
const route = props.route; const { route } = props;
return ( return (
<div style={{ padding: route && !route.routes ? '20px 6px 6px 6px' : '0px' }}> <div style={{ padding: route && !route.routes ? '20px 6px 6px 6px' : '0px' }}>
<Skeleton loading={route && !route.routes} active title={false} paragraph={{ rows: 10 }}> <Skeleton loading={route && !route.routes} active title={false} paragraph={{ rows: 10 }}>
...@@ -27,7 +27,7 @@ const LoadingSkeleton = props => { ...@@ -27,7 +27,7 @@ const LoadingSkeleton = props => {
const Menu = props => { const Menu = props => {
const { prefixCls, collapsed, onCollapse, onMenuClick, menuHeaderRender, onMenuHeaderClick, title } = props; const { prefixCls, collapsed, onCollapse, onMenuClick, menuHeaderRender, onMenuHeaderClick, title } = props;
const route = props.route; const { route } = props;
const history = useHistory(); const history = useHistory();
const [selectIndex, setSelectIndex] = useMergedState(() => -1, { const [selectIndex, setSelectIndex] = useMergedState(() => -1, {
...@@ -42,10 +42,10 @@ const Menu = props => { ...@@ -42,10 +42,10 @@ const Menu = props => {
} }
}; };
const onSelectItem = (item,dom) => { const onSelectItem = (item, dom) => {
let current = void 0; let current = void 0;
let childrenRoutes = []; let childrenRoutes = [];
console.log('item', item,dom); console.log('item', item, dom);
if (item && item.child) { if (item && item.child) {
current = item.child[0]; current = item.child[0];
...@@ -69,21 +69,21 @@ const Menu = props => { ...@@ -69,21 +69,21 @@ const Menu = props => {
}; };
useEffect(() => { useEffect(() => {
route.routes = treeRoutes(route.routes); route.routes = treeRoutes(route.routes);
console.log('newRoutes************', route.routes); }, [route, treeRoutes]);
}, [route]); const treeRoutes =(iroute =>
const treeRoutes = iroute =>
iroute iroute
.filter(item => item.level !== 3) .filter(item => item.level !== 3)
.map(item => { .map(item => {
console.log('item..>', item); console.log('item..>', item);
if (item.routes && Array.isArray(item.routes) && item.routes.length >= 1) { if (item.routes && Array.isArray(item.routes) && item.routes.length >= 1) {
if(item.level===2){ if (item.level === 2) {
item.child = item.routes; item.child = item.routes;
} }
item.routes = treeRoutes(item.routes); item.routes = treeRoutes(item.routes);
} }
return item; return item;
}); })
);
return ( return (
<LoadingSkeleton {...props}> <LoadingSkeleton {...props}>
{route && route.routes && route.routes.length > 0 && ( {route && route.routes && route.routes.length > 0 && (
...@@ -97,11 +97,11 @@ const Menu = props => { ...@@ -97,11 +97,11 @@ const Menu = props => {
// onHeaderLogo={handlerIndustry} // onHeaderLogo={handlerIndustry}
// onPageChange={handlerPageChange} // onPageChange={handlerPageChange}
// onMenuPanelItemClick={handleUpdateCurrentIndex} // onMenuPanelItemClick={handleUpdateCurrentIndex}
menuItemRender={(item, dom) => { menuItemRender={(item, dom) =>
return item.level < 3 ? ( item.level < 3 ? (
<div <div
onClick={() => { onClick={() => {
onSelectItem(item,dom); onSelectItem(item, dom);
}} }}
className="test-icon" className="test-icon"
> >
...@@ -116,8 +116,8 @@ const Menu = props => { ...@@ -116,8 +116,8 @@ const Menu = props => {
)} )}
<span style={{ marginLeft: '5px' }}> {dom} </span> <span style={{ marginLeft: '5px' }}> {dom} </span>
</div> </div>
) : null; ) : null
}} }
subMenuItemRender={(item, dom) => ( subMenuItemRender={(item, dom) => (
<div className="test-icon"> <div className="test-icon">
{/.svg/.test(item.extData.icon) ? ( {/.svg/.test(item.extData.icon) ? (
......
...@@ -4,7 +4,7 @@ import classNames from 'classnames'; ...@@ -4,7 +4,7 @@ import classNames from 'classnames';
import styles from './index.less'; import styles from './index.less';
const Categories = (props) => { const Categories = props => {
const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex); const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex);
const selectCategories = (event, index) => { const selectCategories = (event, index) => {
event.preventDefault(); event.preventDefault();
...@@ -27,11 +27,7 @@ const Categories = (props) => { ...@@ -27,11 +27,7 @@ const Categories = (props) => {
currentIndex === index ? styles.active : '', currentIndex === index ? styles.active : '',
); );
return ( return (
<div <div className={categorieCls} key={item.name} onClick={event => selectCategories(event, index)}>
className={categorieCls}
key={item.name}
onClick={(event) => selectCategories(event, index)}
>
{/* eslint-disable-next-line jsx-a11y/alt-text */} {/* eslint-disable-next-line jsx-a11y/alt-text */}
<img src={item.extData.icon} /> <img src={item.extData.icon} />
<span>{item.extData.label}</span> <span>{item.extData.label}</span>
......
...@@ -2,9 +2,9 @@ import React from 'react'; ...@@ -2,9 +2,9 @@ import React from 'react';
import styles from './index.less'; import styles from './index.less';
const Menu = (props) => { const Menu = props => {
const renderTitle = (title) => <h4 className={styles.title}>{title}</h4>; const renderTitle = title => <h4 className={styles.title}>{title}</h4>;
const renderMenuItem = (data) => { const renderMenuItem = data => {
let menuItem = []; let menuItem = [];
if (!data) { if (!data) {
return; return;
...@@ -14,12 +14,10 @@ const Menu = (props) => { ...@@ -14,12 +14,10 @@ const Menu = (props) => {
menuItem = ( menuItem = (
<div <div
className={styles['main-menus-recentAll-menu-group-items-menu-item']} className={styles['main-menus-recentAll-menu-group-items-menu-item']}
onClick={(event) => props.handleClick(event, data)} onClick={event => props.handleClick(event, data)}
> >
<img src={data.extData.icon} alt="" /> <img src={data.extData.icon} alt="" />
<a <a className={`${styles['main-menus-recentAll-menu-group-items-menu-item-name']} ${styles.pad}`}>
className={`${styles['main-menus-recentAll-menu-group-items-menu-item-name']} ${styles.pad}`}
>
{data.name} {data.name}
</a> </a>
</div> </div>
...@@ -30,12 +28,10 @@ const Menu = (props) => { ...@@ -30,12 +28,10 @@ const Menu = (props) => {
<div <div
className={styles['main-menus-recentAll-menu-group-items-menu-item']} className={styles['main-menus-recentAll-menu-group-items-menu-item']}
key={item.name} key={item.name}
onClick={(event) => props.handleClick(event, item)} onClick={event => props.handleClick(event, item)}
> >
<img src={item.extData.icon} alt="" /> <img src={item.extData.icon} alt="" />
<a <a className={`${styles['main-menus-recentAll-menu-group-items-menu-item-name']} ${styles.pad}`}>
className={`${styles['main-menus-recentAll-menu-group-items-menu-item-name']} ${styles.pad}`}
>
{item.name} {item.name}
</a> </a>
</div> </div>
......
...@@ -4,7 +4,7 @@ import classNames from 'classnames'; ...@@ -4,7 +4,7 @@ import classNames from 'classnames';
import styles from './min.less'; import styles from './min.less';
const Categories = (props) => { const Categories = props => {
const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex); const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex);
const selectCategories = (event, index) => { const selectCategories = (event, index) => {
event.preventDefault(); event.preventDefault();
...@@ -21,7 +21,7 @@ const Categories = (props) => { ...@@ -21,7 +21,7 @@ const Categories = (props) => {
})} })}
> >
{(props.data || []) {(props.data || [])
.filter((item) => !item.hideInMenu) .filter(item => !item.hideInMenu)
.map((item, index) => { .map((item, index) => {
const categorieCls = classNames( const categorieCls = classNames(
styles['categorie-name'], styles['categorie-name'],
...@@ -29,11 +29,7 @@ const Categories = (props) => { ...@@ -29,11 +29,7 @@ const Categories = (props) => {
currentIndex === index ? styles.active : '', currentIndex === index ? styles.active : '',
); );
return ( return (
<div <div className={categorieCls} key={item.name} onClick={event => selectCategories(event, index)}>
className={categorieCls}
key={item.name}
onClick={(event) => selectCategories(event, index)}
>
{/* eslint-disable-next-line jsx-a11y/alt-text */} {/* eslint-disable-next-line jsx-a11y/alt-text */}
<img src={item.extData.icon} /> <img src={item.extData.icon} />
<span>{item.extData.label}</span> <span>{item.extData.label}</span>
......
...@@ -10,7 +10,7 @@ import { ConfigProvider } from 'antd'; ...@@ -10,7 +10,7 @@ import { ConfigProvider } from 'antd';
// eslint-disable-next-line import/extensions // eslint-disable-next-line import/extensions
import { events } from '@wisdom-utils/utils/lib/helpers'; import { events } from '@wisdom-utils/utils/lib/helpers';
const ThLarge = (props) => ( const ThLarge = props => (
<svg viewBox="0 0 1024 1024" version="1.1" width="14" height="14"> <svg viewBox="0 0 1024 1024" version="1.1" width="14" height="14">
<path <path
d="M592 64h384c26.51 0 48 21.49 48 48v320c0 26.51-21.49 48-48 48H592c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48z m-160 0H48C21.49 64 0 85.49 0 112v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zM0 592v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H48c-26.51 0-48 21.49-48 48z m592 368h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H592c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48z" d="M592 64h384c26.51 0 48 21.49 48 48v320c0 26.51-21.49 48-48 48H592c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48z m-160 0H48C21.49 64 0 85.49 0 112v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zM0 592v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H48c-26.51 0-48 21.49-48 48z m592 368h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H592c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48z"
...@@ -19,15 +19,15 @@ const ThLarge = (props) => ( ...@@ -19,15 +19,15 @@ const ThLarge = (props) => (
</svg> </svg>
); );
const ThLargeIcon = (props) => <Icon component={ThLarge} {...props} />; const ThLargeIcon = props => <Icon component={ThLarge} {...props} />;
const MinPanel = (props) => { const MinPanel = props => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = getPrefixCls('panel-min'); const prefixCls = getPrefixCls('panel-min');
const getCategories = () => { const getCategories = () => {
let { data } = props; let { data } = props;
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
data = data.filter((item) => item.hasOwnProperty('extData')); data = data.filter(item => item.hasOwnProperty('extData'));
return data; return data;
}; };
...@@ -49,7 +49,7 @@ const MinPanel = (props) => { ...@@ -49,7 +49,7 @@ const MinPanel = (props) => {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
let _clickEvents = null; let _clickEvents = null;
const handleKeyDown = (event) => { const handleKeyDown = event => {
if (event.keyCode === KeyCode.ESC) { if (event.keyCode === KeyCode.ESC) {
const { onClose } = props; const { onClose } = props;
event.stopPropagation(); event.stopPropagation();
...@@ -63,7 +63,7 @@ const MinPanel = (props) => { ...@@ -63,7 +63,7 @@ const MinPanel = (props) => {
domRef.current.focus(); domRef.current.focus();
} }
}; };
const handleDocumentClick = (e) => { const handleDocumentClick = e => {
if (props.visible) { if (props.visible) {
const node = domRef && domRef.current; const node = domRef && domRef.current;
if ( if (
...@@ -93,7 +93,7 @@ const MinPanel = (props) => { ...@@ -93,7 +93,7 @@ const MinPanel = (props) => {
props.onSelect && props.onSelect(item); props.onSelect && props.onSelect(item);
}; };
const handleCategories = (index) => { const handleCategories = index => {
setCurrentMenu(props.data[index]); setCurrentMenu(props.data[index]);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
props.onChange && props.onChange(index); props.onChange && props.onChange(index);
...@@ -105,12 +105,12 @@ const MinPanel = (props) => { ...@@ -105,12 +105,12 @@ const MinPanel = (props) => {
addDocumentEvents(); addDocumentEvents();
return () => removeDocumentEvents(); return () => removeDocumentEvents();
}, [props.visible]); }, [addDocumentEvents, props.visible, removeDocumentEvents]);
return ( return (
<div <div
className={panelCls} className={panelCls}
tabIndex="-1" tabIndex="-1"
onKeyDown={(event) => (props.visible && props.keyboard ? handleKeyDown(event) : undefined)} onKeyDown={event => (props.visible && props.keyboard ? handleKeyDown(event) : undefined)}
ref={domRef} ref={domRef}
> >
<div className={`${prefixCls}-mainPane-main`}> <div className={`${prefixCls}-mainPane-main`}>
......
...@@ -12,7 +12,7 @@ import styles from './index.less'; ...@@ -12,7 +12,7 @@ import styles from './index.less';
import Menu from './Menu'; import Menu from './Menu';
// eslint-disable-next-line import/extensions // eslint-disable-next-line import/extensions
const ThLarge = (props) => ( const ThLarge = props => (
<svg viewBox="0 0 1024 1024" version="1.1" width="14" height="14"> <svg viewBox="0 0 1024 1024" version="1.1" width="14" height="14">
<path <path
d="M592 64h384c26.51 0 48 21.49 48 48v320c0 26.51-21.49 48-48 48H592c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48z m-160 0H48C21.49 64 0 85.49 0 112v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zM0 592v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H48c-26.51 0-48 21.49-48 48z m592 368h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H592c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48z" d="M592 64h384c26.51 0 48 21.49 48 48v320c0 26.51-21.49 48-48 48H592c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48z m-160 0H48C21.49 64 0 85.49 0 112v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zM0 592v320c0 26.51 21.49 48 48 48h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H48c-26.51 0-48 21.49-48 48z m592 368h384c26.51 0 48-21.49 48-48V592c0-26.51-21.49-48-48-48H592c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48z"
...@@ -21,9 +21,9 @@ const ThLarge = (props) => ( ...@@ -21,9 +21,9 @@ const ThLarge = (props) => (
</svg> </svg>
); );
const ThLargeIcon = (props) => <Icon component={ThLarge} {...props} />; const ThLargeIcon = props => <Icon component={ThLarge} {...props} />;
const Panel = (props) => { const Panel = props => {
const panelCls = classNames(styles.mainPane, props.visible ? styles.visible : styles.hidden); const panelCls = classNames(styles.mainPane, props.visible ? styles.visible : styles.hidden);
const domRef = useRef(); const domRef = useRef();
// eslint-disable-next-line no-debugger; // eslint-disable-next-line no-debugger;
...@@ -35,7 +35,7 @@ const Panel = (props) => { ...@@ -35,7 +35,7 @@ const Panel = (props) => {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
let _clickEvents = null; let _clickEvents = null;
const handleKeyDown = (event) => { const handleKeyDown = event => {
if (event.keyCode === KeyCode.ESC) { if (event.keyCode === KeyCode.ESC) {
const { onClose } = props; const { onClose } = props;
event.stopPropagation(); event.stopPropagation();
...@@ -49,7 +49,7 @@ const Panel = (props) => { ...@@ -49,7 +49,7 @@ const Panel = (props) => {
domRef.current.focus(); domRef.current.focus();
} }
}; };
const handleDocumentClick = (e) => { const handleDocumentClick = e => {
if (props.visible) { if (props.visible) {
const node = domRef && domRef.current; const node = domRef && domRef.current;
if ( if (
...@@ -77,11 +77,11 @@ const Panel = (props) => { ...@@ -77,11 +77,11 @@ const Panel = (props) => {
const getCategories = () => { const getCategories = () => {
let { data } = props; let { data } = props;
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
data = data.filter((item) => item.hasOwnProperty('extData')); data = data.filter(item => item.hasOwnProperty('extData'));
return data; return data;
}; };
const handleCategories = (index) => { const handleCategories = index => {
setCurrentMenu(props.data[index]); setCurrentMenu(props.data[index]);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
props.onChange && props.onChange(index); props.onChange && props.onChange(index);
...@@ -98,12 +98,12 @@ const Panel = (props) => { ...@@ -98,12 +98,12 @@ const Panel = (props) => {
addDocumentEvents(); addDocumentEvents();
return () => removeDocumentEvents(); return () => removeDocumentEvents();
}, [props.visible]); }, [addDocumentEvents, props.visible, removeDocumentEvents]);
return ( return (
<div <div
className={panelCls} className={panelCls}
tabIndex="-1" tabIndex="-1"
onKeyDown={(event) => (props.visible && props.keyboard ? handleKeyDown(event) : undefined)} onKeyDown={event => (props.visible && props.keyboard ? handleKeyDown(event) : undefined)}
ref={domRef} ref={domRef}
> >
<div className={styles.header}> <div className={styles.header}>
...@@ -122,11 +122,7 @@ const Panel = (props) => { ...@@ -122,11 +122,7 @@ const Panel = (props) => {
</div> </div>
<div className={styles.main}> <div className={styles.main}>
<div className={styles['main-left']}> <div className={styles['main-left']}>
<Categories <Categories data={getCategories()} onChange={handleCategories} currentMenuIndex={props.currentMenuIndex} />
data={getCategories()}
onChange={handleCategories}
currentMenuIndex={props.currentMenuIndex}
/>
</div> </div>
<div className={styles['main-menus']}> <div className={styles['main-menus']}>
<Spin spinning={!currentMenu}> <Spin spinning={!currentMenu}>
......
...@@ -9,10 +9,10 @@ import { connect } from 'react-redux'; ...@@ -9,10 +9,10 @@ import { connect } from 'react-redux';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import KeepAlive from 'react-activation'; import KeepAlive from 'react-activation';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import BasicLayout from './AppLayout/layouts/BasicLayout';
import RightContent from '@/components/GlobalHeader/ExtendRightContent'; import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'; import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import BasicLayout from './AppLayout/layouts/BasicLayout';
import { WEB_GIS_TYPE } from '../constants'; import { WEB_GIS_TYPE } from '../constants';
import SecurityLayout from './SecurityLayout'; import SecurityLayout from './SecurityLayout';
import Site from './Site'; import Site from './Site';
...@@ -47,7 +47,6 @@ const optionsWith = [{ label: '按站点', value: 'site' }, { label: '按城市' ...@@ -47,7 +47,6 @@ const optionsWith = [{ label: '按站点', value: 'site' }, { label: '按城市'
const HOT = ['HOT', '县', '市', 'New']; const HOT = ['HOT', '县', '市', 'New'];
const StationsItem = (item, action, onChangeVisible) => { const StationsItem = (item, action, onChangeVisible) => {
const changeGroup = (event, data) => { const changeGroup = (event, data) => {
debugger;
action.changeGroup && action.changeGroup(event, data, onChangeVisible); action.changeGroup && action.changeGroup(event, data, onChangeVisible);
}; };
return ( return (
...@@ -215,18 +214,16 @@ const Layout = props => { ...@@ -215,18 +214,16 @@ const Layout = props => {
setCityData(res); setCityData(res);
}); });
} }
}, [props.global]); }, [cityData, history, props, props.global, siteAction]);
const handlerPageChange = () => { const handlerPageChange = () => {
const params = getParamsV1(props.location.pathname); const params = getParamsV1(props.location.pathname);
if (params.hasOwnProperty('mapType') && params.mapType === WEB_GIS_TYPE.AMAP) { if (params.hasOwnProperty('mapType') && params.mapType === WEB_GIS_TYPE.AMAP) {
AMapLoader.reset(); AMapLoader.reset();
setMapMode(WEB_GIS_TYPE.AMAP); setMapMode(WEB_GIS_TYPE.AMAP);
} else { } else if (!/civweb4/.test(location.pathname)) {
if (!/civweb4/.test(location.pathname)) { AMapLoader.reset();
AMapLoader.reset(); setMapMode(WEB_GIS_TYPE.ARCGIS);
setMapMode(WEB_GIS_TYPE.ARCGIS);
}
} }
}; };
...@@ -305,7 +302,7 @@ const Layout = props => { ...@@ -305,7 +302,7 @@ const Layout = props => {
<BasicLayout <BasicLayout
route={props.route} route={props.route}
title={''} title=""
logo={require('@/assets/basic/HN-logo.png')} logo={require('@/assets/basic/HN-logo.png')}
config={props.global} config={props.global}
currentMenuIndex={props.currentMenuIndex} currentMenuIndex={props.currentMenuIndex}
......
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