diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js
index da9321e4072cdd2bf2afe1bd4384d37e710f5253..20096fce3d70ffe15b72f8fd7a1270eb3e38d0d9 100644
--- a/.roadhogrc.mock.js
+++ b/.roadhogrc.mock.js
@@ -2,7 +2,6 @@ import mockjs from 'mockjs';
import { getRule, postRule } from './mock/rule';
import { getActivities, getNotice, getFakeList, postFakeList } from './mock/api';
import { getFakeChartData } from './mock/chart';
-import { imgMap } from './mock/utils';
import { getProfileBasicData } from './mock/profile';
import { getProfileAdvancedData } from './mock/profile';
import { getNotices } from './mock/notices';
diff --git a/mock/api.js b/mock/api.js
index 26141d942a39b0b8cba97e22cf6dbaf3d54009f4..e639bc6e4955ab3396d06eb8203b4964912642b5 100644
--- a/mock/api.js
+++ b/mock/api.js
@@ -1,4 +1,4 @@
-import { getUrlParams } from './utils';
+import { parse } from 'url';
const titles = [
'Alipay',
@@ -115,7 +115,7 @@ export function getFakeList(req, res, u) {
url = req.url; // eslint-disable-line
}
- const params = getUrlParams(url);
+ const params = parse(url, true).query;
const count = (params.count * 1) || 20;
diff --git a/mock/rule.js b/mock/rule.js
index fea91ca11357b64799ed5c845dc307058b324816..8a7332985178a3d3427cf61529352a06b1629b25 100644
--- a/mock/rule.js
+++ b/mock/rule.js
@@ -1,4 +1,4 @@
-import { getUrlParams } from './utils';
+import { parse } from 'url';
// mock tableListDataSource
let tableListDataSource = [];
@@ -26,7 +26,7 @@ export function getRule(req, res, u) {
url = req.url; // eslint-disable-line
}
- const params = getUrlParams(url);
+ const params = parse(url, true).query;
let dataSource = [...tableListDataSource];
diff --git a/mock/utils.js b/mock/utils.js
deleted file mode 100644
index 8438a2658df6a3dd105de7961080c1c58ffaedc0..0000000000000000000000000000000000000000
--- a/mock/utils.js
+++ /dev/null
@@ -1,45 +0,0 @@
-export const imgMap = {
- user: 'https://gw.alipayobjects.com/zos/rmsportal/UjusLxePxWGkttaqqmUI.png',
- a: 'https://gw.alipayobjects.com/zos/rmsportal/ZrkcSjizAKNWwJTwcadT.png',
- b: 'https://gw.alipayobjects.com/zos/rmsportal/KYlwHMeomKQbhJDRUVvt.png',
- c: 'https://gw.alipayobjects.com/zos/rmsportal/gabvleTstEvzkbQRfjxu.png',
- d: 'https://gw.alipayobjects.com/zos/rmsportal/jvpNzacxUYLlNsHTtrAD.png',
-};
-
-// refers: https://www.sitepoint.com/get-url-parameters-with-javascript/
-export function getUrlParams(url) {
- const d = decodeURIComponent;
- let queryString = url ? url.split('?')[1] : window.location.search.slice(1);
- const obj = {};
- if (queryString) {
- queryString = queryString.split('#')[0]; // eslint-disable-line
- const arr = queryString.split('&');
- for (let i = 0; i < arr.length; i += 1) {
- const a = arr[i].split('=');
- let paramNum;
- const paramName = a[0].replace(/\[\d*\]/, (v) => {
- paramNum = v.slice(1, -1);
- return '';
- });
- const paramValue = typeof (a[1]) === 'undefined' ? true : a[1];
- if (obj[paramName]) {
- if (typeof obj[paramName] === 'string') {
- obj[paramName] = d([obj[paramName]]);
- }
- if (typeof paramNum === 'undefined') {
- obj[paramName].push(d(paramValue));
- } else {
- obj[paramName][paramNum] = d(paramValue);
- }
- } else {
- obj[paramName] = d(paramValue);
- }
- }
- }
- return obj;
-}
-
-export default {
- getUrlParams,
- imgMap,
-};
diff --git a/src/common/menu.js b/src/common/menu.js
index 75f47dcf891756525a3343e55ecbea409cb22b14..21b58d7ae9ffe8b77e3b53d58e9db6eb56322918 100644
--- a/src/common/menu.js
+++ b/src/common/menu.js
@@ -113,11 +113,6 @@ const menuData = [{
name: '注册结果',
path: 'register-result',
}],
-}, {
- name: '使用文档',
- icon: 'book',
- path: 'http://pro.ant.design/docs/getting-started',
- target: '_blank',
}];
function formatter(data, parentPath = '', parentAuthority) {
diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js
index 03aaa700d81310a30178e6b4a5563ba2019dd84a..b7f7caf30812a2a49ee4097af94e682153b95f81 100644
--- a/src/components/Charts/Radar/index.js
+++ b/src/components/Charts/Radar/index.js
@@ -60,7 +60,9 @@ export default class Radar extends Component {
const { legendData } = this.state;
legendData[i] = newItem;
- const filteredLegendData = legendData.filter(l => l.checked).map(l => l.name);
+ const filteredLegendData = legendData
+ .filter(l => l.checked)
+ .map(l => l.name);
if (this.chart) {
this.chart.filter('name', val => filteredLegendData.indexOf(val) > -1);
@@ -109,71 +111,76 @@ export default class Radar extends Component {
return (
-
- {title &&
{title}
}
-
-
-
-
-
-
-
-
- {hasLegend && (
-
- {legendData.map((item, i) => (
- this.handleLegendClick(item, i)}
- >
-
-
-
- {item.name}
-
-
{item.value}
-
-
- ))}
-
- )}
-
+ {title &&
{title}
}
+
+
+
+
+
+
+
+
+ {hasLegend && (
+
+ {legendData.map((item, i) => (
+ this.handleLegendClick(item, i)}
+ >
+
+
+
+ {item.name}
+
+
{item.value}
+
+
+ ))}
+
+ )}
);
}
diff --git a/src/components/Ellipsis/index.d.ts b/src/components/Ellipsis/index.d.ts
index 8421b95116277f926b3b49b75a577388c4faafab..4f84c7ae00b8597d614102692e396a08a28529b9 100644
--- a/src/components/Ellipsis/index.d.ts
+++ b/src/components/Ellipsis/index.d.ts
@@ -1,12 +1,10 @@
-import * as React from "react";
+import * as React from 'react';
export interface EllipsisProps {
tooltip?: boolean;
length?: number;
lines?: number;
style?: React.CSSProperties;
+ className?: string;
}
-export default class Ellipsis extends React.Component<
- EllipsisProps,
- any
-> {}
+export default class Ellipsis extends React.Component {}
diff --git a/src/components/FooterToolbar/demo/basic.md b/src/components/FooterToolbar/demo/basic.md
index 6ce15e7c81fd431246a57de8a0799689b4b22191..1f6786348fc060473af61468682986ae1f3f5be4 100644
--- a/src/components/FooterToolbar/demo/basic.md
+++ b/src/components/FooterToolbar/demo/basic.md
@@ -1,36 +1,44 @@
---
order: 0
-title: 演示
+title:
+ - zh-CN: 演示
+ - en-US: demo
iframe: 400
---
+## zh-CN
+
浮动固定页脚。
+## en-US
+
+Fixed to the footer.
+
````jsx
import FooterToolbar from 'ant-design-pro/lib/FooterToolbar';
import { Button } from 'antd';
ReactDOM.render(
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
页面内容 页面内容 页面内容 页面内容
-
-
-
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+ Content Content Content Content
+
+
+
, mountNode);
-````
+````
\ No newline at end of file
diff --git a/src/components/FooterToolbar/index.en-US.md b/src/components/FooterToolbar/index.en-US.md
new file mode 100644
index 0000000000000000000000000000000000000000..69fd80bda80723c118f8fa1abdbc53372303305c
--- /dev/null
+++ b/src/components/FooterToolbar/index.en-US.md
@@ -0,0 +1,18 @@
+---
+title: FooterToolbar
+cols: 1
+order: 6
+---
+
+A toolbar fixed at the bottom.
+
+## Usage
+
+It is fixed at the bottom of the content area and does not move along with the scroll bar, which is usually used for data collection and submission for long pages.
+
+## API
+
+Property | Description | Type | Default
+---------|-------------|------|--------
+children | toolbar content, align to the right | ReactNode | -
+extra | extra information, align to the left | ReactNode | -
\ No newline at end of file
diff --git a/src/components/FooterToolbar/index.md b/src/components/FooterToolbar/index.zh-CN.md
similarity index 88%
rename from src/components/FooterToolbar/index.md
rename to src/components/FooterToolbar/index.zh-CN.md
index b0bea3d92a0ff6f11d7dec569add6c05aeb75299..421ac08e70782ec3fb19eb6b96dc8e6d58fd51be 100644
--- a/src/components/FooterToolbar/index.md
+++ b/src/components/FooterToolbar/index.zh-CN.md
@@ -1,7 +1,5 @@
---
-title:
- en-US: FooterToolbar
- zh-CN: FooterToolbar
+title: FooterToolbar
subtitle: 底部工具栏
cols: 1
order: 6
diff --git a/src/components/GlobalHeader/index.js b/src/components/GlobalHeader/index.js
index 1c4a567d934cc3ce04f943b343db9b8d22733c5e..a1a5614b325aa39f75c0f4e9d56bd7808491fce5 100644
--- a/src/components/GlobalHeader/index.js
+++ b/src/components/GlobalHeader/index.js
@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
-import { Menu, Icon, Spin, Tag, Dropdown, Avatar, Divider } from 'antd';
+import { Menu, Icon, Spin, Tag, Dropdown, Avatar, Divider, Tooltip } from 'antd';
import moment from 'moment';
import groupBy from 'lodash/groupBy';
import Debounce from 'lodash-decorators/debounce';
@@ -94,6 +94,16 @@ export default class GlobalHeader extends PureComponent {
console.log('enter', value); // eslint-disable-line
}}
/>
+
+
+
+
+
i {
font-size: 16px;
vertical-align: middle;
+ color: @text-color;
}
&:hover,
&:global(.ant-popover-open) {
diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js
index 7eb6de182c519e97501371d88e277e1e73fcd91c..df5148749dad22b35ebb0bd9122429e96ef5e813 100644
--- a/src/components/PageHeader/index.js
+++ b/src/components/PageHeader/index.js
@@ -7,8 +7,7 @@ import styles from './index.less';
const { TabPane } = Tabs;
-
-function getBreadcrumb(breadcrumbNameMap, url) {
+export function getBreadcrumb(breadcrumbNameMap, url) {
let breadcrumb = breadcrumbNameMap[url];
if (!breadcrumb) {
Object.keys(breadcrumbNameMap).forEach((item) => {
@@ -20,6 +19,14 @@ function getBreadcrumb(breadcrumbNameMap, url) {
return breadcrumb || {};
}
+// /userinfo/2144/id => ['/userinfo','/useinfo/2144,'/userindo/2144/id']
+export function urlToList(url) {
+ const urllist = url.split('/').filter(i => i);
+ return urllist.map((urlItem, index) => {
+ return `/${urllist.slice(0, index + 1).join('/')}`;
+ });
+}
+
export default class PageHeader extends PureComponent {
static contextTypes = {
routes: PropTypes.array,
@@ -62,11 +69,10 @@ export default class PageHeader extends PureComponent {
}
conversionFromLocation = (routerLocation, breadcrumbNameMap) => {
const { breadcrumbSeparator, linkElement = 'a' } = this.props;
- // Convert the path to an array
- const pathSnippets = routerLocation.pathname.split('/').filter(i => i);
+ // Convert the url to an array
+ const pathSnippets = urlToList(routerLocation.pathname);
// Loop data mosaic routing
- const extraBreadcrumbItems = pathSnippets.map((_, index) => {
- const url = `/${pathSnippets.slice(0, index + 1).join('/')}`;
+ const extraBreadcrumbItems = pathSnippets.map((url, index) => {
const currentBreadcrumb = getBreadcrumb(breadcrumbNameMap, url);
const isLinkable = (index !== pathSnippets.length - 1) && currentBreadcrumb.component;
return currentBreadcrumb.name && !currentBreadcrumb.hideInBreadcrumb ? (
diff --git a/src/components/PageHeader/index.test.js b/src/components/PageHeader/index.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..385a3d31da4910474fd67b83a2c607b57b8c6dfc
--- /dev/null
+++ b/src/components/PageHeader/index.test.js
@@ -0,0 +1,71 @@
+import { getBreadcrumb, urlToList } from './index';
+
+describe('test urlToList', () => {
+ it('A path', () => {
+ expect(urlToList('/userinfo')).toEqual(['/userinfo']);
+ });
+ it('Secondary path', () => {
+ expect(urlToList('/userinfo/2144')).toEqual([
+ '/userinfo',
+ '/userinfo/2144',
+ ]);
+ });
+ it('Three paths', () => {
+ expect(urlToList('/userinfo/2144/addr')).toEqual([
+ '/userinfo',
+ '/userinfo/2144',
+ '/userinfo/2144/addr',
+ ]);
+ });
+});
+
+const routerData = {
+ '/dashboard/analysis': {
+ name: '分析页',
+ },
+ '/userinfo': {
+ name: '用户列表',
+ },
+ '/userinfo/:id': {
+ name: '用户信息',
+ },
+ '/userinfo/:id/addr': {
+ name: '收货订单',
+ },
+};
+describe('test getBreadcrumb', () => {
+ it('Simple url', () => {
+ expect(getBreadcrumb(routerData, '/dashboard/analysis').name).toEqual(
+ '分析页'
+ );
+ });
+ it('Parameters url', () => {
+ expect(getBreadcrumb(routerData, '/userinfo/2144').name).toEqual(
+ '用户信息'
+ );
+ });
+ it('The middle parameter url', () => {
+ expect(getBreadcrumb(routerData, '/userinfo/2144/addr').name).toEqual(
+ '收货订单'
+ );
+ });
+ it('Loop through the parameters', () => {
+ const urlNameList = urlToList('/userinfo/2144/addr').map((url) => {
+ return getBreadcrumb(routerData, url).name;
+ });
+ expect(urlNameList).toEqual(['用户列表', '用户信息', '收货订单']);
+ });
+
+ it('a path', () => {
+ const urlNameList = urlToList('/userinfo').map((url) => {
+ return getBreadcrumb(routerData, url).name;
+ });
+ expect(urlNameList).toEqual(['用户列表']);
+ });
+ it('Secondary path', () => {
+ const urlNameList = urlToList('/userinfo/2144').map((url) => {
+ return getBreadcrumb(routerData, url).name;
+ });
+ expect(urlNameList).toEqual(['用户列表', '用户信息']);
+ });
+});
diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js
index 5ddf6ed983794c79e83f961ea605311211897bff..4811894da1f5d837a2a18307b58f2d81586c5944 100644
--- a/src/components/SiderMenu/SiderMenu.js
+++ b/src/components/SiderMenu/SiderMenu.js
@@ -87,12 +87,12 @@ export default class SiderMenu extends PureComponent {
}
/**
* Get selected child nodes
- * /user/chen => /user/:id
+ * /user/chen => ['user','/user/:id']
*/
getSelectedMenuKeys = (path) => {
const flatMenuKeys = this.getFlatMenuKeys(this.menus);
return flatMenuKeys.filter((item) => {
- return pathToRegexp(`/${item}`).test(path);
+ return pathToRegexp(`/${item}(.*)`).test(path);
});
}
/**
diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js
index 907e8280131663487d35d4bf9369e8229f7fce37..a2c35eaf84aba9e3ff00c3cc85f17880effff7f0 100644
--- a/src/components/StandardTable/index.js
+++ b/src/components/StandardTable/index.js
@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { PureComponent, Fragment } from 'react';
import { Table, Alert } from 'antd';
import styles from './index.less';
@@ -84,7 +84,7 @@ class StandardTable extends PureComponent {
+
已选择 {selectedRowKeys.length} 项
{
needTotalList.map(item => (
@@ -97,7 +97,7 @@ class StandardTable extends PureComponent {
)
}
清空
-
+
)}
type="info"
showIcon
diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js
index 7bd774246d9102646dd8ecf83399257d6bce175d..324af33a28c332cb7165ccfecb5ab7784be61061 100644
--- a/src/layouts/BasicLayout.js
+++ b/src/layouts/BasicLayout.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Layout, Icon, message } from 'antd';
import DocumentTitle from 'react-document-title';
@@ -230,9 +230,9 @@ class BasicLayout extends React.PureComponent {
blankTarget: true,
}]}
copyright={
-
+
Copyright 2018 蚂蚁金服体验技术部出品
-
+
}
/>
diff --git a/src/layouts/UserLayout.js b/src/layouts/UserLayout.js
index 946fc953692b7e43a3e1cd876b95369603f4f824..e736b2a0a1aaeddc9cad8914f25fd236ec1eab3c 100644
--- a/src/layouts/UserLayout.js
+++ b/src/layouts/UserLayout.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { Link, Redirect, Switch, Route } from 'dva/router';
import DocumentTitle from 'react-document-title';
import { Icon } from 'antd';
@@ -21,7 +21,7 @@ const links = [{
href: '',
}];
-const copyright = Copyright 2018 蚂蚁金服体验技术部出品
;
+const copyright = Copyright 2018 蚂蚁金服体验技术部出品;
class UserLayout extends React.PureComponent {
getPageTitle() {
diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js
index 2f98da8d2923e437de2e821dfb61d715ec21174d..f6df44063c86b9cad082764c9a9b3a37438b8600 100644
--- a/src/routes/Dashboard/Analysis.js
+++ b/src/routes/Dashboard/Analysis.js
@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, { Component, Fragment } from 'react';
import { connect } from 'dva';
import {
Row,
@@ -241,7 +241,7 @@ export default class Analysis extends Component {
};
return (
-
+
-
+
);
}
}
diff --git a/src/routes/Dashboard/Monitor.js b/src/routes/Dashboard/Monitor.js
index 4526f12158b274d47ddbe2b36ff4766f9be5f9f3..897dc9ce116573c4fd9a76f9c2309b141ff0bc2a 100644
--- a/src/routes/Dashboard/Monitor.js
+++ b/src/routes/Dashboard/Monitor.js
@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { PureComponent, Fragment } from 'react';
import { connect } from 'dva';
import { Row, Col, Card, Tooltip } from 'antd';
import numeral from 'numeral';
@@ -35,7 +35,7 @@ export default class Monitor extends PureComponent {
const { tags } = monitor;
return (
-
+
@@ -164,7 +164,7 @@ export default class Monitor extends PureComponent {
-
+
);
}
}
diff --git a/src/routes/Forms/StepForm/Step1.js b/src/routes/Forms/StepForm/Step1.js
index 2a962fbc18accd85f83d219698cc9c1c93583302..01cf0df2f753a43777fe27372678f175079e0931 100644
--- a/src/routes/Forms/StepForm/Step1.js
+++ b/src/routes/Forms/StepForm/Step1.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Form, Input, Button, Select, Divider } from 'antd';
import { routerRedux } from 'dva/router';
@@ -32,7 +32,7 @@ class Step1 extends React.PureComponent {
});
};
return (
-
+
转账到银行卡
如果需要,这里可以放一些关于产品的常见问题说明。如果需要,这里可以放一些关于产品的常见问题说明。如果需要,这里可以放一些关于产品的常见问题说明。
-
+
);
}
}
diff --git a/src/routes/Forms/StepForm/Step3.js b/src/routes/Forms/StepForm/Step3.js
index 78295ae4a2942d673ca905ddf0361ba0bc273d64..8df6388d60e741b4c3eefa872454d1b07fd4a40e 100644
--- a/src/routes/Forms/StepForm/Step3.js
+++ b/src/routes/Forms/StepForm/Step3.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Button, Row, Col } from 'antd';
import { routerRedux } from 'dva/router';
@@ -32,14 +32,14 @@ class Step3 extends React.PureComponent {
);
const actions = (
-
+
-
+
);
return (
-
+
@@ -44,7 +44,7 @@ export default class StepForm extends PureComponent {
-
+
);
diff --git a/src/routes/Forms/TableForm.js b/src/routes/Forms/TableForm.js
index a8b18c6f03782dafb060cf2ca4e98d4585327086..be01d82ff5af57271e36f002e9819b05343087f1 100644
--- a/src/routes/Forms/TableForm.js
+++ b/src/routes/Forms/TableForm.js
@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { PureComponent, Fragment } from 'react';
import { Table, Button, Input, message, Popconfirm, Divider } from 'antd';
import styles from './style.less';
@@ -203,7 +203,7 @@ export default class TableForm extends PureComponent {
}];
return (
-
+
新增成员
-
+
);
}
}
diff --git a/src/routes/List/Articles.js b/src/routes/List/Articles.js
index f7aac69a5dccfc2b3e05d6da6cc1f098403d9a64..436a7fa5ba3e6437734c03038341b6a0b0ad5498 100644
--- a/src/routes/List/Articles.js
+++ b/src/routes/List/Articles.js
@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, { Component, Fragment } from 'react';
import moment from 'moment';
import { connect } from 'dva';
import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col, Button } from 'antd';
@@ -99,7 +99,7 @@ export default class SearchList extends Component {
) : null;
return (
-
+
-
+
);
}
}
diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js
index 4f955079812e5d4107b7384b83b54a12a461c060..3c0bb252d3a1fb9898aebd68b04e321bf98d71f2 100644
--- a/src/routes/Profile/AdvancedProfile.js
+++ b/src/routes/Profile/AdvancedProfile.js
@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React, { Component, Fragment } from 'react';
import Debounce from 'lodash-decorators/debounce';
import Bind from 'lodash-decorators/bind';
import { connect } from 'dva';
@@ -23,7 +23,7 @@ const menu = (
);
const action = (
-
+
@@ -32,7 +32,7 @@ const action = (
-
+
);
const extra = (
@@ -69,20 +69,20 @@ const tabList = [{
const desc1 = (
-
+
曲丽丽
-
+
2016-12-12 12:32
);
const desc2 = (
);
diff --git a/src/routes/Result/Error.js b/src/routes/Result/Error.js
index dee00f84667cccb8893c7137ceb30685720218db..7ff6439336cecdb5edbca5567d9808d4f68554ee 100644
--- a/src/routes/Result/Error.js
+++ b/src/routes/Result/Error.js
@@ -1,10 +1,10 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { Button, Icon, Card } from 'antd';
import Result from '../../components/Result';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
const extra = (
-
+
您提交的内容有如下错误:
@@ -16,7 +16,7 @@ const extra = (
您的账户还不具备申请资格
立即升级
-
+
);
const actions = ;
diff --git a/src/routes/Result/Success.js b/src/routes/Result/Success.js
index 13dbbe859c781fa3d96d4e9a97a79c7941a80a73..f7aabd7fe7bbb9b76fa53da13fc51b202a6a970f 100644
--- a/src/routes/Result/Success.js
+++ b/src/routes/Result/Success.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { Fragment } from 'react';
import { Button, Row, Col, Icon, Steps, Card } from 'antd';
import Result from '../../components/Result';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
@@ -24,7 +24,7 @@ const desc2 = (
);
const extra = (
-
+
项目名称
@@ -48,15 +48,15 @@ const extra = (
财务复核} />
完成} />
-
+
);
const actions = (
-
+
-
+
);
export default () => (
diff --git a/src/utils/request.js b/src/utils/request.js
index ccabf19260d7d13291001ffa1c19fd6711c5a0cc..9b58189aa0a347cff4367da0059bf0e6a9094bf9 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -4,21 +4,21 @@ import { routerRedux } from 'dva/router';
import store from '../index';
const codeMessage = {
- 200: '服务器成功返回请求的数据',
+ 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
- 202: '一个请求已经进入后台排队(异步任务)',
+ 202: '一个请求已经进入后台排队(异步任务)。',
204: '删除数据成功。',
- 400: '发出的请求有错误,服务器没有进行新建或修改数据,的操作。',
+ 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
401: '用户没有权限(令牌、用户名、密码错误)。',
403: '用户得到授权,但是访问是被禁止的。',
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作',
+ 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
406: '请求的格式不可得。',
410: '请求的资源被永久删除,且不会再得到的。',
422: '当创建一个对象时,发生一个验证错误。',
- 500: '服务器发生错误,请检查服务器',
- 502: '网关错误',
- 503: '服务不可用,服务器暂时过载或维护',
- 504: '网关超时',
+ 500: '服务器发生错误,请检查服务器。',
+ 502: '网关错误。',
+ 503: '服务不可用,服务器暂时过载或维护。',
+ 504: '网关超时。',
};
function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
@@ -48,12 +48,21 @@ export default function request(url, options) {
};
const newOptions = { ...defaultOptions, ...options };
if (newOptions.method === 'POST' || newOptions.method === 'PUT') {
- newOptions.headers = {
- Accept: 'application/json',
- 'Content-Type': 'application/json; charset=utf-8',
- ...newOptions.headers,
- };
- newOptions.body = JSON.stringify(newOptions.body);
+ if (!(newOptions.body instanceof FormData)) {
+ newOptions.headers = {
+ Accept: 'application/json',
+ 'Content-Type': 'application/json; charset=utf-8',
+ ...newOptions.headers,
+ };
+ newOptions.body = JSON.stringify(newOptions.body);
+ } else {
+ // newOptions.body is FormData
+ newOptions.headers = {
+ Accept: 'application/json',
+ 'Content-Type': 'multipart/form-data',
+ ...newOptions.headers,
+ };
+ }
}
return fetch(url, newOptions)