diff --git a/.gitignore b/.gitignore index 8907b942..07f7dce9 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 7ca7eee5..e1bc2789 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 3e7faae6..ea7bfaa7 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 8f24c72b..030d506c 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 00000000..5475bee0 --- /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 ba0c6c32..fcae38a9 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 d51e9833..a79e2859 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 48d1b2b8..91eabf87 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 51588bb5..f3b2f80a 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 00000000..8e34c694 --- /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 66f28adf..e7e9b04d 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 0b1560e2..4d63d356 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 e024796e..002ad284 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 4643ee76..9fd49f17 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 fa5beb64..15139cc9 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 4fb2c48b..5adb50cd 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 00000000..ab454637 --- /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 8fe98bb0..f7a70ead 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 3a06d758..28e56cc0 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 3033265e..42a7692d 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 13324b97..efc581ab 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 d942591c..78334b73 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 a221df04..14b4984d 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 d6936f0b..56a9660a 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 54c49633..57a97838 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 b45afc3a..214a7ca1 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 12d03b19..07c3cbd4 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 af1666aa..a971a33e 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 4e7df540..9b142007 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 b2606c2d..bca8f10b 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 8591d830..93d407f2 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 856b51aa..3663dbc2 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 9e20e278..61263b56 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 5eb6cb72..fac8260b 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 591da964..80e495ea 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 60d16d16..add0a935 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);