Unverified Commit 0d6fba34 authored by 陈小聪's avatar 陈小聪 Committed by GitHub

Merge pull request #11 from ant-design/Exception500

Exception (First Commit)
parents fe37e833 4e733b7b
......@@ -17,8 +17,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -17,7 +17,7 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.3.0-beta.1"
},
......
......@@ -173,10 +173,7 @@ class BaseView extends Component {
})(<PhoneView />)}
</FormItem>
<Button type="primary">
<FormattedMessage
id="BLOCK_NAME.basic.update"
defaultMessage="Update Information"
/>
<FormattedMessage id="BLOCK_NAME.basic.update" defaultMessage="Update Information" />
</Button>
</Form>
</div>
......
......@@ -19,8 +19,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -46,7 +46,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -42,7 +42,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -20,8 +20,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -20,8 +20,8 @@
"numeral": "^2.0.6"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.1.0"
},
"license": "ISC"
......
......@@ -22,10 +22,14 @@ const IntroduceRow = memo(({ loading, visitData }) => (
<Col {...topColResponsiveProps}>
<ChartCard
bordered={false}
title={<FormattedMessage id="BLOCK_NAME.analysis.total-sales" defaultMessage="Total Sales" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.total-sales" defaultMessage="Total Sales" />
}
action={
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
}
>
<Icon type="info-circle-o" />
</Tooltip>
......@@ -34,7 +38,9 @@ const IntroduceRow = memo(({ loading, visitData }) => (
total={() => <Yuan>126560</Yuan>}
footer={
<Field
label={<FormattedMessage id="BLOCK_NAME.analysis.day-sales" defaultMessage="Daily Sales" />}
label={
<FormattedMessage id="BLOCK_NAME.analysis.day-sales" defaultMessage="Daily Sales" />
}
value={`¥${numeral(12423).format('0,0')}`}
/>
}
......@@ -58,7 +64,9 @@ const IntroduceRow = memo(({ loading, visitData }) => (
title={<FormattedMessage id="BLOCK_NAME.analysis.visits" defaultMessage="Visits" />}
action={
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
}
>
<Icon type="info-circle-o" />
</Tooltip>
......@@ -66,7 +74,9 @@ const IntroduceRow = memo(({ loading, visitData }) => (
total={numeral(8846).format('0,0')}
footer={
<Field
label={<FormattedMessage id="BLOCK_NAME.analysis.day-visits" defaultMessage="Daily Visits" />}
label={
<FormattedMessage id="BLOCK_NAME.analysis.day-visits" defaultMessage="Daily Visits" />
}
value={numeral(1234).format('0,0')}
/>
}
......@@ -82,7 +92,9 @@ const IntroduceRow = memo(({ loading, visitData }) => (
title={<FormattedMessage id="BLOCK_NAME.analysis.payments" defaultMessage="Payments" />}
action={
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
}
>
<Icon type="info-circle-o" />
</Tooltip>
......@@ -116,7 +128,9 @@ const IntroduceRow = memo(({ loading, visitData }) => (
}
action={
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="Introduce" />
}
>
<Icon type="info-circle-o" />
</Tooltip>
......
......@@ -12,7 +12,10 @@ const CustomTab = ({ data, currentTabKey: currentKey }) => (
<NumberInfo
title={data.name}
subTitle={
<FormattedMessage id="BLOCK_NAME.analysis.conversion-rate" defaultMessage="Conversion Rate" />
<FormattedMessage
id="BLOCK_NAME.analysis.conversion-rate"
defaultMessage="Conversion Rate"
/>
}
gap={2}
total={`${data.cvr * 100}%`}
......
......@@ -47,7 +47,10 @@ const TopSearch = memo(({ loading, visitData2, searchData, dropdownGroup }) => (
loading={loading}
bordered={false}
title={
<FormattedMessage id="BLOCK_NAME.analysis.online-top-search" defaultMessage="Online Top Search" />
<FormattedMessage
id="BLOCK_NAME.analysis.online-top-search"
defaultMessage="Online Top Search"
/>
}
extra={dropdownGroup}
style={{ marginTop: 24 }}
......@@ -57,9 +60,14 @@ const TopSearch = memo(({ loading, visitData2, searchData, dropdownGroup }) => (
<NumberInfo
subTitle={
<span>
<FormattedMessage id="BLOCK_NAME.analysis.search-users" defaultMessage="search users" />
<FormattedMessage
id="BLOCK_NAME.analysis.search-users"
defaultMessage="search users"
/>
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="introduce" />
}
>
<Icon style={{ marginLeft: 8 }} type="info-circle-o" />
</Tooltip>
......@@ -81,7 +89,9 @@ const TopSearch = memo(({ loading, visitData2, searchData, dropdownGroup }) => (
defaultMessage="Per Capita Search"
/>
<Tooltip
title={<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="introduce" />}
title={
<FormattedMessage id="BLOCK_NAME.analysis.introduce" defaultMessage="introduce" />
}
>
<Icon style={{ marginLeft: 8 }} type="info-circle-o" />
</Tooltip>
......
......@@ -18,8 +18,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -115,7 +115,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
/>
)}
</FormItem>
<FormItem {...formItemLayout} label={<FormattedMessage id="BLOCK_NAME.standard.label" />}>
<FormItem
{...formItemLayout}
label={<FormattedMessage id="BLOCK_NAME.standard.label" />}
>
{getFieldDecorator('standard', {
rules: [
{
......
......@@ -46,7 +46,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -42,7 +42,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -21,8 +21,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -18,8 +18,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -18,8 +18,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
{
"name": "@umi-block/exception-403",
"name": "@pro-blocks/exception-403",
"version": "0.0.1",
"description": "Exception403",
"main": "src/index.js",
......@@ -8,18 +8,18 @@
},
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/exception403"
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception403"
},
"dependencies": {
"react": "^16.6.3",
"ant-design-pro": "^2.1.1",
"classnames": "^2.2.6",
"dva": "^2.4.0",
"umi-request": "^1.0.0-beta.1"
"react": "^16.6.3",
"umi-request": "^1.0.4",
"umi": "^2.6.8",
"umi-plugin-react": "^1.7.2"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.3.0"
},
"license": "ISC"
"license": "MIT"
}
---
order: 2
title:
zh-CN: 403 页面
en-US: 403 Page
---
## zh-CN
403 页面,配合自定义操作。
## en-US
403 page with custom operations.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
import { Button } from 'antd';
const actions = (
<div>
<Button type="primary">Home</Button>
<Button>Detail</Button>
</div>
);
ReactDOM.render(
<Exception type="403" actions={actions} />
, mountNode);
````
---
order: 0
title:
zh-CN: 404 页面
en-US: 404 Page
---
## zh-CN
404 页面。
## en-US
404 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="404" />
, mountNode);
````
---
order: 1
title:
zh-CN: 500 页面
en-US: 500 Page
---
## zh-CN
500 页面。
## en-US
500 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="500" />
, mountNode);
````
---
title: Exception
cols: 1
order: 5
---
Exceptions page is used to provide feedback on specific abnormal state. Usually, it contains an explanation of the error status, and provides users with suggestions or operations, to prevent users from feeling lost and confused.
## API
Property | Description | Type | Default
---------|-------------|------|--------
| backText | default return button text | ReactNode | back to home |
type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | -
title | title | ReactNode | -
desc | supplementary description | ReactNode | -
img | the url of background image | string | -
actions | suggested operations, a default 'Home' link will show if not set | ReactNode | -
linkElement | to specify the element of link | string\|ReactElement | 'a'
redirect | redirect path | string | '/'
\ No newline at end of file
@import '~antd/lib/style/themes/default.less';
.exception {
display: flex;
align-items: center;
height: 80%;
min-height: 500px;
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
padding-right: 152px;
zoom: 1;
&::before,
&::after {
content: ' ';
display: table;
}
&::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
}
}
.imgEle {
float: right;
width: 100%;
max-width: 430px;
height: 360px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
}
.content {
flex: auto;
h1 {
margin-bottom: 24px;
color: #434e59;
font-weight: 600;
font-size: 72px;
line-height: 72px;
}
.desc {
margin-bottom: 16px;
color: @text-color-secondary;
font-size: 20px;
line-height: 28px;
}
.actions {
button:not(:last-child) {
margin-right: 8px;
}
}
}
}
@media screen and (max-width: @screen-xl) {
.exception {
.imgBlock {
padding-right: 88px;
}
}
}
@media screen and (max-width: @screen-sm) {
.exception {
display: block;
text-align: center;
.imgBlock {
margin: 0 auto 24px;
padding-right: 0;
}
}
}
@media screen and (max-width: @screen-xs) {
.exception {
.imgBlock {
margin-bottom: -24px;
overflow: hidden;
}
}
}
import { Button } from 'antd';
import classNames from 'classnames';
import * as H from 'history';
import React, { createElement } from 'react';
import styles from './index.less';
import config from './typeConfig';
import Link from 'umi/link';
export interface ExceptionProps<
L = {
to: H.LocationDescriptor;
href?: H.LocationDescriptor;
replace?: boolean;
innerRef?: (node: HTMLAnchorElement | null) => void;
}
> {
type?: '403' | '404' | '500';
title?: React.ReactNode;
desc?: React.ReactNode;
img?: string;
actions?: React.ReactNode;
linkElement?: string | React.ComponentType<L> | typeof Link;
style?: React.CSSProperties;
className?: string;
backText?: React.ReactNode;
redirect?: string;
}
class Exception extends React.Component<ExceptionProps, any> {
static defaultProps = {
backText: 'back to home',
redirect: '/',
};
constructor(props: ExceptionProps) {
super(props);
this.state = {};
}
render() {
const {
className,
backText,
linkElement = 'a',
type = '404',
title,
desc,
img,
actions,
redirect,
...rest
} = this.props;
const pageType = type in config ? type : '404';
const clsString = classNames(styles.exception, className);
return (
<div className={clsString} {...rest}>
<div className={styles.imgBlock}>
<div
className={styles.imgEle}
style={{ backgroundImage: `url(${img || config[pageType].img})` }}
/>
</div>
<div className={styles.content}>
<h1>{title || config[pageType].title}</h1>
<div className={styles.desc}>{desc || config[pageType].desc}</div>
<div className={styles.actions}>
{actions ||
createElement(
linkElement as any,
{
to: redirect,
href: redirect,
},
<Button type="primary">{backText}</Button>
)}
</div>
</div>
</div>
);
}
}
export default Exception;
---
title: Exception
subtitle: 异常
cols: 1
order: 5
---
异常页用于对页面特定的异常状态进行反馈。通常,它包含对错误状态的阐述,并向用户提供建议或操作,避免用户感到迷失和困惑。
## API
| 参数 | 说明| 类型 | 默认值 |
|-------------|------------------------------------------|-------------|-------|
| backText| 默认的返回按钮文本 | ReactNode| back to home |
| type| 页面类型,若配置,则自带对应类型默认的 `title``desc``img`,此默认设置可以被 `title``desc``img` 覆盖 | Enum {'403', '404', '500'} | - |
| title | 标题 | ReactNode| -|
| desc| 补充描述| ReactNode| -|
| img | 背景图片地址 | string| -|
| actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效| ReactNode| -|
| linkElement | 定义链接的元素 | string\|ReactElement | 'a' |
| redirect | 返回按钮的跳转地址 | string | '/'
interface Config {
403: {
img: string;
title: string;
desc: string;
};
404: {
img: string;
title: string;
desc: string;
};
500: {
img: string;
title: string;
desc: string;
};
}
const config: Config = {
403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403',
desc: '抱歉,你无权访问该页面',
},
404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404',
desc: '抱歉,你访问的页面不存在',
},
500: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500',
desc: '抱歉,服务器出错了',
},
};
export default config;
import React from 'react';
import { formatMessage } from 'umi/locale';
import { formatMessage } from 'umi-plugin-react/locale';
import Link from 'umi/link';
import { Exception } from 'ant-design-pro';
import Exception from './components/Exception';
const PAGE_NAME_UPPER_CAMEL_CASE = () => (
const PAGE_NAME_UPPER_CAMEL_CASE: React.FC = () => (
<Exception
type="403"
desc={formatMessage({ id: 'BLOCK_NAME.description.403' })}
......
{
"name": "@umi-block/exception-404",
"name": "@pro-blocks/exception-404",
"version": "0.0.1",
"description": "Exception404",
"main": "src/index.js",
......@@ -8,18 +8,17 @@
},
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/exception404"
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception404"
},
"dependencies": {
"react": "^16.6.3",
"ant-design-pro": "^2.1.1",
"dva": "^2.4.0",
"umi-request": "^1.0.0-beta.1"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
"license": "MIT"
}
---
order: 2
title:
zh-CN: 403 页面
en-US: 403 Page
---
## zh-CN
403 页面,配合自定义操作。
## en-US
403 page with custom operations.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
import { Button } from 'antd';
const actions = (
<div>
<Button type="primary">Home</Button>
<Button>Detail</Button>
</div>
);
ReactDOM.render(
<Exception type="403" actions={actions} />
, mountNode);
````
---
order: 0
title:
zh-CN: 404 页面
en-US: 404 Page
---
## zh-CN
404 页面。
## en-US
404 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="404" />
, mountNode);
````
---
order: 1
title:
zh-CN: 500 页面
en-US: 500 Page
---
## zh-CN
500 页面。
## en-US
500 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="500" />
, mountNode);
````
---
title: Exception
cols: 1
order: 5
---
Exceptions page is used to provide feedback on specific abnormal state. Usually, it contains an explanation of the error status, and provides users with suggestions or operations, to prevent users from feeling lost and confused.
## API
Property | Description | Type | Default
---------|-------------|------|--------
| backText | default return button text | ReactNode | back to home |
type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | -
title | title | ReactNode | -
desc | supplementary description | ReactNode | -
img | the url of background image | string | -
actions | suggested operations, a default 'Home' link will show if not set | ReactNode | -
linkElement | to specify the element of link | string\|ReactElement | 'a'
redirect | redirect path | string | '/'
\ No newline at end of file
@import '~antd/lib/style/themes/default.less';
.exception {
display: flex;
align-items: center;
height: 80%;
min-height: 500px;
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
padding-right: 152px;
zoom: 1;
&::before,
&::after {
content: ' ';
display: table;
}
&::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
}
}
.imgEle {
float: right;
width: 100%;
max-width: 430px;
height: 360px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
}
.content {
flex: auto;
h1 {
margin-bottom: 24px;
color: #434e59;
font-weight: 600;
font-size: 72px;
line-height: 72px;
}
.desc {
margin-bottom: 16px;
color: @text-color-secondary;
font-size: 20px;
line-height: 28px;
}
.actions {
button:not(:last-child) {
margin-right: 8px;
}
}
}
}
@media screen and (max-width: @screen-xl) {
.exception {
.imgBlock {
padding-right: 88px;
}
}
}
@media screen and (max-width: @screen-sm) {
.exception {
display: block;
text-align: center;
.imgBlock {
margin: 0 auto 24px;
padding-right: 0;
}
}
}
@media screen and (max-width: @screen-xs) {
.exception {
.imgBlock {
margin-bottom: -24px;
overflow: hidden;
}
}
}
import { Button } from 'antd';
import classNames from 'classnames';
import * as H from 'history';
import React, { createElement } from 'react';
import styles from './index.less';
import config from './typeConfig';
import Link from 'umi/link';
export interface ExceptionProps<
L = {
to: H.LocationDescriptor;
href?: H.LocationDescriptor;
replace?: boolean;
innerRef?: (node: HTMLAnchorElement | null) => void;
}
> {
type?: '403' | '404' | '500';
title?: React.ReactNode;
desc?: React.ReactNode;
img?: string;
actions?: React.ReactNode;
linkElement?: string | React.ComponentType<L> | typeof Link;
style?: React.CSSProperties;
className?: string;
backText?: React.ReactNode;
redirect?: string;
}
class Exception extends React.Component<ExceptionProps, any> {
static defaultProps = {
backText: 'back to home',
redirect: '/',
};
constructor(props: ExceptionProps) {
super(props);
this.state = {};
}
render() {
const {
className,
backText,
linkElement = 'a',
type = '404',
title,
desc,
img,
actions,
redirect,
...rest
} = this.props;
const pageType = type in config ? type : '404';
const clsString = classNames(styles.exception, className);
return (
<div className={clsString} {...rest}>
<div className={styles.imgBlock}>
<div
className={styles.imgEle}
style={{ backgroundImage: `url(${img || config[pageType].img})` }}
/>
</div>
<div className={styles.content}>
<h1>{title || config[pageType].title}</h1>
<div className={styles.desc}>{desc || config[pageType].desc}</div>
<div className={styles.actions}>
{actions ||
createElement(
linkElement as any,
{
to: redirect,
href: redirect,
},
<Button type="primary">{backText}</Button>
)}
</div>
</div>
</div>
);
}
}
export default Exception;
---
title: Exception
subtitle: 异常
cols: 1
order: 5
---
异常页用于对页面特定的异常状态进行反馈。通常,它包含对错误状态的阐述,并向用户提供建议或操作,避免用户感到迷失和困惑。
## API
| 参数 | 说明| 类型 | 默认值 |
|-------------|------------------------------------------|-------------|-------|
| backText| 默认的返回按钮文本 | ReactNode| back to home |
| type| 页面类型,若配置,则自带对应类型默认的 `title``desc``img`,此默认设置可以被 `title``desc``img` 覆盖 | Enum {'403', '404', '500'} | - |
| title | 标题 | ReactNode| -|
| desc| 补充描述| ReactNode| -|
| img | 背景图片地址 | string| -|
| actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效| ReactNode| -|
| linkElement | 定义链接的元素 | string\|ReactElement | 'a' |
| redirect | 返回按钮的跳转地址 | string | '/'
interface Config {
403: {
img: string;
title: string;
desc: string;
};
404: {
img: string;
title: string;
desc: string;
};
500: {
img: string;
title: string;
desc: string;
};
}
const config: Config = {
403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403',
desc: '抱歉,你无权访问该页面',
},
404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404',
desc: '抱歉,你访问的页面不存在',
},
500: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500',
desc: '抱歉,服务器出错了',
},
};
export default config;
import React from 'react';
import { formatMessage } from 'umi/locale';
import { formatMessage } from 'umi-plugin-react/locale';
import Link from 'umi/link';
import { Exception } from 'ant-design-pro';
import Exception from './components/Exception';
const PAGE_NAME_UPPER_CAMEL_CASE = () => (
const PAGE_NAME_UPPER_CAMEL_CASE: React.FC = () => (
<Exception
type="404"
desc={formatMessage({ id: 'BLOCK_NAME.description.404' })}
linkElement={Link}
desc={formatMessage({ id: 'BLOCK_NAME.description.404' })}
backText={formatMessage({ id: 'BLOCK_NAME.exception.back' })}
/>
);
......
{
"name": "@umi-block/exception-500",
"name": "@pro-blocks/exception-500",
"version": "0.0.1",
"description": "Exception500",
"main": "src/index.js",
......@@ -8,18 +8,17 @@
},
"repository": {
"type": "git",
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/exception500"
"url": "https://github.com/ant-design/pro-blocks/tree/master/Exception500"
},
"dependencies": {
"react": "^16.6.3",
"ant-design-pro": "^2.1.1",
"dva": "^2.4.0",
"umi-request": "^1.0.0-beta.1"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
"license": "MIT"
}
---
order: 2
title:
zh-CN: 403 页面
en-US: 403 Page
---
## zh-CN
403 页面,配合自定义操作。
## en-US
403 page with custom operations.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
import { Button } from 'antd';
const actions = (
<div>
<Button type="primary">Home</Button>
<Button>Detail</Button>
</div>
);
ReactDOM.render(
<Exception type="403" actions={actions} />
, mountNode);
````
---
order: 0
title:
zh-CN: 404 页面
en-US: 404 Page
---
## zh-CN
404 页面。
## en-US
404 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="404" />
, mountNode);
````
---
order: 1
title:
zh-CN: 500 页面
en-US: 500 Page
---
## zh-CN
500 页面。
## en-US
500 page.
````jsx
import Exception from 'ant-design-pro/lib/Exception';
ReactDOM.render(
<Exception type="500" />
, mountNode);
````
---
title: Exception
cols: 1
order: 5
---
Exceptions page is used to provide feedback on specific abnormal state. Usually, it contains an explanation of the error status, and provides users with suggestions or operations, to prevent users from feeling lost and confused.
## API
Property | Description | Type | Default
---------|-------------|------|--------
| backText | default return button text | ReactNode | back to home |
type | type of exception, the corresponding default `title`, `desc`, `img` will be given if set, which can be overridden by explicit setting of `title`, `desc`, `img` | Enum {'403', '404', '500'} | -
title | title | ReactNode | -
desc | supplementary description | ReactNode | -
img | the url of background image | string | -
actions | suggested operations, a default 'Home' link will show if not set | ReactNode | -
linkElement | to specify the element of link | string\|ReactElement | 'a'
redirect | redirect path | string | '/'
\ No newline at end of file
@import '~antd/lib/style/themes/default.less';
.exception {
display: flex;
align-items: center;
height: 80%;
min-height: 500px;
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
padding-right: 152px;
zoom: 1;
&::before,
&::after {
content: ' ';
display: table;
}
&::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
}
}
.imgEle {
float: right;
width: 100%;
max-width: 430px;
height: 360px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
}
.content {
flex: auto;
h1 {
margin-bottom: 24px;
color: #434e59;
font-weight: 600;
font-size: 72px;
line-height: 72px;
}
.desc {
margin-bottom: 16px;
color: @text-color-secondary;
font-size: 20px;
line-height: 28px;
}
.actions {
button:not(:last-child) {
margin-right: 8px;
}
}
}
}
@media screen and (max-width: @screen-xl) {
.exception {
.imgBlock {
padding-right: 88px;
}
}
}
@media screen and (max-width: @screen-sm) {
.exception {
display: block;
text-align: center;
.imgBlock {
margin: 0 auto 24px;
padding-right: 0;
}
}
}
@media screen and (max-width: @screen-xs) {
.exception {
.imgBlock {
margin-bottom: -24px;
overflow: hidden;
}
}
}
import { Button } from 'antd';
import classNames from 'classnames';
import * as H from 'history';
import React, { createElement } from 'react';
import styles from './index.less';
import config from './typeConfig';
import Link from 'umi/link';
export interface ExceptionProps<
L = {
to: H.LocationDescriptor;
href?: H.LocationDescriptor;
replace?: boolean;
innerRef?: (node: HTMLAnchorElement | null) => void;
}
> {
type?: '403' | '404' | '500';
title?: React.ReactNode;
desc?: React.ReactNode;
img?: string;
actions?: React.ReactNode;
linkElement?: string | React.ComponentType<L> | typeof Link;
style?: React.CSSProperties;
className?: string;
backText?: React.ReactNode;
redirect?: string;
}
class Exception extends React.Component<ExceptionProps, any> {
static defaultProps = {
backText: 'back to home',
redirect: '/',
};
constructor(props: ExceptionProps) {
super(props);
this.state = {};
}
render() {
const {
className,
backText,
linkElement = 'a',
type = '404',
title,
desc,
img,
actions,
redirect,
...rest
} = this.props;
const pageType = type in config ? type : '404';
const clsString = classNames(styles.exception, className);
return (
<div className={clsString} {...rest}>
<div className={styles.imgBlock}>
<div
className={styles.imgEle}
style={{ backgroundImage: `url(${img || config[pageType].img})` }}
/>
</div>
<div className={styles.content}>
<h1>{title || config[pageType].title}</h1>
<div className={styles.desc}>{desc || config[pageType].desc}</div>
<div className={styles.actions}>
{actions ||
createElement(
linkElement as any,
{
to: redirect,
href: redirect,
},
<Button type="primary">{backText}</Button>
)}
</div>
</div>
</div>
);
}
}
export default Exception;
---
title: Exception
subtitle: 异常
cols: 1
order: 5
---
异常页用于对页面特定的异常状态进行反馈。通常,它包含对错误状态的阐述,并向用户提供建议或操作,避免用户感到迷失和困惑。
## API
| 参数 | 说明| 类型 | 默认值 |
|-------------|------------------------------------------|-------------|-------|
| backText| 默认的返回按钮文本 | ReactNode| back to home |
| type| 页面类型,若配置,则自带对应类型默认的 `title``desc``img`,此默认设置可以被 `title``desc``img` 覆盖 | Enum {'403', '404', '500'} | - |
| title | 标题 | ReactNode| -|
| desc| 补充描述| ReactNode| -|
| img | 背景图片地址 | string| -|
| actions | 建议操作,配置此属性时默认的『返回首页』按钮不生效| ReactNode| -|
| linkElement | 定义链接的元素 | string\|ReactElement | 'a' |
| redirect | 返回按钮的跳转地址 | string | '/'
interface Config {
403: {
img: string;
title: string;
desc: string;
};
404: {
img: string;
title: string;
desc: string;
};
500: {
img: string;
title: string;
desc: string;
};
}
const config: Config = {
403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403',
desc: '抱歉,你无权访问该页面',
},
404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404',
desc: '抱歉,你访问的页面不存在',
},
500: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500',
desc: '抱歉,服务器出错了',
},
};
export default config;
import React from 'react';
import { formatMessage } from 'umi/locale';
import { formatMessage } from 'umi-plugin-react/locale';
import Link from 'umi/link';
import { Exception } from 'ant-design-pro';
import Exception from './components/Exception';
const PAGE_NAME_UPPER_CAMEL_CASE = () => (
const PAGE_NAME_UPPER_CAMEL_CASE: React.FC = () => (
<Exception
type="500"
desc={formatMessage({ id: 'BLOCK_NAME.description.500' })}
......
......@@ -20,8 +20,8 @@
},
"devDependencies": {
"mockjs": "^1.0.1-beta3",
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -121,7 +121,9 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
<ActiveChart />
</Card>
<Card
title={<FormattedMessage id="BLOCK_NAME.monitor.efficiency" defaultMessage="Efficiency" />}
title={
<FormattedMessage id="BLOCK_NAME.monitor.efficiency" defaultMessage="Efficiency" />
}
style={{ marginBottom: 24 }}
bodyStyle={{ textAlign: 'center' }}
bordered={false}
......@@ -152,7 +154,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
animate={false}
percent={28}
subTitle={
<FormattedMessage id="BLOCK_NAME.monitor.fast-food" defaultMessage="Fast food" />
<FormattedMessage
id="BLOCK_NAME.monitor.fast-food"
defaultMessage="Fast food"
/>
}
total="28%"
height={128}
......@@ -220,7 +225,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
<WaterWave
height={161}
title={
<FormattedMessage id="BLOCK_NAME.monitor.fund-surplus" defaultMessage="Fund Surplus" />
<FormattedMessage
id="BLOCK_NAME.monitor.fund-surplus"
defaultMessage="Fund Surplus"
/>
}
percent={34}
/>
......
......@@ -16,8 +16,8 @@
"ant-design-pro": "^2.1.1"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -16,8 +16,8 @@
"ant-design-pro": "^2.1.1"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -23,8 +23,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
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, Input } from 'antd';
import {
Row,
Col,
Form,
Card,
Select,
Icon,
Avatar,
List,
Tooltip,
Dropdown,
Menu,
Input,
} from 'antd';
import { TagSelect } from 'ant-design-pro';
import StandardFormRow from './components/StandardFormRow';
......@@ -102,11 +115,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
);
return (
<PageHeaderWrapper
title="搜索列表"
content={mainSearch}
onTabChange={this.handleTabChange}
>
<PageHeaderWrapper title="搜索列表" content={mainSearch} onTabChange={this.handleTabChange}>
<div className={styles.filterCardList}>
<Card bordered={false}>
<Form layout="inline">
......@@ -181,7 +190,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
</Dropdown>,
]}
>
<Card.Meta avatar={<Avatar size="small" src={item.avatar} />} title={item.title} />
<Card.Meta
avatar={<Avatar size="small" src={item.avatar} />}
title={item.title}
/>
<div className={styles.cardItemContent}>
<CardInfo
activeUser={formatWan(item.activeUser)}
......
......@@ -20,8 +20,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -133,11 +133,7 @@ class SearchList extends Component {
);
return (
<PageHeaderWrapper
title="搜索列表"
content={mainSearch}
onTabChange={this.handleTabChange}
>
<PageHeaderWrapper title="搜索列表" content={mainSearch} onTabChange={this.handleTabChange}>
<Card bordered={false}>
<Form layout="inline">
<StandardFormRow title="所属类目" block style={{ paddingBottom: 11 }}>
......
......@@ -20,8 +20,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -107,11 +107,7 @@ class CoverCardList extends PureComponent {
);
return (
<PageHeaderWrapper
title="搜索列表"
content={mainSearch}
onTabChange={this.handleTabChange}
>
<PageHeaderWrapper title="搜索列表" content={mainSearch} onTabChange={this.handleTabChange}>
<div className={styles.coverCardList}>
<Card bordered={false}>
<Form layout="inline">
......
......@@ -19,8 +19,8 @@
"nzh": "^1.0.3"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -46,7 +46,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -42,7 +42,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -19,8 +19,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC"
......
......@@ -20,7 +20,7 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.3.0-beta.1"
},
......
......@@ -81,7 +81,9 @@ class LoginPage extends Component {
{status === 'error' &&
loginType === 'account' &&
!submitting &&
this.renderMessage(formatMessage({ id: 'BLOCK_NAME.login.message-invalid-credentials' }))}
this.renderMessage(
formatMessage({ id: 'BLOCK_NAME.login.message-invalid-credentials' })
)}
<UserName
name="userName"
placeholder={`${formatMessage({ id: 'BLOCK_NAME.login.userName' })}: admin or user`}
......
export default {
'BLOCK_NAME.login.userName': 'userName',
'BLOCK_NAME.login.password': 'password',
'BLOCK_NAME.login.message-invalid-credentials': 'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-credentials':
'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-verification-code': 'Invalid verification code',
'BLOCK_NAME.login.tab-login-credentials': 'Credentials',
'BLOCK_NAME.login.tab-login-mobile': 'Mobile number',
......@@ -60,7 +61,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
import { parse } from 'query-string'
import { parse } from 'query-string';
export function getPageQuery() {
return parse(window.location.href.split('?')[1]);
......
......@@ -21,8 +21,8 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "MIT"
......
......@@ -196,7 +196,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
},
],
})(
<Input size="large" placeholder={formatMessage({ id: 'BLOCK_NAME.email.placeholder' })} />
<Input
size="large"
placeholder={formatMessage({ id: 'BLOCK_NAME.email.placeholder' })}
/>
)}
</FormItem>
<FormItem help={help}>
......
export default {
'BLOCK_NAME.login.userName': 'userName',
'BLOCK_NAME.login.password': 'password',
'BLOCK_NAME.login.message-invalid-credentials': 'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-credentials':
'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-verification-code': 'Invalid verification code',
'BLOCK_NAME.login.tab-login-credentials': 'Credentials',
'BLOCK_NAME.login.tab-login-mobile': 'Mobile number',
......@@ -60,7 +61,8 @@ export default {
'BLOCK_NAME.client.placeholder':
'Please describe your customer service, internal customers directly @ Name / job number',
'BLOCK_NAME.invites.label': 'Inviting critics',
'BLOCK_NAME.invites.placeholder': 'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.invites.placeholder':
'Please direct @ Name / job number, you can invite up to 5 people',
'BLOCK_NAME.weight.label': 'Weight',
'BLOCK_NAME.weight.placeholder': 'Please enter weight',
'BLOCK_NAME.public.label': 'Target disclosure',
......
......@@ -16,8 +16,8 @@
"ant-design-pro": "^2.1.1"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi-plugin-react": "^1.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "MIT"
......
export default {
'BLOCK_NAME.login.userName': 'userName',
'BLOCK_NAME.login.password': 'password',
'BLOCK_NAME.login.message-invalid-credentials': 'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-credentials':
'Invalid username or password(admin/ant.design)',
'BLOCK_NAME.login.message-invalid-verification-code': 'Invalid verification code',
'BLOCK_NAME.login.tab-login-credentials': 'Credentials',
'BLOCK_NAME.login.tab-login-mobile': 'Mobile number',
......
......@@ -20,7 +20,7 @@
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.3.0-beta.1",
"umi": "^2.6.9",
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.3.0-beta.1"
},
......
......@@ -15,14 +15,15 @@ const prettierConfigPath = require.resolve('../.prettierrc');
let didError = false;
let files = [];
const jsFiles = glob.sync('ant-design-pro/**/*.js*', {
ignore: ['**/node_modules/**', 'build/**'],
const jsFiles = glob.sync('**/src/*.js*', {
ignore: ['**/node_modules/**', 'build/**', '**/.umi/**'],
});
const tsFiles = glob.sync('ant-design-pro/**/*.ts*', {
ignore: ['**/node_modules/**', 'build/**'],
const tsFiles = glob.sync('**/src/*.ts*', {
ignore: ['**/node_modules/**', 'build/**', '**/.umi/**'],
});
files = files.concat(jsFiles);
files = files.concat(tsFiles);
if (!files.length) {
return;
}
......
{
"private": true,
"scripts": {
"dev": "umi dev",
"dev": "PAGES_PATH='Exception500/src' umi dev",
"lint:style": "stylelint \"src/**/*.less\" --syntax less",
"lint": "eslint --ext .js src mock tests && npm run lint:style",
"lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style",
......@@ -10,6 +10,7 @@
"prettier": "node ./_scripts/prettier.js"
},
"devDependencies": {
"@types/classnames": "^2.2.7",
"babel-eslint": "^10.0.1",
"eslint": "^5.4.0",
"eslint-config-airbnb": "^17.0.0",
......@@ -28,7 +29,7 @@
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-standard": "^18.0.0",
"umi": "^2.3.0-0",
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-block-dev": "^1.3.1",
"umi-plugin-react": "^1.3.0-0"
},
"lint-staged": {
......
......@@ -22,11 +22,5 @@
}
},
"include": ["."],
"exclude": [
"node_modules",
"_scripts",
"jest",
"tslint:latest",
"tslint-config-prettier"
]
"exclude": ["node_modules", "_scripts", "jest", "tslint:latest", "tslint-config-prettier"]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment