Commit 84b5e90c authored by duanledexianxianxian's avatar duanledexianxianxian

fix eslint prettier config

parents 804969cf 49e1da77
const fabric = require('@umijs/fabric'); const fabric = require('@duanledexian/umi-config');
module.exports = { module.exports = {
...fabric.default, ...fabric.default,
rules: { rules: {
...fabric.default.rules, ...fabric.default.rules,
'import/no-extraneous-dependencies': [
2,
{
optionalDependencies: true,
devDependencies: ['**/tests/**.js', '/mock/**/**.js', '**/**.test.js', '**/**._mock.js'],
},
],
}, },
globals: { globals: {
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
......
puppeteer_download_host = https://npm.taobao.org/mirrors
\ No newline at end of file
const fabric = require('@umijs/fabric'); const fabric = require('@duanledexian/umi-config');
module.exports = { module.exports = {
...fabric.prettier, ...fabric.prettier,
......
const fabric = require('@umijs/fabric'); const fabric = require('@duanledexian/umi-config');
module.exports = { module.exports = {
...fabric.stylelint, ...fabric.stylelint,
......
import { IConfig, IPlugin } from 'umi-types'; import { IConfig, IPlugin } from 'umi-types';
import defaultSettings from './defaultSettings'; // https://umijs.org/config/ import defaultSettings from './defaultSettings'; // https://umijs.org/config/
import os from 'os';
import slash from 'slash2'; import slash from 'slash2';
import webpackPlugin from './plugin.config'; import webpackPlugin from './plugin.config';
const { pwa, primaryColor } = defaultSettings; // preview.pro.ant.design only do not use in your production ; const { pwa, primaryColor } = defaultSettings; // preview.pro.ant.design only do not use in your production ;
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION, TEST, NODE_ENV } = process.env;
const plugins: IPlugin[] = [ const plugins: IPlugin[] = [
[ [
'umi-plugin-react', 'umi-plugin-react',
...@@ -37,15 +37,10 @@ const plugins: IPlugin[] = [ ...@@ -37,15 +37,10 @@ const plugins: IPlugin[] = [
}, },
} }
: false, : false,
...(!TEST && os.platform() === 'darwin'
? {
dll: { dll: {
include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'], include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
exclude: ['@babel/runtime', 'netlify-lambda'], exclude: ['@babel/runtime', 'netlify-lambda'],
}, },
hardSource: false,
}
: {}),
}, },
], ],
[ [
...@@ -57,10 +52,10 @@ const plugins: IPlugin[] = [ ...@@ -57,10 +52,10 @@ const plugins: IPlugin[] = [
autoAddMenu: true, autoAddMenu: true,
}, },
], ],
]; // 针对 preview.pro.ant.design 的 GA 统计代码 ];
// preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { // 针对 preview.pro.ant.design 的 GA 统计代码
if (isAntDesignProPreview) {
plugins.push([ plugins.push([
'umi-plugin-ga', 'umi-plugin-ga',
{ {
...@@ -69,34 +64,17 @@ if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') { ...@@ -69,34 +64,17 @@ if (ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
]); ]);
} }
const uglifyJSOptions =
NODE_ENV === 'production'
? {
uglifyOptions: {
// remove console.* except console.error
compress: {
drop_console: true,
pure_funcs: ['console.error'],
},
},
}
: {};
export default { export default {
// add for transfer to umi
plugins, plugins,
define: {
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
},
block: { block: {
defaultGitUrl: 'https://github.com/ant-design/pro-blocks', defaultGitUrl: 'https://github.com/ant-design/pro-blocks',
}, },
treeShaking: true, hash: true,
targets: { targets: {
ie: 11, ie: 11,
}, },
devtool: ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION ? 'source-map' : false, devtool: isAntDesignProPreview ? 'source-map' : false,
// 路由配置 // umi routes: https://umijs.org/zh/guide/router.html
routes: [ routes: [
{ {
path: '/', path: '/',
...@@ -327,21 +305,23 @@ export default { ...@@ -327,21 +305,23 @@ export default {
}, },
], ],
}, },
{
component: './404',
},
], ],
}, },
{
component: './404',
},
], ],
// Theme for antd // Theme for antd: https://ant.design/docs/react/customize-theme-cn
// https://ant.design/docs/react/customize-theme-cn
theme: { theme: {
'primary-color': primaryColor, 'primary-color': primaryColor,
}, },
// proxy: { define: {
// '/server/api/': { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
// target: 'https://preview.pro.ant.design/', ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
// changeOrigin: true, },
// pathRewrite: { '^/server': '' },
// },
// },
ignoreMomentLocale: true, ignoreMomentLocale: true,
lessLoaderOptions: { lessLoaderOptions: {
javascriptEnabled: true, javascriptEnabled: true,
...@@ -353,8 +333,8 @@ export default { ...@@ -353,8 +333,8 @@ export default {
context: { context: {
resourcePath: string; resourcePath: string;
}, },
localIdentName: string, _: string,
localName: string localName: string,
) => { ) => {
if ( if (
context.resourcePath.includes('node_modules') || context.resourcePath.includes('node_modules') ||
...@@ -381,6 +361,14 @@ export default { ...@@ -381,6 +361,14 @@ export default {
manifest: { manifest: {
basePath: '/', basePath: '/',
}, },
uglifyJSOptions,
chainWebpack: webpackPlugin, chainWebpack: webpackPlugin,
/*
proxy: {
'/server/api/': {
target: 'https://preview.pro.ant.design/',
changeOrigin: true,
pathRewrite: { '^/server': '' },
},
},
*/
} as IConfig; } as IConfig;
...@@ -3,6 +3,6 @@ module.exports = { ...@@ -3,6 +3,6 @@ module.exports = {
preset: 'jest-puppeteer', preset: 'jest-puppeteer',
extraSetupFiles: ['./tests/setupTests.js'], extraSetupFiles: ['./tests/setupTests.js'],
globals: { globals: {
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。 ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false,
}, },
}; };
...@@ -94,16 +94,17 @@ ...@@ -94,16 +94,17 @@
}, },
"devDependencies": { "devDependencies": {
"@ant-design/colors": "^3.1.0", "@ant-design/colors": "^3.1.0",
"@duanledexian/umi-config": "^1.0.10",
"@types/classnames": "^2.2.7", "@types/classnames": "^2.2.7",
"@types/history": "^4.7.2", "@types/history": "^4.7.2",
"@types/jest": "^24.0.13", "@types/jest": "^24.0.13",
"@types/lodash": "^4.14.134", "@types/lodash": "^4.14.134",
"@types/mockjs": "^1.0.2",
"@types/numeral": "^0.0.25",
"@types/qs": "^6.5.3", "@types/qs": "^6.5.3",
"@types/react": "^16.8.19", "@types/react": "^16.8.19",
"@types/react-document-title": "^2.0.3", "@types/react-document-title": "^2.0.3",
"@types/react-dom": "^16.8.4", "@types/react-dom": "^16.8.4",
"@types/numeral":"^0.0.25",
"@umijs/fabric": "^1.0.5",
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"chalk": "^2.4.2", "chalk": "^2.4.2",
"check-prettier": "^1.0.3", "check-prettier": "^1.0.3",
...@@ -121,19 +122,17 @@ ...@@ -121,19 +122,17 @@
"jest-puppeteer": "^4.2.0", "jest-puppeteer": "^4.2.0",
"jsdom-global": "^3.0.2", "jsdom-global": "^3.0.2",
"lint-staged": "^8.1.7", "lint-staged": "^8.1.7",
"mockjs": "^1.0.1-beta3",
"netlify-lambda": "^1.4.13", "netlify-lambda": "^1.4.13",
"node-fetch": "^2.6.0", "node-fetch": "^2.6.0",
"prettier": "^1.17.1", "prettier": "^1.17.1",
"serverless-http": "^2.0.2", "serverless-http": "^2.0.2",
"slash2": "^2.0.0", "slash2": "^2.0.0",
"stylelint": "^10.1.0", "stylelint": "^10.1.0",
"webpack-theme-color-replacer": "^1.1.5", "umi-types": "^0.3.8",
"mockjs": "^1.0.1-beta3", "webpack-theme-color-replacer": "^1.1.5"
"@types/mockjs":"^1.0.2"
},
"optionalDependencies": {
"puppeteer": "^1.17.0"
}, },
"optionalDependencies": {},
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
}, },
......
...@@ -41,6 +41,9 @@ const findAllInstallRouter = router => { ...@@ -41,6 +41,9 @@ const findAllInstallRouter = router => {
const filterParentRouter = (router, layout) => { const filterParentRouter = (router, layout) => {
return [...router] return [...router]
.map(item => { .map(item => {
if (!item.path && item.component === '404') {
return item;
}
if (item.routes && (!router.component || layout)) { if (item.routes && (!router.component || layout)) {
return { ...item, routes: filterParentRouter(item.routes, false) }; return { ...item, routes: filterParentRouter(item.routes, false) };
} }
......
...@@ -19,6 +19,7 @@ export interface NoticeIconTabProps { ...@@ -19,6 +19,7 @@ export interface NoticeIconTabProps {
emptyText?: string; emptyText?: string;
clearText?: string; clearText?: string;
viewMoreText?: string; viewMoreText?: string;
list: NoticeIconData[];
onViewMore?: (e: any) => void; onViewMore?: (e: any) => void;
} }
const NoticeList: React.SFC<NoticeIconTabProps> = ({ const NoticeList: React.SFC<NoticeIconTabProps> = ({
......
...@@ -117,7 +117,7 @@ export default class NoticeIcon extends Component<NoticeIconProps> { ...@@ -117,7 +117,7 @@ export default class NoticeIcon extends Component<NoticeIconProps> {
}, },
); );
return ( return (
<Spin spinning={loading} delay={0}> <Spin spinning={loading} delay={300}>
<Tabs className={styles.tabs} onChange={this.onTabChange}> <Tabs className={styles.tabs} onChange={this.onTabChange}>
{panes} {panes}
</Tabs> </Tabs>
......
...@@ -7,6 +7,7 @@ import { queryNotices } from '@/services/user'; ...@@ -7,6 +7,7 @@ import { queryNotices } from '@/services/user';
export interface NoticeItem extends NoticeIconData { export interface NoticeItem extends NoticeIconData {
id: string; id: string;
type: string; type: string;
status: string;
} }
export interface GlobalModelState { export interface GlobalModelState {
......
import React from 'react';
import { Button } from 'antd';
import router from 'umi/router';
// 这里应该使用 antd 的 404 result 组件,
// 但是还没发布,先来个简单的。
const NoFoundPage: React.FC<{}> = () => (
<div
style={{
height: '100vh',
padding: 80,
textAlign: 'center',
}}
>
<img src="https://gw.alipayobjects.com/zos/antfincdn/wsE2Pw%243%26L/noFound.svg" alt="404" />
<br />
<br />
<h1>404</h1>
<p>Sorry, the page you visited does not exist.</p>
<Button type="primary" onClick={() => router.push('/')}>
Back Home
</Button>
</div>
);
export default NoFoundPage;
...@@ -14,7 +14,10 @@ const getRouteAuthority = (path: string, routeData: Route[]) => { ...@@ -14,7 +14,10 @@ const getRouteAuthority = (path: string, routeData: Route[]) => {
routeData.forEach(route => { routeData.forEach(route => {
// match prefix // match prefix
if (pathToRegexp(`${route.path}(.*)`).test(path)) { if (pathToRegexp(`${route.path}(.*)`).test(path)) {
// exact match
if (route.path === path) {
authorities = route.authority || authorities; authorities = route.authority || authorities;
}
// get children authority recursively // get children authority recursively
if (route.routes) { if (route.routes) {
authorities = getRouteAuthority(path, route.routes) || authorities; authorities = getRouteAuthority(path, route.routes) || authorities;
......
...@@ -24,7 +24,10 @@ const AvatarView = ({ avatar }: { avatar: string }) => ( ...@@ -24,7 +24,10 @@ const AvatarView = ({ avatar }: { avatar: string }) => (
<Upload fileList={[]}> <Upload fileList={[]}>
<div className={styles.button_view}> <div className={styles.button_view}>
<Button icon="upload"> <Button icon="upload">
<FormattedMessage id="account-settings.basic.change-avatar" defaultMessage="Change avatar" /> <FormattedMessage
id="account-settings.basic.change-avatar"
defaultMessage="Change avatar"
/>
</Button> </Button>
</div> </div>
</Upload> </Upload>
...@@ -207,7 +210,10 @@ class BaseView extends Component<BaseViewProps> { ...@@ -207,7 +210,10 @@ class BaseView extends Component<BaseViewProps> {
})(<PhoneView />)} })(<PhoneView />)}
</FormItem> </FormItem>
<Button type="primary" onClick={this.handlerSubmit}> <Button type="primary" onClick={this.handlerSubmit}>
<FormattedMessage id="account-settings.basic.update" defaultMessage="Update Information" /> <FormattedMessage
id="account-settings.basic.update"
defaultMessage="Update Information"
/>
</Button> </Button>
</Form> </Form>
</div> </div>
......
...@@ -17,12 +17,18 @@ class NotificationView extends Component { ...@@ -17,12 +17,18 @@ class NotificationView extends Component {
return [ return [
{ {
title: formatMessage({ id: 'account-settings.notification.password' }, {}), title: formatMessage({ id: 'account-settings.notification.password' }, {}),
description: formatMessage({ id: 'account-settings.notification.password-description' }, {}), description: formatMessage(
{ id: 'account-settings.notification.password-description' },
{},
),
actions: [Action], actions: [Action],
}, },
{ {
title: formatMessage({ id: 'account-settings.notification.messages' }, {}), title: formatMessage({ id: 'account-settings.notification.messages' }, {}),
description: formatMessage({ id: 'account-settings.notification.messages-description' }, {}), description: formatMessage(
{ id: 'account-settings.notification.messages-description' },
{},
),
actions: [Action], actions: [Action],
}, },
{ {
......
...@@ -30,18 +30,20 @@ interface SettingsState { ...@@ -30,18 +30,20 @@ interface SettingsState {
@connect(({ accountSettings }: { accountSettings: { currentUser: CurrentUser } }) => ({ @connect(({ accountSettings }: { accountSettings: { currentUser: CurrentUser } }) => ({
currentUser: accountSettings.currentUser, currentUser: accountSettings.currentUser,
})) }))
class Settings extends Component< class Settings extends Component<SettingsProps, SettingsState> {
SettingsProps,
SettingsState
> {
main: HTMLDivElement | undefined = undefined; main: HTMLDivElement | undefined = undefined;
constructor(props: SettingsProps) { constructor(props: SettingsProps) {
super(props); super(props);
const menuMap = { const menuMap = {
base: <FormattedMessage id="account-settings.menuMap.basic" defaultMessage="Basic Settings" />, base: (
<FormattedMessage id="account-settings.menuMap.basic" defaultMessage="Basic Settings" />
),
security: ( security: (
<FormattedMessage id="account-settings.menuMap.security" defaultMessage="Security Settings" /> <FormattedMessage
id="account-settings.menuMap.security"
defaultMessage="Security Settings"
/>
), ),
binding: ( binding: (
<FormattedMessage id="account-settings.menuMap.binding" defaultMessage="Account Binding" /> <FormattedMessage id="account-settings.menuMap.binding" defaultMessage="Account Binding" />
......
...@@ -24,12 +24,18 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -24,12 +24,18 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
<ChartCard <ChartCard
bordered={false} bordered={false}
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.total-sales" defaultMessage="Total Sales" /> <FormattedMessage
id="dashboard-analysis.analysis.total-sales"
defaultMessage="Total Sales"
/>
} }
action={ action={
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="Introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="Introduce"
/>
} }
> >
<Icon type="info-circle-o" /> <Icon type="info-circle-o" />
...@@ -40,7 +46,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -40,7 +46,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
footer={ footer={
<Field <Field
label={ label={
<FormattedMessage id="dashboard-analysis.analysis.day-sales" defaultMessage="Daily Sales" /> <FormattedMessage
id="dashboard-analysis.analysis.day-sales"
defaultMessage="Daily Sales"
/>
} }
value={`¥${numeral(12423).format('0,0')}`} value={`¥${numeral(12423).format('0,0')}`}
/> />
...@@ -66,7 +75,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -66,7 +75,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
action={ action={
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="Introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="Introduce"
/>
} }
> >
<Icon type="info-circle-o" /> <Icon type="info-circle-o" />
...@@ -76,7 +88,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -76,7 +88,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
footer={ footer={
<Field <Field
label={ label={
<FormattedMessage id="dashboard-analysis.analysis.day-visits" defaultMessage="Daily Visits" /> <FormattedMessage
id="dashboard-analysis.analysis.day-visits"
defaultMessage="Daily Visits"
/>
} }
value={numeral(1234).format('0,0')} value={numeral(1234).format('0,0')}
/> />
...@@ -90,11 +105,16 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -90,11 +105,16 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
<ChartCard <ChartCard
bordered={false} bordered={false}
loading={loading} loading={loading}
title={<FormattedMessage id="dashboard-analysis.analysis.payments" defaultMessage="Payments" />} title={
<FormattedMessage id="dashboard-analysis.analysis.payments" defaultMessage="Payments" />
}
action={ action={
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="Introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="Introduce"
/>
} }
> >
<Icon type="info-circle-o" /> <Icon type="info-circle-o" />
...@@ -130,7 +150,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -130,7 +150,10 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
action={ action={
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="Introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="Introduce"
/>
} }
> >
<Icon type="info-circle-o" /> <Icon type="info-circle-o" />
...@@ -140,11 +163,17 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis ...@@ -140,11 +163,17 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Vis
footer={ footer={
<div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}> <div style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
<Trend flag="up" style={{ marginRight: 16 }}> <Trend flag="up" style={{ marginRight: 16 }}>
<FormattedMessage id="dashboard-analysis.analysis.week" defaultMessage="Weekly Changes" /> <FormattedMessage
id="dashboard-analysis.analysis.week"
defaultMessage="Weekly Changes"
/>
<span className={styles.trendText}>12%</span> <span className={styles.trendText}>12%</span>
</Trend> </Trend>
<Trend flag="down"> <Trend flag="down">
<FormattedMessage id="dashboard-analysis.analysis.day" defaultMessage="Weekly Changes" /> <FormattedMessage
id="dashboard-analysis.analysis.day"
defaultMessage="Weekly Changes"
/>
<span className={styles.trendText}>11%</span> <span className={styles.trendText}>11%</span>
</Trend> </Trend>
</div> </div>
......
...@@ -59,7 +59,9 @@ const ProportionSales = ({ ...@@ -59,7 +59,9 @@ const ProportionSales = ({
</h4> </h4>
<Pie <Pie
hasLegend hasLegend
subTitle={<FormattedMessage id="dashboard-analysis.analysis.sales" defaultMessage="Sales" />} subTitle={
<FormattedMessage id="dashboard-analysis.analysis.sales" defaultMessage="Sales" />
}
total={() => <Yuan>{salesPieData.reduce((pre, now) => now.y + pre, 0)}</Yuan>} total={() => <Yuan>{salesPieData.reduce((pre, now) => now.y + pre, 0)}</Yuan>}
data={salesPieData} data={salesPieData}
valueFormat={value => <Yuan>{value}</Yuan>} valueFormat={value => <Yuan>{value}</Yuan>}
......
...@@ -41,16 +41,28 @@ const SalesCard = ({ ...@@ -41,16 +41,28 @@ const SalesCard = ({
<div className={styles.salesExtraWrap}> <div className={styles.salesExtraWrap}>
<div className={styles.salesExtra}> <div className={styles.salesExtra}>
<a className={isActive('today')} onClick={() => selectDate('today')}> <a className={isActive('today')} onClick={() => selectDate('today')}>
<FormattedMessage id="dashboard-analysis.analysis.all-day" defaultMessage="All Day" /> <FormattedMessage
id="dashboard-analysis.analysis.all-day"
defaultMessage="All Day"
/>
</a> </a>
<a className={isActive('week')} onClick={() => selectDate('week')}> <a className={isActive('week')} onClick={() => selectDate('week')}>
<FormattedMessage id="dashboard-analysis.analysis.all-week" defaultMessage="All Week" /> <FormattedMessage
id="dashboard-analysis.analysis.all-week"
defaultMessage="All Week"
/>
</a> </a>
<a className={isActive('month')} onClick={() => selectDate('month')}> <a className={isActive('month')} onClick={() => selectDate('month')}>
<FormattedMessage id="dashboard-analysis.analysis.all-month" defaultMessage="All Month" /> <FormattedMessage
id="dashboard-analysis.analysis.all-month"
defaultMessage="All Month"
/>
</a> </a>
<a className={isActive('year')} onClick={() => selectDate('year')}> <a className={isActive('year')} onClick={() => selectDate('year')}>
<FormattedMessage id="dashboard-analysis.analysis.all-year" defaultMessage="All Year" /> <FormattedMessage
id="dashboard-analysis.analysis.all-year"
defaultMessage="All Year"
/>
</a> </a>
</div> </div>
<RangePicker <RangePicker
......
...@@ -17,7 +17,10 @@ const columns = [ ...@@ -17,7 +17,10 @@ const columns = [
}, },
{ {
title: ( title: (
<FormattedMessage id="dashboard-analysis.table.search-keyword" defaultMessage="Search keyword" /> <FormattedMessage
id="dashboard-analysis.table.search-keyword"
defaultMessage="Search keyword"
/>
), ),
dataIndex: 'keyword', dataIndex: 'keyword',
key: 'keyword', key: 'keyword',
...@@ -31,7 +34,9 @@ const columns = [ ...@@ -31,7 +34,9 @@ const columns = [
className: styles.alignRight, className: styles.alignRight,
}, },
{ {
title: <FormattedMessage id="dashboard-analysis.table.weekly-range" defaultMessage="Weekly Range" />, title: (
<FormattedMessage id="dashboard-analysis.table.weekly-range" defaultMessage="Weekly Range" />
),
dataIndex: 'range', dataIndex: 'range',
key: 'range', key: 'range',
sorter: (a: { range: number }, b: { range: number }) => a.range - b.range, sorter: (a: { range: number }, b: { range: number }) => a.range - b.range,
...@@ -79,7 +84,10 @@ const TopSearch = ({ ...@@ -79,7 +84,10 @@ const TopSearch = ({
/> />
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="introduce"
/>
} }
> >
<Icon style={{ marginLeft: 8 }} type="info-circle-o" /> <Icon style={{ marginLeft: 8 }} type="info-circle-o" />
...@@ -103,7 +111,10 @@ const TopSearch = ({ ...@@ -103,7 +111,10 @@ const TopSearch = ({
/> />
<Tooltip <Tooltip
title={ title={
<FormattedMessage id="dashboard-analysis.analysis.introduce" defaultMessage="introduce" /> <FormattedMessage
id="dashboard-analysis.analysis.introduce"
defaultMessage="introduce"
/>
} }
> >
<Icon style={{ marginLeft: 8 }} type="info-circle-o" /> <Icon style={{ marginLeft: 8 }} type="info-circle-o" />
......
...@@ -71,7 +71,10 @@ class BasicForm extends Component<BasicFormProps> { ...@@ -71,7 +71,10 @@ class BasicForm extends Component<BasicFormProps> {
<PageHeaderWrapper content={<FormattedMessage id="form-basic-form.basic.description" />}> <PageHeaderWrapper content={<FormattedMessage id="form-basic-form.basic.description" />}>
<Card bordered={false}> <Card bordered={false}>
<Form onSubmit={this.handleSubmit} hideRequiredMark style={{ marginTop: 8 }}> <Form onSubmit={this.handleSubmit} hideRequiredMark style={{ marginTop: 8 }}>
<FormItem {...formItemLayout} label={<FormattedMessage id="form-basic-form.title.label" />}> <FormItem
{...formItemLayout}
label={<FormattedMessage id="form-basic-form.title.label" />}
>
{getFieldDecorator('title', { {getFieldDecorator('title', {
rules: [ rules: [
{ {
...@@ -79,9 +82,14 @@ class BasicForm extends Component<BasicFormProps> { ...@@ -79,9 +82,14 @@ class BasicForm extends Component<BasicFormProps> {
message: formatMessage({ id: 'form-basic-form.title.required' }), message: formatMessage({ id: 'form-basic-form.title.required' }),
}, },
], ],
})(<Input placeholder={formatMessage({ id: 'form-basic-form.title.placeholder' })} />)} })(
<Input placeholder={formatMessage({ id: 'form-basic-form.title.placeholder' })} />,
)}
</FormItem> </FormItem>
<FormItem {...formItemLayout} label={<FormattedMessage id="form-basic-form.date.label" />}> <FormItem
{...formItemLayout}
label={<FormattedMessage id="form-basic-form.date.label" />}
>
{getFieldDecorator('date', { {getFieldDecorator('date', {
rules: [ rules: [
{ {
...@@ -99,7 +107,10 @@ class BasicForm extends Component<BasicFormProps> { ...@@ -99,7 +107,10 @@ class BasicForm extends Component<BasicFormProps> {
/>, />,
)} )}
</FormItem> </FormItem>
<FormItem {...formItemLayout} label={<FormattedMessage id="form-basic-form.goal.label" />}> <FormItem
{...formItemLayout}
label={<FormattedMessage id="form-basic-form.goal.label" />}
>
{getFieldDecorator('goal', { {getFieldDecorator('goal', {
rules: [ rules: [
{ {
...@@ -164,7 +175,9 @@ class BasicForm extends Component<BasicFormProps> { ...@@ -164,7 +175,9 @@ class BasicForm extends Component<BasicFormProps> {
} }
> >
{getFieldDecorator('invites')( {getFieldDecorator('invites')(
<Input placeholder={formatMessage({ id: 'form-basic-form.invites.placeholder' })} />, <Input
placeholder={formatMessage({ id: 'form-basic-form.invites.placeholder' })}
/>,
)} )}
</FormItem> </FormItem>
<FormItem <FormItem
......
...@@ -59,10 +59,7 @@ interface BasicListState { ...@@ -59,10 +59,7 @@ interface BasicListState {
loading: loading.models.listBasicList, loading: loading.models.listBasicList,
}), }),
) )
class BasicList extends Component< class BasicList extends Component<BasicListProps, BasicListState> {
BasicListProps,
BasicListState
> {
state: BasicListState = { visible: false, done: false, current: undefined }; state: BasicListState = { visible: false, done: false, current: undefined };
formLayout = { formLayout = {
......
...@@ -35,10 +35,7 @@ interface CardListState { ...@@ -35,10 +35,7 @@ interface CardListState {
loading: loading.models.list, loading: loading.models.list,
}), }),
) )
class CardList extends Component< class CardList extends Component<CardListProps, CardListState> {
CardListProps,
CardListState
> {
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
......
...@@ -28,12 +28,10 @@ for (let i = 0; i < 8; i += 1) { ...@@ -28,12 +28,10 @@ for (let i = 0; i < 8; i += 1) {
function getRule( function getRule(
req: { url: any }, req: { url: any },
res: { res: {
json: ( json: (arg0: {
arg0: {
list: TableListItem[]; list: TableListItem[];
pagination: { total: number; pageSize: number; current: number }; pagination: { total: number; pageSize: number; current: number };
}, }) => void;
) => void;
}, },
u: any, u: any,
) { ) {
......
...@@ -7,11 +7,7 @@ const FormItem = Form.Item; ...@@ -7,11 +7,7 @@ const FormItem = Form.Item;
interface CreateFormProps extends FormComponentProps { interface CreateFormProps extends FormComponentProps {
modalVisible: boolean; modalVisible: boolean;
handleAdd: ( handleAdd: (fieldsValue: { desc: string }) => void;
fieldsValue: {
desc: string;
},
) => void;
handleModalVisible: () => void; handleModalVisible: () => void;
} }
const CreateForm: React.SFC<CreateFormProps> = props => { const CreateForm: React.SFC<CreateFormProps> = props => {
......
...@@ -65,10 +65,7 @@ interface BasicState { ...@@ -65,10 +65,7 @@ interface BasicState {
loading: loading.effects['profileBasic/fetchBasic'], loading: loading.effects['profileBasic/fetchBasic'],
}), }),
) )
class Basic extends Component< class Basic extends Component<BasicProps, BasicState> {
BasicProps,
BasicState
> {
componentDidMount() { componentDidMount() {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
......
...@@ -64,7 +64,10 @@ const extra = ( ...@@ -64,7 +64,10 @@ const extra = (
<Step <Step
title={ title={
<span style={{ fontSize: 14 }}> <span style={{ fontSize: 14 }}>
<FormattedMessage id="result-success.success.step1-title" defaultMessage="Create project" /> <FormattedMessage
id="result-success.success.step1-title"
defaultMessage="Create project"
/>
</span> </span>
} }
description={desc1} description={desc1}
......
...@@ -45,10 +45,7 @@ export interface FromDataType { ...@@ -45,10 +45,7 @@ export interface FromDataType {
submitting: loading.effects['userLogin/login'], submitting: loading.effects['userLogin/login'],
}), }),
) )
class Login extends Component< class Login extends Component<LoginProps, LoginState> {
LoginProps,
LoginState
> {
loginForm: FormComponentProps['form'] | undefined | null = undefined; loginForm: FormComponentProps['form'] | undefined | null = undefined;
state: LoginState = { state: LoginState = {
......
...@@ -21,6 +21,13 @@ declare module 'nzh/cn'; ...@@ -21,6 +21,13 @@ declare module 'nzh/cn';
declare module 'webpack-theme-color-replacer'; declare module 'webpack-theme-color-replacer';
declare module 'webpack-theme-color-replacer/client'; declare module 'webpack-theme-color-replacer/client';
// src/typings.d.ts
declare module 'umi-plugin-react/locale' {
export default interface MessageDescriptor {
id: string;
} /* eslint-disable-line */
}
declare let ga: Function; declare let ga: Function;
// preview.pro.ant.design only do not use in your production ; // preview.pro.ant.design only do not use in your production ;
......
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