diff --git a/.webpackrc b/.webpackrc deleted file mode 100755 index e0ec2a44720bac0d6ae8cfc4a1945a71cb745a82..0000000000000000000000000000000000000000 --- a/.webpackrc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "entry": "src/index.js", - "extraBabelPlugins": [ - "transform-decorators-legacy", - ["import", { "libraryName": "antd", "libraryDirectory": "es", "style": true }] - ], - "env": { - "development": { - "extraBabelPlugins": [ - "dva-hmr" - ] - } - }, - "ignoreMomentLocale": true, - "theme": "./src/theme.js", - "html": { - "template": "./src/index.ejs" - }, - "publicPath": "/", - "hash": true -} diff --git a/.webpackrc.js b/.webpackrc.js new file mode 100755 index 0000000000000000000000000000000000000000..3fbc6cc06223b368306273d95e6fec9aa8339259 --- /dev/null +++ b/.webpackrc.js @@ -0,0 +1,25 @@ +const path = require("path"); + +export default { + entry: "src/index.js", + extraBabelPlugins: [ + "transform-decorators-legacy", + ["import", { libraryName: "antd", libraryDirectory: "es", style: true }] + ], + env: { + development: { + extraBabelPlugins: ["dva-hmr"] + } + }, + alias: { + components: path.resolve(__dirname, "src/components/") + }, + ignoreMomentLocale: true, + theme: "./src/theme.js", + html: { + template: "./src/index.ejs" + }, + disableDynamicImport: true, + publicPath: "/", + hash: true +}; diff --git a/README.md b/README.md index 5840e2ae97006cc8eb047733c2f52f03fd46e135..3e7faae62c764850725b73c652eea2d67893fc10 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ An out-of-box UI solution for enterprise applications as a React boilerplate. - Documentation: http://pro.ant.design/docs/getting-started - ChangeLog: http://pro.ant.design/docs/changelog - FAQ: http://pro.ant.design/docs/faq +- Mirror Site in China: http://ant-design-pro.gitee.io ## Translation Recruitment :loudspeaker: diff --git a/README.zh-CN.md b/README.zh-CN.md index d428f3e140f41c3dbb55f4a24f9f66098a625d26..8f24c72bb84d53936afeb8065ad7b8395a8e896f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -13,6 +13,7 @@ - 使用文档:http://pro.ant.design/docs/getting-started-cn - 更新日志: http://pro.ant.design/docs/changelog-cn - 常见问题:http://pro.ant.design/docs/faq-cn +- 国内镜像:http://ant-design-pro.gitee.io ## 特性 diff --git a/package.json b/package.json index 290d6799423ae3364e00f14b172743f53d262e71..44dec94fc3f1514bddc911fb0be1fa9dea69d866 100755 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "private": true, "scripts": { "precommit": "npm run lint-staged", - "start": "cross-env DISABLE_ESLINT=true roadhog dev", - "start:no-proxy": "cross-env NO_PROXY=true DISABLE_ESLINT=true roadhog dev", - "build": "cross-env DISABLE_ESLINT=true roadhog build", + "start": "cross-env ESLINT=none roadhog dev", + "start:no-proxy": "cross-env NO_PROXY=true ESLINT=none roadhog dev", + "build": "cross-env ESLINT=none roadhog build", "site": "roadhog-api-doc static && gh-pages -d dist", "analyze": "cross-env ANALYZE=true roadhog build", "lint:style": "stylelint \"src/**/*.less\" --syntax less", @@ -22,7 +22,7 @@ "dependencies": { "@antv/data-set": "^0.8.0", "@babel/polyfill": "^7.0.0-beta.36", - "antd": "^3.2.0", + "antd": "^3.3.0", "babel-runtime": "^6.9.2", "bizcharts": "^3.1.3-beta.1", "bizcharts-plugin-slider": "^2.0.1", @@ -50,7 +50,7 @@ "devDependencies": { "babel-eslint": "^8.1.2", "babel-plugin-dva-hmr": "^0.4.1", - "babel-plugin-import": "^1.6.3", + "babel-plugin-import": "^1.6.7", "babel-plugin-transform-decorators-legacy": "^1.3.4", "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", @@ -70,7 +70,7 @@ "pro-download": "^1.0.1", "redbox-react": "^1.5.0", "regenerator-runtime": "^0.11.1", - "roadhog": "^2.1.0", + "roadhog": "^2.3.0", "roadhog-api-doc": "^0.3.4", "stylelint": "^8.4.0", "stylelint-config-standard": "^18.0.0" @@ -82,6 +82,9 @@ "**/*.{js,jsx}": "lint-staged:js", "**/*.less": "stylelint --syntax less" }, + "engines": { + "node" : ">=8.0.0" + }, "browserslist": [ "> 1%", "last 2 versions", diff --git a/src/components/AvatarList/AvatarItem.d.ts b/src/components/AvatarList/AvatarItem.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5681de77c2b3634ee8a54487fe15d07044fa8ca4 --- /dev/null +++ b/src/components/AvatarList/AvatarItem.d.ts @@ -0,0 +1,10 @@ +import * as React from 'react'; +export interface IAvatarItemProps { + tips: React.ReactNode; + src: string; + style?: React.CSSProperties; +} + +export default class AvatarItem extends React.Component { + constructor(props: IAvatarItemProps); +} diff --git a/src/components/AvatarList/index.d.ts b/src/components/AvatarList/index.d.ts index 101a70d40918c4936e00aa15499c9af99517e109..bc8ce19cfc197169e414ae103255314ebe1ed8aa 100644 --- a/src/components/AvatarList/index.d.ts +++ b/src/components/AvatarList/index.d.ts @@ -1,23 +1,14 @@ -import * as React from "react"; -export interface AvatarItemProps { - tips: React.ReactNode; - src: string; - style?: React.CSSProperties; -} +import * as React from 'react'; +import AvatarItem from './AvatarItem'; -export interface AvatarListProps { - size?: "large" | "small" | "mini" | "default"; +export interface IAvatarListProps { + size?: 'large' | 'small' | 'mini' | 'default'; style?: React.CSSProperties; children: | React.ReactElement | Array>; } -declare class AvatarItem extends React.Component { - constructor(props: AvatarItemProps); -} - -export default class AvatarList extends React.Component { - constructor(props: AvatarListProps); - static Item: typeof AvatarItem; +export default class AvatarList extends React.Component { + public static Item: typeof AvatarItem; } diff --git a/src/components/Charts/Bar/index.d.ts b/src/components/Charts/Bar/index.d.ts index 7be2a1a71fe4c8ddf4c75f06b26fbe7be7ed3a17..2813a272c3b1b28d2494e46031f227ad514368a0 100644 --- a/src/components/Charts/Bar/index.d.ts +++ b/src/components/Charts/Bar/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface BarProps { +export interface IBarProps { title: React.ReactNode; color?: string; padding?: [number, number, number, number]; @@ -12,4 +12,4 @@ export interface BarProps { style?: React.CSSProperties; } -export default class Bar extends React.Component {} +export default class Bar extends React.Component {} diff --git a/src/components/Charts/ChartCard/index.d.ts b/src/components/Charts/ChartCard/index.d.ts index 35a5852e9c172aaf4984202333ec52f157a545c3..76470460aede98c676da760cbb39b675cb20a648 100644 --- a/src/components/Charts/ChartCard/index.d.ts +++ b/src/components/Charts/ChartCard/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface ChartCardProps { +export interface IChartCardProps { title: React.ReactNode; action?: React.ReactNode; total?: React.ReactNode | number; @@ -9,4 +9,4 @@ export interface ChartCardProps { style?: React.CSSProperties; } -export default class ChartCard extends React.Component {} +export default class ChartCard extends React.Component {} diff --git a/src/components/Charts/ChartCard/index.js b/src/components/Charts/ChartCard/index.js index db2c4623fa3fb99201b09a283d3cdf5b16385f6a..99489f77bca8949fa4c6fb1fc76ee9f4b1b69d1d 100644 --- a/src/components/Charts/ChartCard/index.js +++ b/src/components/Charts/ChartCard/index.js @@ -4,6 +4,18 @@ import classNames from 'classnames'; import styles from './index.less'; +const renderTotal = (total) => { + let totalDom; + switch (typeof total) { + case undefined: + totalDom = null; + break; + default: + totalDom =
{total}
; + } + return totalDom; +}; + const ChartCard = ({ loading = false, contentHeight, title, avatar, action, total, footer, children, ...rest }) => { @@ -22,10 +34,7 @@ const ChartCard = ({ {title} {action} - { - // eslint-disable-next-line - (total !== undefined) && (
) - } + {renderTotal(total)}
{ diff --git a/src/components/Charts/Field/index.d.ts b/src/components/Charts/Field/index.d.ts index b1f779cd6ef118cc74accf1cc826bc0630337cbe..c89aaf969f13cabbfee0275bf08ce24245d8bfe9 100644 --- a/src/components/Charts/Field/index.d.ts +++ b/src/components/Charts/Field/index.d.ts @@ -1,8 +1,8 @@ import * as React from "react"; -export interface FieldProps { +export interface IFieldProps { label: React.ReactNode; value: React.ReactNode; style?: React.CSSProperties; } -export default class Field extends React.Component {} +export default class Field extends React.Component {} diff --git a/src/components/Charts/Gauge/index.d.ts b/src/components/Charts/Gauge/index.d.ts index 218fccf3e151e554eb0fd2ba3304c240deb9d009..e91dd562e51fb96d39ed811c826a5e18088afa5b 100644 --- a/src/components/Charts/Gauge/index.d.ts +++ b/src/components/Charts/Gauge/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface GaugeProps { +export interface IGaugeProps { title: React.ReactNode; color?: string; height: number; @@ -8,4 +8,4 @@ export interface GaugeProps { style?: React.CSSProperties; } -export default class Gauge extends React.Component {} +export default class Gauge extends React.Component {} diff --git a/src/components/Charts/MiniArea/index.d.ts b/src/components/Charts/MiniArea/index.d.ts index d2f67e4a893434e64ccd3568509934fc8c853a1d..2bcac70c5f1da3582e4bdf4e1d41e8c9e576014a 100644 --- a/src/components/Charts/MiniArea/index.d.ts +++ b/src/components/Charts/MiniArea/index.d.ts @@ -1,9 +1,9 @@ -import * as React from "react"; +import * as React from 'react'; // g2已经更新到3.0 // 不带的写了 -export interface Axis { +export interface IAxis { title: any; line: any; gridAlign: any; @@ -12,18 +12,18 @@ export interface Axis { grid: any; } -export interface MiniAreaProps { +export interface IMiniAreaProps { color?: string; height: number; borderColor?: string; line?: boolean; animate?: boolean; - xAxis?: Axis; - yAxis?: Axis; + xAxis?: IAxis; + yAxis?: IAxis; data: Array<{ x: number; y: number; }>; } -export default class MiniArea extends React.Component {} +export default class MiniArea extends React.Component {} diff --git a/src/components/Charts/MiniBar/index.d.ts b/src/components/Charts/MiniBar/index.d.ts index 3e2f1ec2286855f8241328e39f4262b0e71c3f0e..0c4bd6cce558f4b948691c553c65d76c8c34fc6b 100644 --- a/src/components/Charts/MiniBar/index.d.ts +++ b/src/components/Charts/MiniBar/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface MiniBarProps { +export interface IMiniBarProps { color?: string; height: number; data: Array<{ @@ -9,4 +9,4 @@ export interface MiniBarProps { style?: React.CSSProperties; } -export default class MiniBar extends React.Component {} +export default class MiniBar extends React.Component {} diff --git a/src/components/Charts/MiniProgress/index.d.ts b/src/components/Charts/MiniProgress/index.d.ts index 4dde6052a9930907baa182f673ea2e9c9b1f1ed8..bbcc1d0b29bf1fe75501e6063806352a501bbea2 100644 --- a/src/components/Charts/MiniProgress/index.d.ts +++ b/src/components/Charts/MiniProgress/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface MiniProgressProps { +export interface IMiniProgressProps { target: number; color?: string; strokeWidth?: number; @@ -8,6 +8,6 @@ export interface MiniProgressProps { } export default class MiniProgress extends React.Component< - MiniProgressProps, + IMiniProgressProps, any > {} diff --git a/src/components/Charts/Pie/index.d.ts b/src/components/Charts/Pie/index.d.ts index fe2e2a8e7aea2761898d41b9f313182bfa7a54ad..e9dcd1d4dffde04b38b624be1047b33c16844bea 100644 --- a/src/components/Charts/Pie/index.d.ts +++ b/src/components/Charts/Pie/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface PieProps { +export interface IPieProps { animate?: boolean; color?: string; height: number; @@ -17,4 +17,4 @@ export interface PieProps { subTitle?: React.ReactNode; } -export default class Pie extends React.Component {} +export default class Pie extends React.Component {} diff --git a/src/components/Charts/Radar/index.d.ts b/src/components/Charts/Radar/index.d.ts index 772cbf02f7b34aea4196f17016300c09db9532f2..d0f0dcfd7a380f285476b26cf057560ca34c55c5 100644 --- a/src/components/Charts/Radar/index.d.ts +++ b/src/components/Charts/Radar/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface RadarProps { +export interface IRadarProps { title?: React.ReactNode; height: number; padding?: [number, number, number, number]; @@ -12,4 +12,4 @@ export interface RadarProps { style?: React.CSSProperties; } -export default class Radar extends React.Component {} +export default class Radar extends React.Component {} diff --git a/src/components/Charts/TagCloud/index.d.ts b/src/components/Charts/TagCloud/index.d.ts index e2dcc79428e7066c5a8b5c8da1250ef7d991ff67..a85bac76620f7d84ca401de9e76103d6a0df1fd8 100644 --- a/src/components/Charts/TagCloud/index.d.ts +++ b/src/components/Charts/TagCloud/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface TagCloudProps { +export interface ITagCloudProps { data: Array<{ name: string; value: number; @@ -8,4 +8,4 @@ export interface TagCloudProps { style?: React.CSSProperties; } -export default class TagCloud extends React.Component {} +export default class TagCloud extends React.Component {} diff --git a/src/components/Charts/TimelineChart/index.d.ts b/src/components/Charts/TimelineChart/index.d.ts index f9241fa2e811dc7d22567f7d234143b0c0213b52..5ab7a664a41d2bea8951cb8438e88aaa696e8c53 100644 --- a/src/components/Charts/TimelineChart/index.d.ts +++ b/src/components/Charts/TimelineChart/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface TimelineChartProps { +export interface ITimelineChartProps { data: Array<{ x: string; y1: string; @@ -12,6 +12,6 @@ export interface TimelineChartProps { } export default class TimelineChart extends React.Component< - TimelineChartProps, + ITimelineChartProps, any > {} diff --git a/src/components/Charts/WaterWave/index.d.ts b/src/components/Charts/WaterWave/index.d.ts index 309db7b569fac4902f839bd1719ddd3687b40c50..8f5588d29f29baa7a5409eded24fb2cbe82e1c53 100644 --- a/src/components/Charts/WaterWave/index.d.ts +++ b/src/components/Charts/WaterWave/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface WaterWaveProps { +export interface IWaterWaveProps { title: React.ReactNode; color?: string; height: number; @@ -7,4 +7,4 @@ export interface WaterWaveProps { style?: React.CSSProperties; } -export default class WaterWave extends React.Component {} +export default class WaterWave extends React.Component {} diff --git a/src/components/CountDown/index.d.ts b/src/components/CountDown/index.d.ts index 3c46ac79330d2007d26da57ebad2bae7757866d4..c2d4bcf98484e79d63cfd1417f10f8b45faa65b3 100644 --- a/src/components/CountDown/index.d.ts +++ b/src/components/CountDown/index.d.ts @@ -1,9 +1,9 @@ import * as React from "react"; -export interface CountDownProps { +export interface ICountDownProps { format?: (time: number) => void; target: Date | number; onEnd?: () => void; style?: React.CSSProperties; } -export default class CountDown extends React.Component {} +export default class CountDown extends React.Component {} diff --git a/src/components/DescriptionList/Description.d.ts b/src/components/DescriptionList/Description.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a17be374accc8e2a1ffa9812327398a6c3f7173 --- /dev/null +++ b/src/components/DescriptionList/Description.d.ts @@ -0,0 +1,9 @@ +import * as React from 'react'; + +export default class Description extends React.Component< + { + term: React.ReactNode; + style?: React.CSSProperties; + }, + any +> {} diff --git a/src/components/DescriptionList/index.d.ts b/src/components/DescriptionList/index.d.ts index fe64433aa99987bedec5b8a8c586af17eb168418..e7b2baf6050455a99915cc381aa2c26461d768a0 100644 --- a/src/components/DescriptionList/index.d.ts +++ b/src/components/DescriptionList/index.d.ts @@ -1,5 +1,7 @@ import * as React from 'react'; -export interface DescriptionListProps { +import Description from './Description'; + +export interface IDescriptionListProps { layout?: 'horizontal' | 'vertical'; col?: number; title: React.ReactNode; @@ -8,17 +10,9 @@ export interface DescriptionListProps { style?: React.CSSProperties; } -declare class Description extends React.Component< - { - term: React.ReactNode; - style?: React.CSSProperties; - }, - any -> {} - export default class DescriptionList extends React.Component< - DescriptionListProps, + IDescriptionListProps, any > { - static Description: typeof Description; + public static Description: typeof Description; } diff --git a/src/components/Ellipsis/index.d.ts b/src/components/Ellipsis/index.d.ts index 4f84c7ae00b8597d614102692e396a08a28529b9..4643ee76de64290b89dbc5280c64914daf412f44 100644 --- a/src/components/Ellipsis/index.d.ts +++ b/src/components/Ellipsis/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface EllipsisProps { +export interface IEllipsisProps { tooltip?: boolean; length?: number; lines?: number; @@ -7,4 +7,4 @@ export interface EllipsisProps { className?: string; } -export default class Ellipsis extends React.Component {} +export default class Ellipsis extends React.Component {} diff --git a/src/components/Exception/index.d.ts b/src/components/Exception/index.d.ts index 037f866d03632ca4db3deabef1fe0326810d99b9..a0954377262a471d6c792bf91ae29b1c9c3c55b4 100644 --- a/src/components/Exception/index.d.ts +++ b/src/components/Exception/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface ExceptionProps { +export interface IExceptionProps { type?: "403" | "404" | "500"; title?: React.ReactNode; desc?: React.ReactNode; @@ -9,4 +9,4 @@ export interface ExceptionProps { style?: React.CSSProperties; } -export default class Exception extends React.Component {} +export default class Exception extends React.Component {} diff --git a/src/components/FooterToolbar/index.d.ts b/src/components/FooterToolbar/index.d.ts index 637bd4b8e7864bdaa5d459e793533fe5ff82ad79..130021d8d7bf5ecdc957da3742c06354451bee93 100644 --- a/src/components/FooterToolbar/index.d.ts +++ b/src/components/FooterToolbar/index.d.ts @@ -1,10 +1,10 @@ import * as React from 'react'; -export interface FooterToolbarProps { +export interface IFooterToolbarProps { extra: React.ReactNode; style?: React.CSSProperties; } export default class FooterToolbar extends React.Component< - FooterToolbarProps, + IFooterToolbarProps, any > {} diff --git a/src/components/GlobalFooter/index.d.ts b/src/components/GlobalFooter/index.d.ts index faf633b9ecb14def35693c769d93f87020a21cde..cc1224e39315a2211c6fa792988720cff6f63d0b 100644 --- a/src/components/GlobalFooter/index.d.ts +++ b/src/components/GlobalFooter/index.d.ts @@ -1,5 +1,5 @@ import * as React from "react"; -export interface GlobalFooterProps { +export interface IGlobalFooterProps { links?: Array<{ title: React.ReactNode; href: string; @@ -10,6 +10,6 @@ export interface GlobalFooterProps { } export default class GlobalFooter extends React.Component< - GlobalFooterProps, + IGlobalFooterProps, any > {} diff --git a/src/components/HeaderSearch/index.d.ts b/src/components/HeaderSearch/index.d.ts index 58316dfc18b6791e47cad9588e26daa84566a95f..a11d63a156a4423ebc32efd721cf50cda5229dfa 100644 --- a/src/components/HeaderSearch/index.d.ts +++ b/src/components/HeaderSearch/index.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; -export interface HeaderSearchProps { +export interface IHeaderSearchProps { placeholder?: string; - dataSource?: Array; + dataSource?: string[]; onSearch?: (value: string) => void; onChange?: (value: string) => void; onPressEnter?: (value: string) => void; @@ -9,6 +9,6 @@ export interface HeaderSearchProps { } export default class HeaderSearch extends React.Component< - HeaderSearchProps, + IHeaderSearchProps, any > {} diff --git a/src/components/NoticeIcon/NoticeIconTab.d.ts b/src/components/NoticeIcon/NoticeIconTab.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0f58e8178f51f3cdafe227b2d6ec47fdc4d73790 --- /dev/null +++ b/src/components/NoticeIcon/NoticeIconTab.d.ts @@ -0,0 +1,22 @@ +import * as React from 'react'; +export interface INoticeIconData { + avatar?: string; + title?: React.ReactNode; + description?: React.ReactNode; + datetime?: React.ReactNode; + extra?: React.ReactNode; + style?: React.CSSProperties; +} + +export interface INoticeIconTabProps { + list?: INoticeIconData[]; + title?: string; + emptyText?: React.ReactNode; + emptyImage?: string; + style?: React.CSSProperties; +} + +export default class NoticeIconTab extends React.Component< + INoticeIconTabProps, + any +> {} diff --git a/src/components/NoticeIcon/index.d.ts b/src/components/NoticeIcon/index.d.ts index 76541cd6c32e0ea073e65efa6aa08bac158c1c8a..52c4dea3a1abe1b822de55b7388087573ba05edd 100644 --- a/src/components/NoticeIcon/index.d.ts +++ b/src/components/NoticeIcon/index.d.ts @@ -1,19 +1,12 @@ -import * as React from 'react'; -export interface NoticeIconData { - avatar?: string; - title?: React.ReactNode; - description?: React.ReactNode; - datetime?: React.ReactNode; - extra?: React.ReactNode; - style?: React.CSSProperties; -} +import React from 'react'; +import NoticeIconTab, { INoticeIconData } from './NoticeIconTab'; -export interface NoticeIconProps { +export interface INoticeIconProps { count?: number; className?: string; loading?: boolean; onClear?: (tableTile: string) => void; - onItemClick?: (item: NoticeIconData, tabProps: NoticeIconProps) => void; + onItemClick?: (item: INoticeIconData, tabProps: INoticeIconProps) => void; onTabChange?: (tableTile: string) => void; popupAlign?: { points?: [string, string]; @@ -30,16 +23,6 @@ export interface NoticeIconProps { locale?: { emptyText: string; clear: string }; } -export interface NoticeIconTabProps { - list?: Array; - title?: string; - emptyText?: React.ReactNode; - emptyImage?: string; - style?: React.CSSProperties; -} - -export class NoticeIconTab extends React.Component {} - -export default class NoticeIcon extends React.Component { - static Tab: typeof NoticeIconTab; +export default class NoticeIcon extends React.Component { + public static Tab: typeof NoticeIconTab; } diff --git a/src/components/NumberInfo/index.d.ts b/src/components/NumberInfo/index.d.ts index 2370ec6d68a52a320ffeccb3b0b51cb180bb39c9..d9e5e7cfcd83b1ad30c063e5e6588b0af6056409 100644 --- a/src/components/NumberInfo/index.d.ts +++ b/src/components/NumberInfo/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface NumberInfoProps { +export interface INumberInfoProps { title?: React.ReactNode | string; subTitle?: React.ReactNode | string; total?: React.ReactNode | string; @@ -10,4 +10,7 @@ export interface NumberInfoProps { style?: React.CSSProperties; } -export default class NumberInfo extends React.Component {} +export default class NumberInfo extends React.Component< + INumberInfoProps, + any +> {} diff --git a/src/components/PageHeader/index.d.ts b/src/components/PageHeader/index.d.ts index 518f2032484c52543a0346487daf01689fcc9da5..a1c356e7c3c6b9c9adf683fdb73c92cb6a669384 100644 --- a/src/components/PageHeader/index.d.ts +++ b/src/components/PageHeader/index.d.ts @@ -1,19 +1,20 @@ import * as React from 'react'; -export interface PageHeaderProps { +export interface IPageHeaderProps { title?: React.ReactNode | string; logo?: React.ReactNode | string; action?: React.ReactNode | string; content?: React.ReactNode; extraContent?: React.ReactNode; - routes?: Array; + routes?: any[]; params?: any; breadcrumbList?: Array<{ title: React.ReactNode; href?: string }>; tabList?: Array<{ key: string; tab: React.ReactNode }>; tabActiveKey?: string; + tabDefaultActiveKey?: string; onTabChange?: (key: string) => void; tabBarExtraContent?: React.ReactNode; linkElement?: React.ReactNode; style?: React.CSSProperties; } -export default class PageHeader extends React.Component {} +export default class PageHeader extends React.Component {} diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index d85e716576d3cc7702b5bf107d5c29e5994484eb..e185f6a79d47510708af03eb529a69d8eafc707e 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -166,18 +166,15 @@ export default class PageHeader extends PureComponent { tabList, className, tabActiveKey, + tabDefaultActiveKey, tabBarExtraContent, } = this.props; const clsString = classNames(styles.pageHeader, className); - - let tabDefaultValue; - if (tabActiveKey !== undefined && tabList) { - tabDefaultValue = tabList.filter(item => item.default)[0] || tabList[0]; - } const breadcrumb = this.conversionBreadcrumbList(); - const activeKeyProps = { - defaultActiveKey: tabDefaultValue && tabDefaultValue.key, - }; + const activeKeyProps = {}; + if (tabDefaultActiveKey !== undefined) { + activeKeyProps.defaultActiveKey = tabDefaultActiveKey; + } if (tabActiveKey !== undefined) { activeKeyProps.activeKey = tabActiveKey; } diff --git a/src/components/PageHeader/index.md b/src/components/PageHeader/index.md index 334d354c84626225581325ef3c6d5ab4e72b631a..288f8b6ccdb2bbea3c0f83faf103aa4adde6694e 100644 --- a/src/components/PageHeader/index.md +++ b/src/components/PageHeader/index.md @@ -25,6 +25,7 @@ order: 11 | breadcrumbNameMap | 面包屑相关属性,路由的地址-名称映射表 | object | - | | tabList | tab 标题列表 | array<{key: string, tab: ReactNode}> | - | | tabActiveKey | 当前高亮的 tab 项 | string | - | +| tabDefaultActiveKey | 默认高亮的 tab 项 | string | 第一项 | | onTabChange | 切换面板的回调 | (key) => void | - | | linkElement | 定义链接的元素,默认为 `a`,可传入 react-router 的 Link | string\|ReactElement | - | diff --git a/src/components/Result/index.d.ts b/src/components/Result/index.d.ts index a316332e1785e363bdae2ed426baef880acb29a9..0c34c254014f49c0d7322acc1dab47cbd2fd52b4 100644 --- a/src/components/Result/index.d.ts +++ b/src/components/Result/index.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -export interface ResultProps { +export interface IResultProps { type: 'success' | 'error'; title: React.ReactNode; description?: React.ReactNode; @@ -8,4 +8,4 @@ export interface ResultProps { style?: React.CSSProperties; } -export default class Result extends React.Component {} +export default class Result extends React.Component {} diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js index 11c80e64be317c70e422d2bc3e71f95c0ffd4a91..7c09620db07163627a395f9f3d2ac38d35afcb9e 100644 --- a/src/components/SiderMenu/SiderMenu.js +++ b/src/components/SiderMenu/SiderMenu.js @@ -1,11 +1,27 @@ import React, { PureComponent } from 'react'; -import { Layout } from 'antd'; +import { Layout, Menu, Icon } from 'antd'; import { Link } from 'dva/router'; import styles from './index.less'; import BaseMeun, { getMeunMatcheys } from './BaseMeun'; import { urlToList } from '../utils/pathTools'; const { Sider } = Layout; +const { SubMenu } = Menu; + +// Allow menu.js config icon as string or ReactNode +// icon: 'setting', +// icon: 'http://demo.com/icon.png', +// icon: , +const getIcon = (icon) => { + if (typeof icon === 'string' && icon.indexOf('http') === 0) { + return icon; + } + if (typeof icon === 'string') { + return ; + } + return icon; +}; + export default class SiderMenu extends PureComponent { constructor(props) { @@ -42,6 +58,77 @@ export default class SiderMenu extends PureComponent { * Convert pathname to openKeys * /list/search/articles = > ['list','/list/search'] * @param props + * 判断是否是http链接.返回 Link 或 a + * Judge whether it is http link.return a or Link + * @memberof SiderMenu + */ + getMenuItemPath = (item) => { + const itemPath = this.conversionPath(item.path); + const icon = getIcon(item.icon); + const { target, name } = item; + // Is it a http link + if (/^https?:\/\//.test(itemPath)) { + return ( + + {icon} + {name} + + ); + } + return ( + { + this.props.onCollapse(true); + } + : undefined + } + > + {icon} + {name} + + ); + }; + /** + * get SubMenu or Item + */ + getSubMenuOrItem = (item) => { + if (item.children && item.children.some(child => child.name)) { + const childrenItems = this.getNavMenuItems(item.children); + // 当无子菜单时就不展示菜单 + if (childrenItems && childrenItems.length > 0) { + return ( + + {getIcon(item.icon)} + {item.name} + + ) : ( + item.name + ) + } + key={item.path} + > + {childrenItems} + + ); + } + return null; + } else { + return ( + {this.getMenuItemPath(item)} + ); + } + }; + /** + * 获得菜单子节点 + * @memberof SiderMenu */ getDefaultCollapsedSubMenus(props) { const { location: { pathname } } = props || this.props; diff --git a/src/components/SiderMenu/index.less b/src/components/SiderMenu/index.less index 3e79067084a05f0a6dba2037e37b3848d436b0ab..2f02116d3018d60964b29094771edc00f5b12db0 100644 --- a/src/components/SiderMenu/index.less +++ b/src/components/SiderMenu/index.less @@ -49,4 +49,18 @@ .drawer .drawer-content { background: #001529; } + .ant-menu-inline-collapsed { + & > .ant-menu-item .sider-menu-item-img + span, + & > .ant-menu-item-group > .ant-menu-item-group-list > .ant-menu-item .sider-menu-item-img + span, + & > .ant-menu-submenu > .ant-menu-submenu-title .sider-menu-item-img + span { + max-width: 0; + display: inline-block; + opacity: 0; + } + } + .ant-menu-item .sider-menu-item-img + span, + .ant-menu-submenu-title .sider-menu-item-img + span { + transition: opacity .3s @ease-in-out, width .3s @ease-in-out; + opacity: 1; + } } diff --git a/src/components/TagSelect/TagSelectOption.d.ts b/src/components/TagSelect/TagSelectOption.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c69d421afab310662e9387f9cf6dd2e30e74fff6 --- /dev/null +++ b/src/components/TagSelect/TagSelectOption.d.ts @@ -0,0 +1,11 @@ +import * as React from 'react'; + +export interface ITagSelectOptionProps { + value: string | number; + style?: React.CSSProperties; +} + +export default class TagSelectOption extends React.Component< + ITagSelectOptionProps, + any +> {} diff --git a/src/components/TagSelect/index.d.ts b/src/components/TagSelect/index.d.ts index e9decee1d99e5b3b1d9d92ca63fe5d0ad8cc42f6..b17d34d859df6b93ce17856c9dfc3d6cc00bfbcf 100644 --- a/src/components/TagSelect/index.d.ts +++ b/src/components/TagSelect/index.d.ts @@ -1,23 +1,16 @@ import * as React from 'react'; -export interface TagSelectProps { - onChange?: (value: Array) => void; +import TagSelectOption from './TagSelectOption'; + +export interface ITagSelectProps { + onChange?: (value: string[]) => void; expandable?: boolean; - value?: Array| Array; - style?: React.CSSProperties; -} -export interface TagSelectOptionProps { - value: string| number; + value?: string[] | number[]; style?: React.CSSProperties; } -export class TagSelectOption extends React.Component< - TagSelectOptionProps, - any -> {} - -export default class TagSelect extends React.Component { - static Option: typeof TagSelectOption; - children: +export default class TagSelect extends React.Component { + public static Option: typeof TagSelectOption; + private children: | React.ReactElement | Array>; } diff --git a/src/components/Trend/index.d.ts b/src/components/Trend/index.d.ts index bb2b2a2b251294e4cd7307e04dec045339e67f6b..fafcb05f6ae46fb53fcfbd08a64776443e43c511 100644 --- a/src/components/Trend/index.d.ts +++ b/src/components/Trend/index.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; -export interface TrendProps { +export interface ITrendProps { colorful?: boolean; flag: 'up' | 'down'; style?: React.CSSProperties; } -export default class Trend extends React.Component {} +export default class Trend extends React.Component {} diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 8ef41f6105d098ee4158bb40caa1dc347509e5b5..160edaef6b8a1c98a083111c093d234eeedd1dec 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -16,7 +16,7 @@ import Footer from './Footer'; import Header from './Header'; const { Content } = Layout; -const { AuthorizedRoute } = Authorized; +const { AuthorizedRoute, check } = Authorized; const RightSidebar = connect(({ setting }) => ({ ...setting }))(Sidebar); @@ -72,7 +72,11 @@ class BasicLayout extends React.PureComponent { urlParams.searchParams.delete('redirect'); window.history.replaceState(null, 'redirect', urlParams.href); } else { - return '/dashboard/analysis'; + const { routerData } = this.props; + // get the first authorized route path in routerData + const authorizedPath = Object.keys(routerData).find(item => + check(routerData[item].authority, item) && item !== '/'); + return authorizedPath; } return redirect; }; diff --git a/src/models/error.js b/src/models/error.js index c2508f674d435728a8c7a3eb54ac5aba2b2f1c41..01431f4cd0839683cb252ae2ec35995a4d88a5c6 100644 --- a/src/models/error.js +++ b/src/models/error.js @@ -1,4 +1,5 @@ -import { query403, query401, query404, query500 } from '../services/error'; +import { routerRedux } from 'dva/router'; +import { query } from '../services/error'; export default { namespace: 'error', @@ -9,32 +10,13 @@ export default { }, effects: { - *query403(_, { call, put }) { - yield call(query403); + *query({ payload }, { call, put }) { + yield call(query, payload.code); + // redirect on client when network broken + yield put(routerRedux.push(`/exception/${payload.code}`)); yield put({ type: 'trigger', - payload: '403', - }); - }, - *query401(_, { call, put }) { - yield call(query401); - yield put({ - type: 'trigger', - payload: '401', - }); - }, - *query500(_, { call, put }) { - yield call(query500); - yield put({ - type: 'trigger', - payload: '500', - }); - }, - *query404(_, { call, put }) { - yield call(query404); - yield put({ - type: 'trigger', - payload: '404', + payload: payload.code, }); }, }, diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js index b1f3a435c43fd1ee003963e7b1f5260a15eb0699..f760e27209d01e359d61003e041ebbba0b8a2e57 100644 --- a/src/routes/Dashboard/Analysis.js +++ b/src/routes/Dashboard/Analysis.js @@ -13,8 +13,6 @@ import { Menu, Dropdown, } from 'antd'; -import numeral from 'numeral'; -import GridContent from '../../layouts/GridContent'; import { ChartCard, yuan, @@ -25,9 +23,12 @@ import { Bar, Pie, TimelineChart, -} from '../../components/Charts'; -import Trend from '../../components/Trend'; -import NumberInfo from '../../components/NumberInfo'; +} from 'components/Charts'; +import Trend from 'components/Trend'; +import NumberInfo from 'components/NumberInfo'; +import numeral from 'numeral'; +import GridContent from '../../layouts/GridContent'; + import { getTimeDistance } from '../../utils/utils'; import styles from './Analysis.less'; diff --git a/src/routes/Dashboard/Monitor.js b/src/routes/Dashboard/Monitor.js index 8332cc98b351a51009d4ad51ab9f508e7689f31b..a6daa3121ae73fe9582fad53f63d1b906c2037ba 100644 --- a/src/routes/Dashboard/Monitor.js +++ b/src/routes/Dashboard/Monitor.js @@ -1,13 +1,14 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; import { Row, Col, Card, Tooltip } from 'antd'; +import { Pie, WaterWave, Gauge, TagCloud } from 'components/Charts'; +import NumberInfo from 'components/NumberInfo'; +import CountDown from 'components/CountDown'; +import ActiveChart from 'components/ActiveChart'; import numeral from 'numeral'; import GridContent from '../../layouts/GridContent'; + import Authorized from '../../utils/Authorized'; -import { Pie, WaterWave, Gauge, TagCloud } from '../../components/Charts'; -import NumberInfo from '../../components/NumberInfo'; -import CountDown from '../../components/CountDown'; -import ActiveChart from '../../components/ActiveChart'; import styles from './Monitor.less'; const { Secured } = Authorized; @@ -49,10 +50,7 @@ export default class Monitor extends PureComponent { /> - + } /> @@ -67,7 +65,10 @@ export default class Monitor extends PureComponent {
- map + map
@@ -106,11 +107,7 @@ export default class Monitor extends PureComponent { - + - - + + - - + + diff --git a/src/routes/Dashboard/Workplace.js b/src/routes/Dashboard/Workplace.js index f568182676e5928248dda5a0385af4e41916be2f..6c550fb6ecaf2b2a22f7993e7c28fd04c090e511 100644 --- a/src/routes/Dashboard/Workplace.js +++ b/src/routes/Dashboard/Workplace.js @@ -4,9 +4,9 @@ import { connect } from 'dva'; import { Link } from 'dva/router'; import { Row, Col, Card, List, Avatar, Spin } from 'antd'; +import { Radar } from 'components/Charts'; +import EditableLinkGroup from 'components/EditableLinkGroup'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import EditableLinkGroup from '../../components/EditableLinkGroup'; -import { Radar } from '../../components/Charts'; import styles from './Workplace.less'; diff --git a/src/routes/Exception/403.js b/src/routes/Exception/403.js index 1e01b58a9aa376db385202eef5938c9d0c00b413..c6d86fe0ab1b5d7edee4c59d0b14d7a7f15dd241 100644 --- a/src/routes/Exception/403.js +++ b/src/routes/Exception/403.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Exception/404.js b/src/routes/Exception/404.js index 7d76d938c30ec1d83bfd9324c917056ac58d4450..0a3d87669618364fc9a69139341b58e49eca807e 100644 --- a/src/routes/Exception/404.js +++ b/src/routes/Exception/404.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Exception/500.js b/src/routes/Exception/500.js index fa84eee54a5c4c193e8f814afaf156a995cacd31..40f659cb616f1108fbabf89c5672aeb4b16c2184 100644 --- a/src/routes/Exception/500.js +++ b/src/routes/Exception/500.js @@ -1,6 +1,6 @@ import React from 'react'; import { Link } from 'dva/router'; -import Exception from '../../components/Exception'; +import Exception from 'components/Exception'; export default () => ( diff --git a/src/routes/Exception/triggerException.js b/src/routes/Exception/triggerException.js index e552d4db02038664d89e1403e18fe9ecf0550ee8..0a2d489ecba47595cf6de36a6569de9fbb7c235e 100644 --- a/src/routes/Exception/triggerException.js +++ b/src/routes/Exception/triggerException.js @@ -7,55 +7,34 @@ import styles from './style.less'; isloading: state.error.isloading, })) export default class TriggerException extends PureComponent { - state={ + state = { isloading: false, - } - trigger401 = () => { - this.setState({ - isloading: true, - }); - this.props.dispatch({ - type: 'error/query401', - }); - }; - trigger403 = () => { - this.setState({ - isloading: true, - }); - this.props.dispatch({ - type: 'error/query403', - }); - }; - trigger500 = () => { - this.setState({ - isloading: true, - }); - this.props.dispatch({ - type: 'error/query500', - }); }; - trigger404 = () => { + triggerError = (code) => { this.setState({ isloading: true, }); this.props.dispatch({ - type: 'error/query404', + type: 'error/query', + payload: { + code, + }, }); }; render() { return ( - - - - diff --git a/src/routes/Forms/AdvancedForm.js b/src/routes/Forms/AdvancedForm.js index 1247e1d1b10efd93c4c0b048351a246e04b6600d..5b5576462e3a73b4afb3c55cf90f6ce56fb43936 100644 --- a/src/routes/Forms/AdvancedForm.js +++ b/src/routes/Forms/AdvancedForm.js @@ -1,8 +1,8 @@ import React, { PureComponent } from 'react'; import { Card, Button, Form, Icon, Col, Row, DatePicker, TimePicker, Input, Select, Popover } from 'antd'; import { connect } from 'dva'; +import FooterToolbar from 'components/FooterToolbar'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import FooterToolbar from '../../components/FooterToolbar'; import TableForm from './TableForm'; import styles from './style.less'; diff --git a/src/routes/Forms/StepForm/Step3.js b/src/routes/Forms/StepForm/Step3.js index 8df6388d60e741b4c3eefa872454d1b07fd4a40e..549878e82342738297f60f4f0f646e9708197d2a 100644 --- a/src/routes/Forms/StepForm/Step3.js +++ b/src/routes/Forms/StepForm/Step3.js @@ -2,7 +2,7 @@ import React, { Fragment } from 'react'; import { connect } from 'dva'; import { Button, Row, Col } from 'antd'; import { routerRedux } from 'dva/router'; -import Result from '../../../components/Result'; +import Result from 'components/Result'; import styles from './style.less'; class Step3 extends React.PureComponent { diff --git a/src/routes/List/Applications.js b/src/routes/List/Applications.js index f65f13bde087110d2b8eb4eafeffaedbcbc7b86d..46aa1c18eefc3b2ce2c62a578d7023b5b110f368 100644 --- a/src/routes/List/Applications.js +++ b/src/routes/List/Applications.js @@ -2,11 +2,12 @@ import React, { PureComponent } from 'react'; import numeral from 'numeral'; import { connect } from 'dva'; import { Row, Col, Form, Card, Select, Icon, Avatar, List, Tooltip, Dropdown, Menu } from 'antd'; +import TagSelect from 'components/TagSelect'; +import StandardFormRow from 'components/StandardFormRow'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; import { formatWan } from '../../utils/utils'; + import styles from './Applications.less'; const { Option } = Select; diff --git a/src/routes/List/Articles.js b/src/routes/List/Articles.js index 436a7fa5ba3e6437734c03038341b6a0b0ad5498..a095ef8836221bb85ac07d68aa63ae3b28f7758d 100644 --- a/src/routes/List/Articles.js +++ b/src/routes/List/Articles.js @@ -3,8 +3,8 @@ import moment from 'moment'; import { connect } from 'dva'; import { Form, Card, Select, List, Tag, Icon, Avatar, Row, Col, Button } from 'antd'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; +import TagSelect from 'components/TagSelect'; +import StandardFormRow from 'components/StandardFormRow'; import styles from './Articles.less'; const { Option } = Select; diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 9e3818ec8382b4c52fe9ce20b168c161b8bef6e6..cd507865519c107c040d136c2d0ff5aae16e9168 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -2,8 +2,8 @@ import React, { PureComponent } from 'react'; import { connect } from 'dva'; import { Card, Button, Icon, List } from 'antd'; +import Ellipsis from 'components/Ellipsis'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import Ellipsis from '../../components/Ellipsis'; import styles from './CardList.less'; diff --git a/src/routes/List/Projects.js b/src/routes/List/Projects.js index 94d632824480604941554e771525e23e56870619..8592c20e880f54bb9765ae859875f2ae0a5c5854 100644 --- a/src/routes/List/Projects.js +++ b/src/routes/List/Projects.js @@ -3,10 +3,10 @@ import moment from 'moment'; import { connect } from 'dva'; import { Row, Col, Form, Card, Select, List } from 'antd'; -import StandardFormRow from '../../components/StandardFormRow'; -import TagSelect from '../../components/TagSelect'; -import AvatarList from '../../components/AvatarList'; -import Ellipsis from '../../components/Ellipsis'; +import TagSelect from 'components/TagSelect'; +import AvatarList from 'components/AvatarList'; +import Ellipsis from 'components/Ellipsis'; +import StandardFormRow from 'components/StandardFormRow'; import styles from './Projects.less'; @@ -45,7 +45,7 @@ export default class CoverCardList extends PureComponent { } }); }, 0); - } + }; render() { const { list: { list = [] }, loading, form } = this.props; @@ -72,15 +72,13 @@ export default class CoverCardList extends PureComponent { {moment(item.updatedAt).fromNow()}
- { - item.members.map((member, i) => ( - - )) - } + {item.members.map((member, i) => ( + + ))}
@@ -121,17 +119,10 @@ export default class CoverCardList extends PureComponent { )} - + - + {getFieldDecorator('author', {})(
-
- {cardList} -
+
{cardList}
); } diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index feaf1f0768993c893178feadc0874548213261d5..427e4c7f8cd0089cbfbad6e9d46b67fb68e1115a 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -3,7 +3,7 @@ import { connect } from 'dva'; import moment from 'moment'; import { Row, Col, Card, Form, Input, Select, Icon, Button, Dropdown, Menu, InputNumber, DatePicker, Modal, message, Badge, Divider, Steps, Radio } from 'antd'; -import StandardTable from '../../components/StandardTable'; +import StandardTable from 'components/StandardTable'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './TableList.less'; diff --git a/src/routes/Profile/AdvancedProfile.js b/src/routes/Profile/AdvancedProfile.js index 3c0bb252d3a1fb9898aebd68b04e321bf98d71f2..09065602ec3a11c1aab88007654d46f6682c2921 100644 --- a/src/routes/Profile/AdvancedProfile.js +++ b/src/routes/Profile/AdvancedProfile.js @@ -4,8 +4,8 @@ import Bind from 'lodash-decorators/bind'; import { connect } from 'dva'; import { Button, Menu, Dropdown, Icon, Row, Col, Steps, Card, Popover, Badge, Table, Tooltip, Divider } from 'antd'; import classNames from 'classnames'; +import DescriptionList from 'components/DescriptionList'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import DescriptionList from '../../components/DescriptionList'; import styles from './AdvancedProfile.less'; const { Step } = Steps; diff --git a/src/routes/Profile/BasicProfile.js b/src/routes/Profile/BasicProfile.js index ea006b01bf1d8461117d60635945ccace2b76160..ba585dc9c066352649b9d313ee425ec183ac3802 100644 --- a/src/routes/Profile/BasicProfile.js +++ b/src/routes/Profile/BasicProfile.js @@ -1,36 +1,45 @@ import React, { Component } from 'react'; import { connect } from 'dva'; import { Card, Badge, Table, Divider } from 'antd'; +import DescriptionList from 'components/DescriptionList'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; -import DescriptionList from '../../components/DescriptionList'; import styles from './BasicProfile.less'; const { Description } = DescriptionList; -const progressColumns = [{ - title: '时间', - dataIndex: 'time', - key: 'time', -}, { - title: '当前进度', - dataIndex: 'rate', - key: 'rate', -}, { - title: '状态', - dataIndex: 'status', - key: 'status', - render: text => ( - text === 'success' ? : - ), -}, { - title: '操作员ID', - dataIndex: 'operator', - key: 'operator', -}, { - title: '耗时', - dataIndex: 'cost', - key: 'cost', -}]; +const progressColumns = [ + { + title: '时间', + dataIndex: 'time', + key: 'time', + }, + { + title: '当前进度', + dataIndex: 'rate', + key: 'rate', + }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + render: text => + (text === 'success' ? ( + + ) : ( + + )), + }, + { + title: '操作员ID', + dataIndex: 'operator', + key: 'operator', + }, + { + title: '耗时', + dataIndex: 'cost', + key: 'cost', + }, +]; @connect(({ profile, loading }) => ({ profile, @@ -71,60 +80,67 @@ export default class BasicProfile extends Component { } return obj; }; - const goodsColumns = [{ - title: '商品编号', - dataIndex: 'id', - key: 'id', - render: (text, row, index) => { - if (index < basicGoods.length) { - return {text}; - } - return { - children: 总计, - props: { - colSpan: 4, - }, - }; + const goodsColumns = [ + { + title: '商品编号', + dataIndex: 'id', + key: 'id', + render: (text, row, index) => { + if (index < basicGoods.length) { + return {text}; + } + return { + children: 总计, + props: { + colSpan: 4, + }, + }; + }, }, - }, { - title: '商品名称', - dataIndex: 'name', - key: 'name', - render: renderContent, - }, { - title: '商品条码', - dataIndex: 'barcode', - key: 'barcode', - render: renderContent, - }, { - title: '单价', - dataIndex: 'price', - key: 'price', - align: 'right', - render: renderContent, - }, { - title: '数量(件)', - dataIndex: 'num', - key: 'num', - align: 'right', - render: (text, row, index) => { - if (index < basicGoods.length) { - return text; - } - return {text}; + { + title: '商品名称', + dataIndex: 'name', + key: 'name', + render: renderContent, }, - }, { - title: '金额', - dataIndex: 'amount', - key: 'amount', - align: 'right', - render: (text, row, index) => { - if (index < basicGoods.length) { - return text; - } - return {text}; + { + title: '商品条码', + dataIndex: 'barcode', + key: 'barcode', + render: renderContent, }, - }]; + { + title: '单价', + dataIndex: 'price', + key: 'price', + align: 'right', + render: renderContent, + }, + { + title: '数量(件)', + dataIndex: 'num', + key: 'num', + align: 'right', + render: (text, row, index) => { + if (index < basicGoods.length) { + return text; + } + return {text}; + }, + }, + { + title: '金额', + dataIndex: 'amount', + key: 'amount', + align: 'right', + render: (text, row, index) => { + if (index < basicGoods.length) { + return text; + } + return {text}; + }, + }, + ]; return ( diff --git a/src/routes/Result/Error.js b/src/routes/Result/Error.js index 7ff6439336cecdb5edbca5567d9808d4f68554ee..41f5d826c70fa761c70d2bac5a96e5ab73150fe8 100644 --- a/src/routes/Result/Error.js +++ b/src/routes/Result/Error.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import { Button, Icon, Card } from 'antd'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const extra = ( diff --git a/src/routes/Result/Success.js b/src/routes/Result/Success.js index f7aabd7fe7bbb9b76fa53da13fc51b202a6a970f..76fde59334b49a04a12a5cff929ed36cd29c7c91 100644 --- a/src/routes/Result/Success.js +++ b/src/routes/Result/Success.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; import { Button, Row, Col, Icon, Steps, Card } from 'antd'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const { Step } = Steps; diff --git a/src/routes/User/Login.js b/src/routes/User/Login.js index 01a0f990bc947e98bf4905ed787317df2bca8758..e45fc82bcd7d8c2095dd9dc8025eb0aedafdb7f4 100644 --- a/src/routes/User/Login.js +++ b/src/routes/User/Login.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { connect } from 'dva'; import { Link } from 'dva/router'; import { Checkbox, Alert, Icon } from 'antd'; -import Login from '../../components/Login'; +import Login from 'components/Login'; import styles from './Login.less'; const { Tab, UserName, Password, Mobile, Captcha, Submit } = Login; diff --git a/src/routes/User/RegisterResult.js b/src/routes/User/RegisterResult.js index ba635607a9a724dac8c121fd55cedef3f28e7a9f..6dba5c1d84af55a0624bba468ed77539a88598fe 100644 --- a/src/routes/User/RegisterResult.js +++ b/src/routes/User/RegisterResult.js @@ -1,7 +1,7 @@ import React from 'react'; import { Button } from 'antd'; import { Link } from 'dva/router'; -import Result from '../../components/Result'; +import Result from 'components/Result'; import styles from './RegisterResult.less'; const actions = ( diff --git a/src/services/error.js b/src/services/error.js index 9697b7eed2c49f977a0dcc327d995cbb14cf9ea1..7e1eeee1948fcbcd725af01420b7905432816b93 100644 --- a/src/services/error.js +++ b/src/services/error.js @@ -1,17 +1,5 @@ import request from '../utils/request'; -export async function query404() { - return request('/api/404'); -} - -export async function query401() { - return request('/api/401'); -} - -export async function query403() { - return request('/api/403'); -} - -export async function query500() { - return request('/api/500'); +export async function query(code) { + return request(`/api/${code}`); }