From 0fa63b963ce217ef0ab1b861d49c82157709ff4b Mon Sep 17 00:00:00 2001
From: luoxin <1440155977@qq.com>
Date: Mon, 6 Dec 2021 15:08:03 +0800
Subject: [PATCH] init
---
config/defaultSettings.js | 2 +-
config/dynamicRoutes.js | 42 ++++
config/routes.js | 5 +
mock/route.js | 22 +-
mock/user.js | 210 -----------------
package.json | 2 +-
src/access.js | 2 +-
src/app.jsx | 51 ++--
src/components/HeaderSearch/index.jsx | 83 -------
src/components/HeaderSearch/index.less | 25 --
src/components/NoticeIcon/NoticeIcon.jsx | 114 ---------
src/components/NoticeIcon/NoticeList.jsx | 97 --------
src/components/NoticeIcon/NoticeList.less | 103 --------
src/components/NoticeIcon/index.jsx | 148 ------------
src/components/NoticeIcon/index.less | 35 ---
src/components/RightContent/index.jsx | 26 ---
src/components/index.md | 272 ----------------------
src/pages/Root.jsx | 9 +-
src/pages/demolition/page1/index.jsx | 2 +
src/pages/demolition/page2/index.jsx | 1 +
src/pages/eawcs/page1/index.jsx | 2 +-
src/pages/eawcs/page2/index.jsx | 1 +
src/util/func.js | 0
23 files changed, 89 insertions(+), 1165 deletions(-)
create mode 100644 config/dynamicRoutes.js
delete mode 100644 mock/user.js
delete mode 100644 src/components/HeaderSearch/index.jsx
delete mode 100644 src/components/HeaderSearch/index.less
delete mode 100644 src/components/NoticeIcon/NoticeIcon.jsx
delete mode 100644 src/components/NoticeIcon/NoticeList.jsx
delete mode 100644 src/components/NoticeIcon/NoticeList.less
delete mode 100644 src/components/NoticeIcon/index.jsx
delete mode 100644 src/components/NoticeIcon/index.less
delete mode 100644 src/components/index.md
create mode 100644 src/util/func.js
diff --git a/config/defaultSettings.js b/config/defaultSettings.js
index 80f08e3..0f005eb 100644
--- a/config/defaultSettings.js
+++ b/config/defaultSettings.js
@@ -4,7 +4,7 @@ const Settings = {
primaryColor: '#1890ff',
layout: 'mix',
contentWidth: 'Fluid',
- fixedHeader: false,
+ fixedHeader: true,
fixSiderbar: true,
colorWeak: false,
title: 'Ant Design Pro',
diff --git a/config/dynamicRoutes.js b/config/dynamicRoutes.js
new file mode 100644
index 0000000..1ad6ded
--- /dev/null
+++ b/config/dynamicRoutes.js
@@ -0,0 +1,42 @@
+export default [
+ {
+ path: '/eawcs',
+ layout: true,
+ exact: true,
+ routes: [
+ { path: '/eawcs', redirect: '/eawcs/des1' },
+ {
+ path: '/eawcs/des1',
+ name: '环水保菜单1',
+ component:'./eawcs/page1'
+ },
+ {
+ path: '/eawcs/des2',
+ name: '环水保菜单2',
+ component:'./eawcs/page2'
+ },
+ ]
+ },
+ {
+ path: '/demolition',
+ layout: true,
+ exact: true,
+ routes: [
+ { path: '/demolition', redirect: '/demolition/dem1' },
+ {
+ path: '/demolition/dem1',
+ name: '先签后建菜单1',
+ component:'./demolition/page1'
+ },
+ {
+ path: '/demolition/dem2',
+ name: '先签后建菜单2',
+ exact: true,
+ component:'./demolition/page2'
+ },
+ ]
+ },
+ {
+ component: './404',
+ },
+];
diff --git a/config/routes.js b/config/routes.js
index ea9dd32..68dcba0 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -1,3 +1,5 @@
+import dynamicRoutes from './dynamicRoutes'
+
export default [
{
path: '/user/login',
@@ -8,6 +10,9 @@ export default [
path: '/',
component: './Root',
layout: false,
+ routes:[
+ ...dynamicRoutes
+ ],
},
{
component: './404',
diff --git a/mock/route.js b/mock/route.js
index e7eade2..a9a4d1a 100644
--- a/mock/route.js
+++ b/mock/route.js
@@ -4,14 +4,12 @@ export default {
res.send({
data: [
{
- path: '/des1',
- name: '菜单1',
- component:'@/eawcs/page1'
+ path: '/eawcs/des1',
+ name: '环水保菜单1',
},
{
- path: '/des2',
- name: '菜单2',
- component:'@/eawcs/page2'
+ path: '/eawcs/des2',
+ name: '环水保菜单2',
}
],
success: true,
@@ -20,14 +18,14 @@ export default {
res.send({
data: [
{
- path: '/dem1',
- name: '菜单1',
- component:'@/demolition/page1'
+ path: '/demolition/dem1',
+ name: '先签后建菜单1',
+ exact: true,
},
{
- path: '/dem2',
- name: '菜单2',
- component:'@/demolition/page2'
+ path: '/demolition/dem2',
+ name: '先签后建菜单2',
+ exact: true,
}
],
success: true,
diff --git a/mock/user.js b/mock/user.js
deleted file mode 100644
index fa8c1b4..0000000
--- a/mock/user.js
+++ /dev/null
@@ -1,210 +0,0 @@
-const waitTime = (time = 100) => {
- return new Promise((resolve) => {
- setTimeout(() => {
- resolve(true);
- }, time);
- });
-};
-
-async function getFakeCaptcha(req, res) {
- await waitTime(2000);
- return res.json('captcha-xxx');
-}
-
-const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
-/**
- * 当前用户的权限,如果为空代表没登录
- * current user access, if is '', user need login
- * 如果是 pro 的预览,默认是有权限的
- */
-
-let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : '';
-
-const getAccess = () => {
- return access;
-}; // 代码中会兼容本地 service mock 以及部署站点的静态数据
-
-export default {
- // 支持值为 Object 和 Array
- 'GET /api/currentUser': (req, res) => {
- if (!getAccess()) {
- res.status(401).send({
- data: {
- isLogin: false,
- },
- errorCode: '401',
- errorMessage: '请先登录!',
- success: true,
- });
- return;
- }
-
- res.send({
- success: true,
- data: {
- name: 'Serati Ma',
- avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png',
- userid: '00000001',
- email: 'antdesign@alipay.com',
- signature: '海纳百川,有容乃大',
- title: '交互专家',
- group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
- tags: [
- {
- key: '0',
- label: '很有想法的',
- },
- {
- key: '1',
- label: '专注设计',
- },
- {
- key: '2',
- label: '辣~',
- },
- {
- key: '3',
- label: '大长腿',
- },
- {
- key: '4',
- label: '川妹子',
- },
- {
- key: '5',
- label: '海纳百川',
- },
- ],
- notifyCount: 12,
- unreadCount: 11,
- country: 'China',
- access: getAccess(),
- geographic: {
- province: {
- label: '浙江省',
- key: '330000',
- },
- city: {
- label: '杭州市',
- key: '330100',
- },
- },
- address: '西湖区工专路 77 号',
- phone: '0752-268888888',
- },
- });
- },
- // GET POST 可省略
- 'GET /api/users': [
- {
- key: '1',
- name: 'John Brown',
- age: 32,
- address: 'New York No. 1 Lake Park',
- },
- {
- key: '2',
- name: 'Jim Green',
- age: 42,
- address: 'London No. 1 Lake Park',
- },
- {
- key: '3',
- name: 'Joe Black',
- age: 32,
- address: 'Sidney No. 1 Lake Park',
- },
- ],
- 'POST /api/login/account': async (req, res) => {
- const { password, username, type } = req.body;
- await waitTime(2000);
-
- if (password === 'ant.design' && username === 'admin') {
- res.send({
- status: 'ok',
- type,
- currentAuthority: 'admin',
- });
- access = 'admin';
- return;
- }
-
- if (password === 'ant.design' && username === 'user') {
- res.send({
- status: 'ok',
- type,
- currentAuthority: 'user',
- });
- access = 'user';
- return;
- }
-
- if (type === 'mobile') {
- res.send({
- status: 'ok',
- type,
- currentAuthority: 'admin',
- });
- access = 'admin';
- return;
- }
-
- res.send({
- status: 'error',
- type,
- currentAuthority: 'guest',
- });
- access = 'guest';
- },
- 'POST /api/login/outLogin': (req, res) => {
- access = '';
- res.send({
- data: {},
- success: true,
- });
- },
- 'POST /api/register': (req, res) => {
- res.send({
- status: 'ok',
- currentAuthority: 'user',
- success: true,
- });
- },
- 'GET /api/500': (req, res) => {
- res.status(500).send({
- timestamp: 1513932555104,
- status: 500,
- error: 'error',
- message: 'error',
- path: '/base/category/list',
- });
- },
- 'GET /api/404': (req, res) => {
- res.status(404).send({
- timestamp: 1513932643431,
- status: 404,
- error: 'Not Found',
- message: 'No message available',
- path: '/base/category/list/2121212',
- });
- },
- 'GET /api/403': (req, res) => {
- res.status(403).send({
- timestamp: 1513932555104,
- status: 403,
- error: 'Forbidden',
- message: 'Forbidden',
- path: '/base/category/list',
- });
- },
- 'GET /api/401': (req, res) => {
- res.status(401).send({
- timestamp: 1513932555104,
- status: 401,
- error: 'Unauthorized',
- message: 'Unauthorized',
- path: '/base/category/list',
- });
- },
- 'GET /api/login/captcha': getFakeCaptcha,
-};
diff --git a/package.json b/package.json
index ad2b2d1..10497d4 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,7 @@
"react-dev-inspector": "^1.1.1",
"react-dom": "^17.0.0",
"react-helmet-async": "^1.0.4",
- "umi": "^3.5.0",
+ "umi": "^3.5.20",
"umi-serve": "^1.9.10"
},
"devDependencies": {
diff --git a/src/access.js b/src/access.js
index 8fa4337..372c618 100644
--- a/src/access.js
+++ b/src/access.js
@@ -4,6 +4,6 @@
export default function access(initialState) {
const { currentUser } = initialState || {};
return {
- canAdmin: currentUser && currentUser.access === 'admin',
+ canAdmin: {}
};
}
diff --git a/src/app.jsx b/src/app.jsx
index 806efaa..364c600 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -1,10 +1,11 @@
+import React from 'react';
import { PageLoading } from '@ant-design/pro-layout';
-import { history, Link } from 'umi';
+import { history } from 'umi';
import RightContent from '@/components/RightContent';
import Footer from '@/components/Footer';
-import { BookOutlined, LinkOutlined } from '@ant-design/icons';
-const isDev = process.env.NODE_ENV === 'development';
import { getMenus } from '@/services/client';
+
+const isDev = process.env.NODE_ENV === 'development';
const loginPath = '/user/login';
/** 获取用户信息比较慢的时候会展示一个 loading */
@@ -41,30 +42,27 @@ export const initialStateConfig = {
// };
// } // ProLayout 支持的api https://procomponents.ant.design/components/layout
-let extraRoutes;
-
-// extraRoutesexport function patchRoutes({ routes }) {
-//
-// }
-//
-export function render(oldRender) {
- const { location } = history
- if(location.pathname !== '/'){
- if(location.query.sys){
- getMenus(location.query.sys).then(res=>{
- console.log(res);
- })
- }
-
- }
- oldRender();
+export function patchRoutes({ routes }) {
+ console.log(routes);
}
+
export const layout = ({ initialState }) => {
return {
rightContentRender: () => ,
disableContentMargin: false,
footerRender: () => ,
+ menu: {
+ locale:false,
+ request: async (params, defaultMenuData) => {
+ const sys = sessionStorage.getItem('sys');
+ let menus = [];
+ if (sys && sys != '') {
+ menus = await getMenus(sys);
+ }
+ return menus.data;
+ },
+ },
onPageChange: () => {
const { location } = history; // 如果没有登录,重定向到 login
@@ -72,18 +70,7 @@ export const layout = ({ initialState }) => {
// history.push(loginPath);
// }
},
- links: isDev
- ? [
-
-
- OpenAPI 文档
- ,
-
-
- 业务组件文档
- ,
- ]
- : [],
+ links: [],
menuHeaderRender: undefined,
// 自定义 403 页面
// unAccessible:
unAccessible
,
diff --git a/src/components/HeaderSearch/index.jsx b/src/components/HeaderSearch/index.jsx
deleted file mode 100644
index eb596c7..0000000
--- a/src/components/HeaderSearch/index.jsx
+++ /dev/null
@@ -1,83 +0,0 @@
-import { SearchOutlined } from '@ant-design/icons';
-import { AutoComplete, Input } from 'antd';
-import useMergedState from 'rc-util/es/hooks/useMergedState';
-import React, { useRef } from 'react';
-import classNames from 'classnames';
-import styles from './index.less';
-
-const HeaderSearch = (props) => {
- const {
- className,
- defaultValue,
- onVisibleChange,
- placeholder,
- visible,
- defaultVisible,
- ...restProps
- } = props;
- const inputRef = useRef(null);
- const [value, setValue] = useMergedState(defaultValue, {
- value: props.value,
- onChange: props.onChange,
- });
- const [searchMode, setSearchMode] = useMergedState(defaultVisible ?? false, {
- value: props.visible,
- onChange: onVisibleChange,
- });
- const inputClass = classNames(styles.input, {
- [styles.show]: searchMode,
- });
- return (
- {
- setSearchMode(true);
-
- if (searchMode && inputRef.current) {
- inputRef.current.focus();
- }
- }}
- onTransitionEnd={({ propertyName }) => {
- if (propertyName === 'width' && !searchMode) {
- if (onVisibleChange) {
- onVisibleChange(searchMode);
- }
- }
- }}
- >
-
-
- {
- if (e.key === 'Enter') {
- if (restProps.onSearch) {
- restProps.onSearch(value);
- }
- }
- }}
- onBlur={() => {
- setSearchMode(false);
- }}
- />
-
-
- );
-};
-
-export default HeaderSearch;
diff --git a/src/components/HeaderSearch/index.less b/src/components/HeaderSearch/index.less
deleted file mode 100644
index 15060bd..0000000
--- a/src/components/HeaderSearch/index.less
+++ /dev/null
@@ -1,25 +0,0 @@
-@import '~antd/es/style/themes/default.less';
-
-.headerSearch {
- display: inline-flex;
- align-items: center;
- .input {
- width: 0;
- min-width: 0;
- overflow: hidden;
- background: transparent;
- border-radius: 0;
- transition: width 0.3s, margin-left 0.3s;
- :global(.ant-select-selection) {
- background: transparent;
- }
- input {
- box-shadow: none !important;
- }
-
- &.show {
- width: 210px;
- margin-left: 8px;
- }
- }
-}
diff --git a/src/components/NoticeIcon/NoticeIcon.jsx b/src/components/NoticeIcon/NoticeIcon.jsx
deleted file mode 100644
index e20fad9..0000000
--- a/src/components/NoticeIcon/NoticeIcon.jsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import { BellOutlined } from '@ant-design/icons';
-import { Badge, Spin, Tabs } from 'antd';
-import useMergedState from 'rc-util/es/hooks/useMergedState';
-import React from 'react';
-import classNames from 'classnames';
-import NoticeList from './NoticeList';
-import HeaderDropdown from '../HeaderDropdown';
-import styles from './index.less';
-const { TabPane } = Tabs;
-
-const NoticeIcon = (props) => {
- const getNotificationBox = () => {
- const {
- children,
- loading,
- onClear,
- onTabChange,
- onItemClick,
- onViewMore,
- clearText,
- viewMoreText,
- } = props;
-
- if (!children) {
- return null;
- }
-
- const panes = [];
- React.Children.forEach(children, (child) => {
- if (!child) {
- return;
- }
-
- const { list, title, count, tabKey, showClear, showViewMore } = child.props;
- const len = list && list.length ? list.length : 0;
- const msgCount = count || count === 0 ? count : len;
- const tabTitle = msgCount > 0 ? `${title} (${msgCount})` : title;
- panes.push(
-
- onClear && onClear(title, tabKey)}
- onClick={(item) => onItemClick && onItemClick(item, child.props)}
- onViewMore={(event) => onViewMore && onViewMore(child.props, event)}
- showClear={showClear}
- showViewMore={showViewMore}
- title={title}
- />
- ,
- );
- });
- return (
- <>
-
-
- {panes}
-
-
- >
- );
- };
-
- const { className, count, bell } = props;
- const [visible, setVisible] = useMergedState(false, {
- value: props.popupVisible,
- onChange: props.onPopupVisibleChange,
- });
- const noticeButtonClass = classNames(className, styles.noticeButton);
- const notificationBox = getNotificationBox();
- const NoticeBellIcon = bell || ;
- const trigger = (
-
-
- {NoticeBellIcon}
-
-
- );
-
- if (!notificationBox) {
- return trigger;
- }
-
- return (
-
- {trigger}
-
- );
-};
-
-NoticeIcon.defaultProps = {
- emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg',
-};
-NoticeIcon.Tab = NoticeList;
-export default NoticeIcon;
diff --git a/src/components/NoticeIcon/NoticeList.jsx b/src/components/NoticeIcon/NoticeList.jsx
deleted file mode 100644
index cc645c5..0000000
--- a/src/components/NoticeIcon/NoticeList.jsx
+++ /dev/null
@@ -1,97 +0,0 @@
-import { Avatar, List } from 'antd';
-import React from 'react';
-import classNames from 'classnames';
-import styles from './NoticeList.less';
-
-const NoticeList = ({
- list = [],
- onClick,
- onClear,
- title,
- onViewMore,
- emptyText,
- showClear = true,
- clearText,
- viewMoreText,
- showViewMore = false,
-}) => {
- if (!list || list.length === 0) {
- return (
-
-

-
{emptyText}
-
- );
- }
-
- return (
-
-
{
- const itemCls = classNames(styles.item, {
- [styles.read]: item.read,
- }); // eslint-disable-next-line no-nested-ternary
-
- const leftIcon = item.avatar ? (
- typeof item.avatar === 'string' ? (
-
- ) : (
- {item.avatar}
- )
- ) : null;
- return (
- {
- onClick?.(item);
- }}
- >
-
- {item.title}
- {item.extra}
-
- }
- description={
-
-
{item.description}
-
{item.datetime}
-
- }
- />
-
- );
- }}
- />
-
- {showClear ? (
-
- {clearText} {title}
-
- ) : null}
- {showViewMore ? (
-
{
- if (onViewMore) {
- onViewMore(e);
- }
- }}
- >
- {viewMoreText}
-
- ) : null}
-
-
- );
-};
-
-export default NoticeList;
diff --git a/src/components/NoticeIcon/NoticeList.less b/src/components/NoticeIcon/NoticeList.less
deleted file mode 100644
index 65e0c40..0000000
--- a/src/components/NoticeIcon/NoticeList.less
+++ /dev/null
@@ -1,103 +0,0 @@
-@import '~antd/es/style/themes/default.less';
-
-.list {
- max-height: 400px;
- overflow: auto;
- &::-webkit-scrollbar {
- display: none;
- }
- .item {
- padding-right: 24px;
- padding-left: 24px;
- overflow: hidden;
- cursor: pointer;
- transition: all 0.3s;
-
- .meta {
- width: 100%;
- }
-
- .avatar {
- margin-top: 4px;
- background: @component-background;
- }
- .iconElement {
- font-size: 32px;
- }
-
- &.read {
- opacity: 0.4;
- }
- &:last-child {
- border-bottom: 0;
- }
- &:hover {
- background: @primary-1;
- }
- .title {
- margin-bottom: 8px;
- font-weight: normal;
- }
- .description {
- font-size: 12px;
- line-height: @line-height-base;
- }
- .datetime {
- margin-top: 4px;
- font-size: 12px;
- line-height: @line-height-base;
- }
- .extra {
- float: right;
- margin-top: -1.5px;
- margin-right: 0;
- color: @text-color-secondary;
- font-weight: normal;
- }
- }
- .loadMore {
- padding: 8px 0;
- color: @primary-6;
- text-align: center;
- cursor: pointer;
- &.loadedAll {
- color: rgba(0, 0, 0, 0.25);
- cursor: unset;
- }
- }
-}
-
-.notFound {
- padding: 73px 0 88px;
- color: @text-color-secondary;
- text-align: center;
- img {
- display: inline-block;
- height: 76px;
- margin-bottom: 16px;
- }
-}
-
-.bottomBar {
- height: 46px;
- color: @text-color;
- line-height: 46px;
- text-align: center;
- border-top: 1px solid @border-color-split;
- border-radius: 0 0 @border-radius-base @border-radius-base;
- transition: all 0.3s;
- div {
- display: inline-block;
- width: 50%;
- cursor: pointer;
- transition: all 0.3s;
- user-select: none;
-
- &:only-child {
- width: 100%;
- }
- &:not(:only-child):last-child {
- border-left: 1px solid @border-color-split;
- }
- }
-}
diff --git a/src/components/NoticeIcon/index.jsx b/src/components/NoticeIcon/index.jsx
deleted file mode 100644
index 9491362..0000000
--- a/src/components/NoticeIcon/index.jsx
+++ /dev/null
@@ -1,148 +0,0 @@
-import { useEffect, useState } from 'react';
-import { Tag, message } from 'antd';
-import { groupBy } from 'lodash';
-import moment from 'moment';
-import { useModel, useRequest } from 'umi';
-import { getNotices } from '@/services/ant-design-pro/api';
-import NoticeIcon from './NoticeIcon';
-import styles from './index.less';
-
-const getNoticeData = (notices) => {
- if (!notices || notices.length === 0 || !Array.isArray(notices)) {
- return {};
- }
-
- const newNotices = notices.map((notice) => {
- const newNotice = { ...notice };
-
- if (newNotice.datetime) {
- newNotice.datetime = moment(notice.datetime).fromNow();
- }
-
- if (newNotice.id) {
- newNotice.key = newNotice.id;
- }
-
- if (newNotice.extra && newNotice.status) {
- const color = {
- todo: '',
- processing: 'blue',
- urgent: 'red',
- doing: 'gold',
- }[newNotice.status];
- newNotice.extra = (
-
- {newNotice.extra}
-
- );
- }
-
- return newNotice;
- });
- return groupBy(newNotices, 'type');
-};
-
-const getUnreadData = (noticeData) => {
- const unreadMsg = {};
- Object.keys(noticeData).forEach((key) => {
- const value = noticeData[key];
-
- if (!unreadMsg[key]) {
- unreadMsg[key] = 0;
- }
-
- if (Array.isArray(value)) {
- unreadMsg[key] = value.filter((item) => !item.read).length;
- }
- });
- return unreadMsg;
-};
-
-const NoticeIconView = () => {
- const { initialState } = useModel('@@initialState');
- const { currentUser } = initialState || {};
- const [notices, setNotices] = useState([]);
- const { data } = useRequest(getNotices);
- useEffect(() => {
- setNotices(data || []);
- }, [data]);
- const noticeData = getNoticeData(notices);
- const unreadMsg = getUnreadData(noticeData || {});
-
- const changeReadState = (id) => {
- setNotices(
- notices.map((item) => {
- const notice = { ...item };
-
- if (notice.id === id) {
- notice.read = true;
- }
-
- return notice;
- }),
- );
- };
-
- const clearReadState = (title, key) => {
- setNotices(
- notices.map((item) => {
- const notice = { ...item };
-
- if (notice.type === key) {
- notice.read = true;
- }
-
- return notice;
- }),
- );
- message.success(`${'清空了'} ${title}`);
- };
-
- return (
- {
- changeReadState(item.id);
- }}
- onClear={(title, key) => clearReadState(title, key)}
- loading={false}
- clearText="清空"
- viewMoreText="查看更多"
- onViewMore={() => message.info('Click on view more')}
- clearClose
- >
-
-
-
-
- );
-};
-
-export default NoticeIconView;
diff --git a/src/components/NoticeIcon/index.less b/src/components/NoticeIcon/index.less
deleted file mode 100644
index 45251cd..0000000
--- a/src/components/NoticeIcon/index.less
+++ /dev/null
@@ -1,35 +0,0 @@
-@import '~antd/es/style/themes/default.less';
-
-.popover {
- position: relative;
- width: 336px;
-}
-
-.noticeButton {
- display: inline-block;
- cursor: pointer;
- transition: all 0.3s;
-}
-.icon {
- padding: 4px;
- vertical-align: middle;
-}
-
-.badge {
- font-size: 16px;
-}
-
-.tabs {
- :global {
- .ant-tabs-nav-list {
- margin: auto;
- }
-
- .ant-tabs-nav-scroll {
- text-align: center;
- }
- .ant-tabs-bar {
- margin-bottom: 0;
- }
- }
-}
diff --git a/src/components/RightContent/index.jsx b/src/components/RightContent/index.jsx
index 4660693..9432f39 100644
--- a/src/components/RightContent/index.jsx
+++ b/src/components/RightContent/index.jsx
@@ -3,7 +3,6 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
import React from 'react';
import { useModel, SelectLang } from 'umi';
import Avatar from './AvatarDropdown';
-import HeaderSearch from '../HeaderSearch';
import styles from './index.less';
const GlobalHeaderRight = () => {
@@ -22,31 +21,6 @@ const GlobalHeaderRight = () => {
return (
- umi ui,
- value: 'umi ui',
- },
- {
- label: Ant Design,
- value: 'Ant Design',
- },
- {
- label: Pro Table,
- value: 'Pro Table',
- },
- {
- label: Pro Layout,
- value: 'Pro Layout',
- },
- ]} // onSearch={value => {
- // console.log('input', value);
- // }}
- />
{
diff --git a/src/components/index.md b/src/components/index.md
deleted file mode 100644
index 408da93..0000000
--- a/src/components/index.md
+++ /dev/null
@@ -1,272 +0,0 @@
----
-title: 业务组件
-sidemenu: false
----
-
-> 此功能由[dumi](https://d.umijs.org/zh-CN/guide/advanced#umi-%E9%A1%B9%E7%9B%AE%E9%9B%86%E6%88%90%E6%A8%A1%E5%BC%8F)提供,dumi 是一个 📖 为组件开发场景而生的文档工具,用过的都说好。
-
-# 业务组件
-
-这里列举了 Pro 中所有用到的组件,这些组件不适合作为组件库,但是在业务中却真实需要。所以我们准备了这个文档,来指导大家是否需要使用这个组件。
-
-## Footer 页脚组件
-
-这个组件自带了一些 Pro 的配置,你一般都需要改掉它的信息。
-
-```tsx
-/**
- * background: '#f0f2f5'
- */
-import React from 'react';
-import Footer from '@/components/Footer';
-
-export default () => ;
-```
-
-## HeaderDropdown 头部下拉列表
-
-HeaderDropdown 是 antd Dropdown 的封装,但是增加了移动端的特殊处理,用法也是相同的。
-
-```tsx
-/**
- * background: '#f0f2f5'
- */
-import { Button, Menu } from 'antd';
-import React from 'react';
-import HeaderDropdown from '@/components/HeaderDropdown';
-
-export default () => {
- const menuHeaderDropdown = (
-
- );
- return (
-
-
-
- );
-};
-```
-
-## HeaderSearch 头部搜索框
-
-一个带补全数据的输入框,支持收起和展开 Input
-
-```tsx
-/**
- * background: '#f0f2f5'
- */
-import { Button, Menu } from 'antd';
-import React from 'react';
-import HeaderSearch from '@/components/HeaderSearch';
-
-export default () => {
- return (
- {
- console.log('input', value);
- }}
- />
- );
-};
-```
-
-### API
-
-| 参数 | 说明 | 类型 | 默认值 |
-| --------------- | ---------------------------------- | ---------------------------- | ------ |
-| value | 输入框的值 | `string` | - |
-| onChange | 值修改后触发 | `(value?: string) => void` | - |
-| onSearch | 查询后触发 | `(value?: string) => void` | - |
-| options | 选项菜单的的列表 | `{label,value}[]` | - |
-| defaultVisible | 输入框默认是否显示,只有第一次生效 | `boolean` | - |
-| visible | 输入框是否显示 | `boolean` | - |
-| onVisibleChange | 输入框显示隐藏的回调函数 | `(visible: boolean) => void` | - |
-
-## NoticeIcon 通知工具
-
-通知工具提供一个展示多种通知信息的界面。
-
-```tsx
-/**
- * background: '#f0f2f5'
- */
-import { message } from 'antd';
-import React from 'react';
-import NoticeIcon from '@/components/NoticeIcon/NoticeIcon';
-
-export default () => {
- const list = [
- {
- id: '000000001',
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png',
- title: '你收到了 14 份新周报',
- datetime: '2017-08-09',
- type: 'notification',
- },
- {
- id: '000000002',
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png',
- title: '你推荐的 曲妮妮 已通过第三轮面试',
- datetime: '2017-08-08',
- type: 'notification',
- },
- ];
- return (
- {
- message.info(`${item.title} 被点击了`);
- }}
- onClear={(title: string, key: string) => message.info('点击了清空更多')}
- loading={false}
- clearText="清空"
- viewMoreText="查看更多"
- onViewMore={() => message.info('点击了查看更多')}
- clearClose
- >
-
-
-
-
- );
-};
-```
-
-### NoticeIcon API
-
-| 参数 | 说明 | 类型 | 默认值 |
-| --- | --- | --- | --- |
-| count | 有多少未读通知 | `number` | - |
-| bell | 铃铛的图表 | `ReactNode` | - |
-| onClear | 点击清空数据按钮 | `(tabName: string, tabKey: string) => void` | - |
-| onItemClick | 未读消息列被点击 | `(item: API.NoticeIconData, tabProps: NoticeIconTabProps) => void` | - |
-| onViewMore | 查看更多的按钮点击 | `(tabProps: NoticeIconTabProps, e: MouseEvent) => void` | - |
-| onTabChange | 通知 Tab 的切换 | `(tabTile: string) => void;` | - |
-| popupVisible | 通知显示是否展示 | `boolean` | - |
-| onPopupVisibleChange | 通知信息显示隐藏的回调函数 | `(visible: boolean) => void` | - |
-| clearText | 清空按钮的文字 | `string` | - |
-| viewMoreText | 查看更多的按钮文字 | `string` | - |
-| clearClose | 展示清空按钮 | `boolean` | - |
-| emptyImage | 列表为空时的兜底展示 | `ReactNode` | - |
-
-### NoticeIcon.Tab API
-
-| 参数 | 说明 | 类型 | 默认值 |
-| ------------ | ------------------ | ------------------------------------ | ------ |
-| count | 有多少未读通知 | `number` | - |
-| title | 通知 Tab 的标题 | `ReactNode` | - |
-| showClear | 展示清除按钮 | `boolean` | `true` |
-| showViewMore | 展示加载更 | `boolean` | `true` |
-| tabKey | Tab 的唯一 key | `string` | - |
-| onClick | 子项的单击事件 | `(item: API.NoticeIconData) => void` | - |
-| onClear | 清楚按钮的点击 | `()=>void` | - |
-| emptyText | 为空的时候测试 | `()=>void` | - |
-| viewMoreText | 查看更多的按钮文字 | `string` | - |
-| onViewMore | 查看更多的按钮点击 | `( e: MouseEvent) => void` | - |
-| list | 通知信息的列表 | `API.NoticeIconData` | - |
-
-### NoticeIconData
-
-```tsx | pure
-export interface NoticeIconData {
- id: string;
- key: string;
- avatar: string;
- title: string;
- datetime: string;
- type: string;
- read?: boolean;
- description: string;
- clickClose?: boolean;
- extra: any;
- status: string;
-}
-```
-
-## RightContent
-
-RightContent 是以上几个组件的组合,同时新增了 plugins 的 `SelectLang` 插件。
-
-```tsx | pure
-
- umi ui, value: 'umi ui' },
- {
- label: Ant Design,
- value: 'Ant Design',
- },
- {
- label: Pro Table,
- value: 'Pro Table',
- },
- {
- label: Pro Layout,
- value: 'Pro Layout',
- },
- ]}
- />
-
- {
- window.location.href = 'https://pro.ant.design/docs/getting-started';
- }}
- >
-
-
-
-
- {REACT_APP_ENV && (
-
- {REACT_APP_ENV}
-
- )}
-
-
-```
diff --git a/src/pages/Root.jsx b/src/pages/Root.jsx
index 54816fe..5a4ba7a 100644
--- a/src/pages/Root.jsx
+++ b/src/pages/Root.jsx
@@ -1,9 +1,9 @@
import React, { useEffect, useState } from 'react';
-import { Avatar, Typography, Space } from 'antd';
+import { Avatar, Typography } from 'antd';
import { useRequest } from 'ahooks';
import { history } from 'umi';
import { getClient, getMenus } from '@/services/client';
-import './index.less'
+import './index.less';
const { Text } = Typography;
const Root = () => {
@@ -18,8 +18,9 @@ const Root = () => {
},[])
const handleClick = async (key) => {
- const data= await secon.run(key);
- history.push(`${ data.data.shift().path }?sys=${ key }`);
+ const data = await secon.run(key);
+ sessionStorage.setItem('sys', key);
+ history.push(`${ data.data.shift().path }`);
}
return (
diff --git a/src/pages/demolition/page1/index.jsx b/src/pages/demolition/page1/index.jsx
index d7cd174..dbac7fb 100644
--- a/src/pages/demolition/page1/index.jsx
+++ b/src/pages/demolition/page1/index.jsx
@@ -4,3 +4,5 @@ import React from 'react'
const Page1 = () => {
return
page1
}
+
+export default Page1
diff --git a/src/pages/demolition/page2/index.jsx b/src/pages/demolition/page2/index.jsx
index c8c814a..db68d97 100644
--- a/src/pages/demolition/page2/index.jsx
+++ b/src/pages/demolition/page2/index.jsx
@@ -3,3 +3,4 @@ import React from 'react'
const Page2 = () => {
return
page2
}
+export default Page2
diff --git a/src/pages/eawcs/page1/index.jsx b/src/pages/eawcs/page1/index.jsx
index d7cd174..97ff71b 100644
--- a/src/pages/eawcs/page1/index.jsx
+++ b/src/pages/eawcs/page1/index.jsx
@@ -1,6 +1,6 @@
-
import React from 'react'
const Page1 = () => {
return
page1
}
+export default Page1
diff --git a/src/pages/eawcs/page2/index.jsx b/src/pages/eawcs/page2/index.jsx
index c8c814a..db68d97 100644
--- a/src/pages/eawcs/page2/index.jsx
+++ b/src/pages/eawcs/page2/index.jsx
@@ -3,3 +3,4 @@ import React from 'react'
const Page2 = () => {
return
page2
}
+export default Page2
diff --git a/src/util/func.js b/src/util/func.js
new file mode 100644
index 0000000..e69de29