diff --git a/.gitignore b/.gitignore index 8907b942d545935dced0f4a61910b34ba2ce8307..07f7dce9b01151bb186704ec53d5771155a10846 100755 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ _roadhog-api-doc # production /dist -/vscode +/.vscode # misc .DS_Store @@ -20,5 +20,11 @@ yarn-error.log yarn.lock package-lock.json *bak +<<<<<<< HEAD jsconfig.json .vscode +======= + +# visual studio code +.history +>>>>>>> master diff --git a/.webpackrc.js b/.webpackrc.js index 7ca7eee5b1e00749995cddbabdf57376299015a6..e1bc278940e4c40f00fca2bbc7f9919bbc45fd5f 100755 --- a/.webpackrc.js +++ b/.webpackrc.js @@ -2,21 +2,17 @@ const path = require('path'); export default { entry: 'src/index.js', - extraBabelPlugins: [ - [ - 'import', - { - libraryName: 'antd', - libraryDirectory: 'es', - style: true, - }, - ], - ], + extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]], env: { development: { extraBabelPlugins: ['dva-hmr'], }, }, + externals: { + '@antv/data-set': 'DataSet', + bizcharts: 'BizCharts', + rollbar: 'rollbar', + }, alias: { components: path.resolve(__dirname, 'src/components/'), }, diff --git a/README.md b/README.md index 3e7faae62c764850725b73c652eea2d67893fc10..ea7bfaa71337e5c18b566dc56f4d64599a0727ce 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,11 @@ English | [简体中文](./README.zh-CN.md) # Ant Design Pro -[![](https://img.shields.io/travis/ant-design/ant-design-pro/master.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design-pro) [![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) [![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![](https://img.shields.io/travis/ant-design/ant-design-pro/master.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design-pro) +[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) +[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro#info=devDependencies&view=list) +[![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) An out-of-box UI solution for enterprise applications as a React boilerplate. diff --git a/README.zh-CN.md b/README.zh-CN.md index 8f24c72bb84d53936afeb8065ad7b8395a8e896f..030d506c65e6d5bf4d0f66361f740027e2851002 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,7 +2,11 @@ # Ant Design Pro -[![](https://img.shields.io/travis/ant-design/ant-design-pro.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design-pro) [![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) [![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![](https://img.shields.io/travis/ant-design/ant-design-pro/master.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design-pro) +[![Build status](https://ci.appveyor.com/api/projects/status/67fxu2by3ibvqtat/branch/master?svg=true)](https://ci.appveyor.com/project/afc163/ant-design-pro/branch/master) +[![Dependencies](https://img.shields.io/david/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro) +[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-pro.svg)](https://david-dm.org/ant-design/ant-design-pro#info=devDependencies&view=list) +[![Gitter](https://badges.gitter.im/ant-design/ant-design-pro.svg)](https://gitter.im/ant-design/ant-design-pro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 开箱即用的中台前端/设计解决方案。 diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..5475bee038ba8a832e8b29d91bd08aa7af95d3ad --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "baseUrl": ".", + "paths": { + "components/*": ["./src/components/*"] + } + } +} diff --git a/package.json b/package.json index ba0c6c32df2bbd4287a1aaa9e0b0b807a49fefaa..fcae38a976d99275d95db674fc316ab07f3637f4 100755 --- a/package.json +++ b/package.json @@ -61,11 +61,11 @@ "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", "enzyme": "^3.1.0", - "eslint": "^4.14.0", + "eslint": "^5.0.0", "eslint-config-airbnb": "^17.0.0", "eslint-config-prettier": "^2.9.0", "eslint-plugin-babel": "^5.1.0", - "eslint-plugin-compat": "^2.4.0", + "eslint-plugin-compat": "^2.1.0", "eslint-plugin-import": "^2.8.0", "eslint-plugin-jsx-a11y": "^6.0.3", "eslint-plugin-markdown": "^1.0.0-beta.6", @@ -79,9 +79,9 @@ "redbox-react": "^1.5.0", "regenerator-runtime": "^0.11.1", "roadhog": "^2.4.2", - "roadhog-api-doc": "^1.0.4", + "roadhog-api-doc": "^1.0.3", "stylelint": "^9.2.1", - "stylelint-config-prettier": "^3.3.0", + "stylelint-config-prettier": "^3.0.4", "stylelint-config-standard": "^18.0.0" }, "optionalDependencies": { diff --git a/src/components/Authorized/CheckPermissions.js b/src/components/Authorized/CheckPermissions.js index d51e98333014d1705fab88d2ee13ae0c1d1948dc..a79e28591eb7440c586d1c04ff83eb7b38702cba 100644 --- a/src/components/Authorized/CheckPermissions.js +++ b/src/components/Authorized/CheckPermissions.js @@ -1,6 +1,6 @@ import React from 'react'; import PromiseRender from './PromiseRender'; -import { CURRENT } from './index'; +import { CURRENT } from './renderAuthorize'; function isPromise(obj) { return ( @@ -49,6 +49,10 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => { if (typeof authority === 'function') { try { const bool = authority(currentAuthority); + // 函数执行后返回值是 Promise + if (isPromise(bool)) { + return ; + } if (bool) { return target; } diff --git a/src/components/Authorized/index.js b/src/components/Authorized/index.js index 48d1b2b843d31b503b5fa8da8616ff5cdfaa9040..91eabf87f8debff26808ad2bb07588356dea03a1 100644 --- a/src/components/Authorized/index.js +++ b/src/components/Authorized/index.js @@ -2,31 +2,10 @@ import Authorized from './Authorized'; import AuthorizedRoute from './AuthorizedRoute'; import Secured from './Secured'; import check from './CheckPermissions.js'; - -/* eslint-disable import/no-mutable-exports */ -let CURRENT = 'NULL'; +import renderAuthorize from './renderAuthorize'; Authorized.Secured = Secured; Authorized.AuthorizedRoute = AuthorizedRoute; Authorized.check = check; -/** - * use authority or getAuthority - * @param {string|()=>String} currentAuthority - */ -const renderAuthorize = currentAuthority => { - if (currentAuthority) { - if (currentAuthority.constructor.name === 'Function') { - CURRENT = currentAuthority(); - } - if (currentAuthority.constructor.name === 'String') { - CURRENT = currentAuthority; - } - } else { - CURRENT = 'NULL'; - } - return Authorized; -}; - -export { CURRENT }; -export default renderAuthorize; +export default renderAuthorize(Authorized); diff --git a/src/components/Authorized/index.md b/src/components/Authorized/index.md index 51588bb5a5e22ff49bb048f128773bf67146277f..f3b2f80af5ffa27ecb310b6932dc7dfa7c7945c8 100644 --- a/src/components/Authorized/index.md +++ b/src/components/Authorized/index.md @@ -25,14 +25,14 @@ order: 15 | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| | children | 正常渲染的元素,权限判断通过时展示 | ReactNode | - | -| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean` | - | +| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | | noMatch | 权限异常渲染元素,权限判断不通过时展示 | ReactNode | - | ### Authorized.AuthorizedRoute | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean` | - | +| authority | 准入权限/权限判断 | `string | array | Promise | (currentAuthority) => boolean | Promise` | - | | redirectPath | 权限异常时重定向的页面路由 | string | - | 其余参数与 `Route` 相同。 @@ -43,16 +43,16 @@ order: 15 | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean` | - | +| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | | error | 权限异常时渲染元素 | ReactNode | | ### Authorized.check -函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。 `Authorized.check(authority, target, Exception)` +函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。 `Authorized.check(authority, target, Exception)` 注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。 | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| -| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean` | - | +| authority | 准入权限/权限判断 | `string | Promise | (currentAuthority) => boolean | Promise` | - | | target | 权限判断通过时渲染的元素 | ReactNode | - | | Exception | 权限异常时渲染元素 | ReactNode | - | diff --git a/src/components/Authorized/renderAuthorize.js b/src/components/Authorized/renderAuthorize.js new file mode 100644 index 0000000000000000000000000000000000000000..8e34c6942a2977b9d0a183c9ba277e9cb1ca4ddc --- /dev/null +++ b/src/components/Authorized/renderAuthorize.js @@ -0,0 +1,24 @@ +/* eslint-disable import/no-mutable-exports */ +let CURRENT = 'NULL'; +/** + * use authority or getAuthority + * @param {string|()=>String} currentAuthority + */ +const renderAuthorize = Authorized => { + return currentAuthority => { + if (currentAuthority) { + if (currentAuthority.constructor.name === 'Function') { + CURRENT = currentAuthority(); + } + if (currentAuthority.constructor.name === 'String') { + CURRENT = currentAuthority; + } + } else { + CURRENT = 'NULL'; + } + return Authorized; + }; +}; + +export { CURRENT }; +export default Authorized => renderAuthorize(Authorized); diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index 66f28adf37e4558a0d0d147ce06a2fdfdcb9fb9d..e7e9b04d2f2210cc2212299e183edaab9d3c3a11 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/src/components/Charts/WaterWave/index.js @@ -47,7 +47,7 @@ export default class WaterWave extends PureComponent { const data = percent / 100; const self = this; - if (!this.node || !data) { + if (!this.node || (data !== 0 && !data)) { return; } @@ -196,7 +196,10 @@ export default class WaterWave extends PureComponent {
{title && {title}} -

{percent}%

+

+ {percent} + % +

); diff --git a/src/components/CountDown/index.js b/src/components/CountDown/index.js index 0b1560e20c4a3142a8c851de7a7091c94fb996b5..4d63d3565fad39ff56143bccb029ee1a4c3f7404 100644 --- a/src/components/CountDown/index.js +++ b/src/components/CountDown/index.js @@ -73,7 +73,11 @@ class CountDown extends Component { const s = Math.floor((time - h * hours - m * minutes) / 1000); return ( - {fixedZero(h)}:{fixedZero(m)}:{fixedZero(s)} + {fixedZero(h)} + : + {fixedZero(m)} + : + {fixedZero(s)} ); }; diff --git a/src/components/DescriptionList/Description.js b/src/components/DescriptionList/Description.js index e024796e270f3b9747949bf139a6473ebb91583b..002ad2849e50b0d5372e6e7f469fce3f709840d5 100644 --- a/src/components/DescriptionList/Description.js +++ b/src/components/DescriptionList/Description.js @@ -10,7 +10,8 @@ const Description = ({ term, column, className, children, ...restProps }) => { return ( {term &&
{term}
} - {children &&
{children}
} + {children !== null && + children !== undefined &&
{children}
} ); }; diff --git a/src/components/Ellipsis/index.d.ts b/src/components/Ellipsis/index.d.ts index 4643ee76de64290b89dbc5280c64914daf412f44..9fd49f17e0e59bdc79b7475637a62635d0bf7de1 100644 --- a/src/components/Ellipsis/index.d.ts +++ b/src/components/Ellipsis/index.d.ts @@ -5,6 +5,7 @@ export interface IEllipsisProps { lines?: number; style?: React.CSSProperties; className?: string; + fullWidthRecognition?: boolean; } export default class Ellipsis extends React.Component {} diff --git a/src/components/Ellipsis/index.en-US.md b/src/components/Ellipsis/index.en-US.md index fa5beb6433328c72e584fa6178c1fededd54a8ef..15139cc9dc13e1f0db7c50f942d884761ed82fec 100644 --- a/src/components/Ellipsis/index.en-US.md +++ b/src/components/Ellipsis/index.en-US.md @@ -13,3 +13,4 @@ Property | Description | Type | Default tooltip | tooltip for showing the full text content when hovering over | boolean | - length | maximum number of characters in the text before being truncated | number | - lines | maximum number of rows in the text before being truncated | number | `1` +fullWidthRecognition | whether consider full-width character length as 2 when calculate string length | boolean | - diff --git a/src/components/Ellipsis/index.js b/src/components/Ellipsis/index.js index 4fb2c48bcc216d7deaaaeb434ecf474175aceaef..5adb50cd35b0fcba58d7422251b2f288fb244393 100644 --- a/src/components/Ellipsis/index.js +++ b/src/components/Ellipsis/index.js @@ -8,11 +8,40 @@ import styles from './index.less'; const isSupportLineClamp = document.body.style.webkitLineClamp !== undefined; -const EllipsisText = ({ text, length, tooltip, ...other }) => { +export const getStrFullLength = (str = '') => { + return str.split('').reduce((pre, cur) => { + const charCode = cur.charCodeAt(0); + if (charCode >= 0 && charCode <= 128) { + return pre + 1; + } else { + return pre + 2; + } + }, 0); +}; + +export const cutStrByFullLength = (str = '', maxLength) => { + let showLength = 0; + return str.split('').reduce((pre, cur) => { + const charCode = cur.charCodeAt(0); + if (charCode >= 0 && charCode <= 128) { + showLength += 1; + } else { + showLength += 2; + } + if (showLength <= maxLength) { + return pre + cur; + } else { + return pre; + } + }, ''); +}; + +const EllipsisText = ({ text, length, tooltip, fullWidthRecognition, ...other }) => { if (typeof text !== 'string') { throw new Error('Ellipsis children must be string.'); } - if (text.length <= length || length < 0) { + const textLength = fullWidthRecognition ? getStrFullLength(text) : text.length; + if (textLength <= length || length < 0) { return {text}; } const tail = '...'; @@ -20,7 +49,7 @@ const EllipsisText = ({ text, length, tooltip, ...other }) => { if (length - tail.length <= 0) { displayText = ''; } else { - displayText = text.slice(0, length); + displayText = fullWidthRecognition ? cutStrByFullLength(text, length) : text.slice(0, length); } if (tooltip) { @@ -55,7 +84,8 @@ export default class Ellipsis extends Component { } componentDidUpdate(perProps) { - if (this.props.lines !== perProps.lines) { + const { lines } = this.props; + if (lines !== perProps.lines) { this.computeLine(); } } @@ -80,7 +110,7 @@ export default class Ellipsis extends Component { // bisection const len = text.length; - const mid = Math.floor(len / 2); + const mid = Math.ceil(len / 2); const count = this.bisection(targetHeight, mid, 0, len, text, shadowNode); @@ -147,7 +177,15 @@ export default class Ellipsis extends Component { render() { const { text, targetCount } = this.state; - const { children, lines, length, className, tooltip, ...restProps } = this.props; + const { + children, + lines, + length, + className, + tooltip, + fullWidthRecognition, + ...restProps + } = this.props; const cls = classNames(styles.ellipsis, className, { [styles.lines]: lines && !isSupportLineClamp, @@ -170,6 +208,7 @@ export default class Ellipsis extends Component { length={length} text={children || ''} tooltip={tooltip} + fullWidthRecognition={fullWidthRecognition} {...restProps} /> ); diff --git a/src/components/Ellipsis/index.test.js b/src/components/Ellipsis/index.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ab45463766536dc253df3b12ca59290c25ac7e5d --- /dev/null +++ b/src/components/Ellipsis/index.test.js @@ -0,0 +1,13 @@ +import { getStrFullLength, cutStrByFullLength } from './index.js'; + +describe('test calculateShowLength', () => { + it('get full length', () => { + expect(getStrFullLength('一二,a,')).toEqual(8); + }); + it('cut str by full length', () => { + expect(cutStrByFullLength('一二,a,', 7)).toEqual('一二,a'); + }); + it('cut str when length small', () => { + expect(cutStrByFullLength('一22三', 5)).toEqual('一22'); + }); +}); diff --git a/src/components/Ellipsis/index.zh-CN.md b/src/components/Ellipsis/index.zh-CN.md index 8fe98bb065e4571edbaf2c2181ea5277762d64e4..f7a70eadd41a8251e76dbe4bcebdb909cdafbc43 100644 --- a/src/components/Ellipsis/index.zh-CN.md +++ b/src/components/Ellipsis/index.zh-CN.md @@ -14,3 +14,4 @@ order: 10 tooltip | 移动到文本展示完整内容的提示 | boolean | - length | 在按照长度截取下的文本最大字符数,超过则截取省略 | number | - lines | 在按照行数截取下最大的行数,超过则截取省略 | number | `1` +fullWidthRecognition | 是否将全角字符的长度视为2来计算字符串长度 | boolean | - diff --git a/src/components/HeaderSearch/index.d.ts b/src/components/HeaderSearch/index.d.ts index 3a06d758e8beb68c3ff68199418c37c588ca4826..28e56cc0bce138be55f772443d9ba52095c32631 100644 --- a/src/components/HeaderSearch/index.d.ts +++ b/src/components/HeaderSearch/index.d.ts @@ -6,6 +6,7 @@ export interface IHeaderSearchProps { onChange?: (value: string) => void; onPressEnter?: (value: string) => void; style?: React.CSSProperties; + className?: string; } export default class HeaderSearch extends React.Component {} diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index 3033265efd7708b2af52e575dfc99f6f7f6b110c..42a7692daa550c87a1c53f42f348e11c6b9e5b51 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -2,6 +2,8 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { Input, Icon, AutoComplete } from 'antd'; import classNames from 'classnames'; +import Debounce from 'lodash-decorators/debounce'; +import Bind from 'lodash-decorators/bind'; import styles from './index.less'; export default class HeaderSearch extends PureComponent { @@ -71,6 +73,18 @@ export default class HeaderSearch extends PureComponent { }); }; + // NOTE: 不能小于500,如果长按某键,第一次触发auto repeat的间隔是500ms,小于500会导致触发2次 + @Bind() + @Debounce(500, { + leading: true, + trailing: false, + }) + debouncePressEnter() { + const { onPressEnter } = this.props; + const value = this.state; + onPressEnter(value); + } + render() { const { className, placeholder, ...restProps } = this.props; delete restProps.defaultOpen; // for rc-select not affected diff --git a/src/components/PageHeader/index.less b/src/components/PageHeader/index.less index 13324b97da07718dade2c0480bcc0ddf9d79ce1b..efc581ab041ee8d247c720fb06bdb8c9f5f7b900 100644 --- a/src/components/PageHeader/index.less +++ b/src/components/PageHeader/index.less @@ -63,15 +63,20 @@ } .title, + .content { + flex: auto; + } + .action, - .content, .extraContent, .main { flex: 0 1 auto; } + .main { width: 100%; } + .title, .action { margin-bottom: 16px; diff --git a/src/components/SiderMenu/index.js b/src/components/SiderMenu/index.js index d942591c9111014db9a80fec5645b4d6bc1c3178..78334b7352a8c762f6727fa79236235b6d1c6185 100644 --- a/src/components/SiderMenu/index.js +++ b/src/components/SiderMenu/index.js @@ -19,26 +19,27 @@ const getFlatMenuKeys = menuData => { return keys; }; -const SiderMenuWrapper = props => - props.isMobile ? ( +const SiderMenuWrapper = props => { + const { isMobile, menuData, collapsed } = props; + return isMobile ? ( { props.onCollapse(true); }} - width="256px" > ) : ( - + ); +}; export default SiderMenuWrapper; diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js index a221df04bf0ca344a15b310a024f10443fbbff31..14b4984d728ad1c84606c786bed8c3074fa61575 100644 --- a/src/components/StandardTable/index.js +++ b/src/components/StandardTable/index.js @@ -97,7 +97,8 @@ class StandardTable extends PureComponent { 已选择 {selectedRowKeys.length} 项   {needTotalList.map(item => ( - {item.title}总计  + {item.title} + 总计  {item.render ? item.render(item.total) : item.total} diff --git a/src/index.ejs b/src/index.ejs index d6936f0bf4ff46a5a8b1d46074ffa5e0f175ad44..56a9660aea31d6efc31cdf387591c9d741f65d01 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -11,7 +11,6 @@ - diff --git a/src/models/register.js b/src/models/register.js index 54c49633e5fc0a9f9e3908c3e3dbe25e565c210b..57a97838d693532283476509391bfb3080e5ddc1 100644 --- a/src/models/register.js +++ b/src/models/register.js @@ -10,8 +10,8 @@ export default { }, effects: { - *submit(_, { call, put }) { - const response = yield call(fakeRegister); + *submit({ payload }, { call, put }) { + const response = yield call(fakeRegister, payload); yield put({ type: 'registerHandle', payload: response, diff --git a/src/models/user.js b/src/models/user.js index b45afc3aa2655536e6d5360a64d116964decfdc1..214a7ca12f750f49e4688a6fc99a41bb5a4188aa 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -35,7 +35,7 @@ export default { saveCurrentUser(state, action) { return { ...state, - currentUser: action.payload, + currentUser: action.payload || {}, }; }, changeNotifyCount(state, action) { diff --git a/src/routes/Dashboard/Workplace.js b/src/routes/Dashboard/Workplace.js index 12d03b19afbd9a2db8be25865a116923f80aa1de..07c3cbd47ca6601612c9fbf3d3a1eacb37bde687 100644 --- a/src/routes/Dashboard/Workplace.js +++ b/src/routes/Dashboard/Workplace.js @@ -144,7 +144,8 @@ export default class Workplace extends PureComponent {

团队内排名

- 8 / 24 + 8 + / 24

diff --git a/src/routes/Forms/BasicForm.js b/src/routes/Forms/BasicForm.js index af1666aa8783a038a33a74bceef98008e769bf4e..a971a33ee01c3fe5d4c04df702a1d78998952f69 100644 --- a/src/routes/Forms/BasicForm.js +++ b/src/routes/Forms/BasicForm.js @@ -138,7 +138,8 @@ export default class BasicForms extends PureComponent { {...formItemLayout} label={ - 邀评人(选填) + 邀评人 + (选填) } > @@ -150,7 +151,8 @@ export default class BasicForms extends PureComponent { {...formItemLayout} label={ - 权重(选填) + 权重 + (选填) } > diff --git a/src/routes/Forms/StepForm/Step2.js b/src/routes/Forms/StepForm/Step2.js index 4e7df540b99226de3e28c4b485173f11501094e6..9b142007a8aaef7e6c2af22b2bc06d882dca8772 100644 --- a/src/routes/Forms/StepForm/Step2.js +++ b/src/routes/Forms/StepForm/Step2.js @@ -55,7 +55,11 @@ class Step2 extends React.PureComponent { {data.amount} - ({digitUppercase(data.amount)}) + + ( + {digitUppercase(data.amount)} + ) + diff --git a/src/routes/List/Articles.js b/src/routes/List/Articles.js index b2606c2de39b01355bacea6fec166d3ba8025da2..bca8f10b8d8e32093d454da77d951ae8eb8368e3 100644 --- a/src/routes/List/Articles.js +++ b/src/routes/List/Articles.js @@ -82,7 +82,8 @@ export default class SearchList extends Component {
{content}
- {owner} 发布在 {href} + {owner} 发布在 + {href} {moment(updatedAt).format('YYYY-MM-DD HH:mm')}
diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 8591d8303f6b5394c02a85f1d70196a208cdbbca..93d407f27a3732f87d238f506c78c39137ad81a2 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -226,7 +226,7 @@ export default class AdvancedProfile extends Component { } render() { - const { stepDirection } = this.state; + const { stepDirection, operationkey } = this.state; const { profile, loading } = this.props; const { advancedOperation1, advancedOperation2, advancedOperation3 } = profile; const contentList = { @@ -333,7 +333,8 @@ export default class AdvancedProfile extends Component {
- 暂无数据 + + 暂无数据
- {contentList[this.state.operationkey]} + {contentList[operationkey]} ); diff --git a/src/routes/Result/Error.js b/src/routes/Result/Error.js index 856b51aa483aed1ad85f8ddcf07f9827f9381f00..3663dbc2db7d975efdcfb3eb3d6fdc7597402eac 100644 --- a/src/routes/Result/Error.js +++ b/src/routes/Result/Error.js @@ -16,13 +16,15 @@ const extra = ( 您提交的内容有如下错误:
- 您的账户已被冻结 + + 您的账户已被冻结 立即解冻
- 您的账户还不具备申请资格 + + 您的账户还不具备申请资格 立即升级 diff --git a/src/routes/Result/Success.js b/src/routes/Result/Success.js index 9e20e2780a4117bd4a3cd018aa11cba340ebc499..61263b5609fd65a501416f1f50af440661d52a89 100644 --- a/src/routes/Result/Success.js +++ b/src/routes/Result/Success.js @@ -15,7 +15,8 @@ const desc1 = ( }} >
- 曲丽丽 + 曲丽丽 +
2016-12-12 12:32
@@ -24,7 +25,8 @@ const desc1 = ( const desc2 = (
- 周毛毛 + 周毛毛 +
催一下 diff --git a/src/routes/User/RegisterResult.js b/src/routes/User/RegisterResult.js index 5eb6cb7295ba437bac93b406beee4a9201dbdff0..fac8260bf4041e0fde008337291e41a4321e27d6 100644 --- a/src/routes/User/RegisterResult.js +++ b/src/routes/User/RegisterResult.js @@ -23,7 +23,8 @@ const RegisterResult = ({ location }) => ( type="success" title={
- 你的账户:{location.state ? location.state.account : 'AntDesign@example.com'} 注册成功 + 你的账户: + {location.state ? location.state.account : 'AntDesign@example.com'} 注册成功
} description="激活邮件已发送到你的邮箱中,邮件有效期为24小时。请及时登录邮箱,点击邮件中的链接激活帐户。" diff --git a/src/utils/request.js b/src/utils/request.js index 591da964f5c9f08118bfb6c1e2daafcdaea4def0..80e495ea21b4c7caa91110fcc74091050c955ca1 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -47,7 +47,11 @@ export default function request(url, options) { credentials: 'include', }; const newOptions = { ...defaultOptions, ...options }; - if (newOptions.method === 'POST' || newOptions.method === 'PUT') { + if ( + newOptions.method === 'POST' || + newOptions.method === 'PUT' || + newOptions.method === 'DELETE' + ) { if (!(newOptions.body instanceof FormData)) { newOptions.headers = { Accept: 'application/json', diff --git a/src/utils/utils.js b/src/utils/utils.js index 60d16d162e1ccf39c80c1bab36410ee205c4ef4a..add0a935bea0068f1dc8e89019894269ba72a150 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -124,11 +124,10 @@ function getRenderArr(routes) { let renderArr = []; renderArr.push(routes[0]); for (let i = 1; i < routes.length; i += 1) { - let isAdd = false; - // 是否包含 - isAdd = renderArr.every(item => getRelation(item, routes[i]) === 3); // 去重 renderArr = renderArr.filter(item => getRelation(item, routes[i]) !== 1); + // 是否包含 + const isAdd = renderArr.every(item => getRelation(item, routes[i]) === 3); if (isAdd) { renderArr.push(routes[i]); } @@ -164,7 +163,7 @@ export function getRoutes(path, routerData) { } /* eslint no-useless-escape:0 */ -const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/g; +const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; export function isUrl(path) { return reg.test(path);