Commit a6f14781 authored by 陈帅's avatar 陈帅

fix all eslint-error

parent 7306558b
This diff is collapsed.
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
const titles = [
'Alipay',
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { City, CurrentUser, Province } from './data';
import { CityType, CurrentUser, ProvinceType } from './data.d';
import { queryCity, queryCurrent, queryProvince, query as queryUsers } from './service';
export interface ModalState {
currentUser?: Partial<CurrentUser>;
province?: Province[];
city?: City[];
province?: ProvinceType[];
city?: CityType[];
isLoading?: boolean;
}
......
......@@ -21,13 +21,14 @@
"numeral": "^2.0.6",
"react": "^16.6.3",
"react-fittext": "^1.0.0",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"@types/numeral": "^0.0.25",
"umi": "^2.6.9",
"umi-plugin-block-dev": "^1.1.0",
"umi-plugin-react": "^1.7.2",
"@types/numeral": "^0.0.25"
"umi-plugin-react": "^1.7.2"
},
"blockConfig": {
"specVersion": "0.1"
......
import moment from 'moment';
import { IAnalysisData, IRadarData, IVisitData } from './data';
import { IAnalysisData, IRadarData, IVisitData } from './data.d';
// mock data
const visitData: IVisitData[] = [];
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { IAnalysisData } from './data';
import { IAnalysisData } from './data.d';
import { fakeChartData } from './service';
export type Effect = (
......
......@@ -12,12 +12,15 @@
"dev": "umi dev"
},
"dependencies": {
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"classnames": "^2.2.6",
"dva": "^2.4.0",
"hash.js": "^1.1.5",
"moment": "^2.22.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
......
import { BasicListItemDataType } from './data';
import { BasicListItemDataType } from './data.d';
const titles = [
'Alipay',
......
......@@ -25,7 +25,7 @@ import { connect } from 'dva';
import { findDOMNode } from 'react-dom';
import moment from 'moment';
import Result from './Result';
import { IStateType } from './model';
import { StateType } from './model';
import { BasicListItemDataType } from './data.d';
import styles from './style.less';
......@@ -36,7 +36,7 @@ const SelectOption = Select.Option;
const { Search, TextArea } = Input;
interface PAGE_NAME_UPPER_CAMEL_CASEProps extends FormComponentProps {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
dispatch: Dispatch<any>;
loading: boolean;
}
......@@ -50,7 +50,7 @@ interface PAGE_NAME_UPPER_CAMEL_CASEState {
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: {
models: { [key: string]: boolean };
};
......@@ -70,8 +70,6 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
wrapperCol: { span: 13 },
};
addBtn: HTMLButtonElement | undefined | null;
componentDidMount() {
const { dispatch } = this.props;
dispatch({
......@@ -138,6 +136,8 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
});
};
addBtn: HTMLButtonElement | undefined | null;
render() {
const {
BLOCK_NAME_CAMEL_CASE: { list },
......@@ -322,6 +322,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
icon="plus"
onClick={this.showModal}
ref={component => {
// eslint-disable-next-line react/no-find-dom-node
this.addBtn = findDOMNode(component) as HTMLButtonElement;
}}
>
......
......@@ -2,28 +2,28 @@ import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { addFakeList, queryFakeList, removeFakeList, updateFakeList } from './service';
import { BasicListItemDataType } from './data';
import { BasicListItemDataType } from './data.d';
export interface IStateType {
export interface StateType {
list: BasicListItemDataType[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
appendFetch: Effect;
submit: Effect;
};
reducers: {
queryList: Reducer<IStateType>;
appendList: Reducer<IStateType>;
queryList: Reducer<StateType>;
appendList: Reducer<StateType>;
};
}
......
import request from 'umi-request';
import { BasicListItemDataType } from './data';
import { BasicListItemDataType } from './data.d';
interface ParamsType extends Partial<BasicListItemDataType> {
count?: number;
......
......@@ -11,15 +11,17 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/cardlist"
},
"dependencies": {
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"dva": "^2.4.0",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
import { CardListItemDataType } from './data';
import { CardListItemDataType } from './data.d';
const titles = [
'Alipay',
......
......@@ -4,14 +4,14 @@ import React, { Component } from 'react';
import { Dispatch } from 'redux';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { connect } from 'dva';
import { IStateType } from './model';
import { CardListItemDataType } from './data';
import { StateType } from './model';
import { CardListItemDataType } from './data.d';
import styles from './style.less';
const { Paragraph } = Typography;
interface PAGE_NAME_UPPER_CAMEL_CASEProps {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
dispatch: Dispatch<any>;
loading: boolean;
}
......@@ -26,7 +26,7 @@ interface PAGE_NAME_UPPER_CAMEL_CASEState {
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: {
models: { [key: string]: boolean };
};
......@@ -86,42 +86,45 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
/>
</div>
);
const nullData = {} as CardListItemDataType;
const nullData: Partial<CardListItemDataType> = {};
return (
<PageHeaderWrapper content={content} extraContent={extraContent}>
<div className={styles.cardList}>
<List
<List<Partial<CardListItemDataType>>
rowKey="id"
loading={loading}
grid={{ gutter: 24, lg: 3, md: 2, sm: 1, xs: 1 }}
dataSource={[nullData, ...list]}
renderItem={item =>
item && item.id ? (
<List.Item key={item.id}>
<Card
hoverable
className={styles.card}
actions={[<a key="option1">操作一</a>, <a key="option2">操作二</a>]}
>
<Card.Meta
avatar={<img alt="" className={styles.cardAvatar} src={item.avatar} />}
title={<a>{item.title}</a>}
description={
<Paragraph className={styles.item} ellipsis={{ rows: 3 }}>
{item.description}
</Paragraph>
}
/>
</Card>
</List.Item>
) : (
renderItem={item => {
if (item && item.id) {
return (
<List.Item key={item.id}>
<Card
hoverable
className={styles.card}
actions={[<a key="option1">操作一</a>, <a key="option2">操作二</a>]}
>
<Card.Meta
avatar={<img alt="" className={styles.cardAvatar} src={item.avatar} />}
title={<a>{item.title}</a>}
description={
<Paragraph className={styles.item} ellipsis={{ rows: 3 }}>
{item.description}
</Paragraph>
}
/>
</Card>
</List.Item>
);
}
return (
<List.Item>
<Button type="dashed" className={styles.newButton}>
<Icon type="plus" /> 新增产品
</Button>
</List.Item>
)
}
);
}}
/>
</div>
</PageHeaderWrapper>
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { CardListItemDataType } from './data';
import { CardListItemDataType } from './data.d';
import { queryFakeList } from './service';
export interface IStateType {
export interface StateType {
list: CardListItemDataType[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
};
reducers: {
queryList: Reducer<IStateType>;
queryList: Reducer<StateType>;
};
}
......
......@@ -11,6 +11,7 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistapplications"
},
"dependencies": {
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"classnames": "^2.2.6",
"dva": "^2.4.0",
......@@ -23,8 +24,8 @@
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
......@@ -19,12 +19,13 @@
"numeral": "^2.0.6",
"nzh": "^1.0.3",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
const titles = [
'Alipay',
......
......@@ -5,8 +5,8 @@ import { Dispatch } from 'redux';
import { FormComponentProps } from 'antd/es/form';
import { connect } from 'dva';
import numeral from 'numeral';
import { IStateType } from './model';
import { ListItemDataType } from './data';
import { StateType } from './model';
import { ListItemDataType } from './data.d';
import StandardFormRow from './components/StandardFormRow';
import TagSelect from './components/TagSelect';
import styles from './style.less';
......@@ -42,7 +42,7 @@ export function formatWan(val: number) {
interface PAGE_NAME_UPPER_CAMEL_CASEProps extends FormComponentProps {
dispatch: Dispatch<any>;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: boolean;
}
......@@ -217,7 +217,7 @@ export default connect(
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: { models: { [key: string]: boolean } };
}) => ({
BLOCK_NAME_CAMEL_CASE,
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
import { queryFakeList } from './service';
export interface IStateType {
export interface StateType {
list: ListItemDataType[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
};
reducers: {
queryList: Reducer<IStateType>;
queryList: Reducer<StateType>;
};
}
......
import request from 'umi-request';
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
export async function queryFakeList(params: ListItemDataType) {
return request('/api/fake_list', {
......
......@@ -16,12 +16,13 @@
"dva": "^2.4.0",
"moment": "^2.22.2",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
const titles = [
'Alipay',
......
......@@ -5,8 +5,8 @@ import { Dispatch } from 'redux';
import { FormComponentProps } from 'antd/es/form';
import { connect } from 'dva';
import ArticleListContent from './components/ArticleListContent';
import { IStateType } from './model';
import { ListItemDataType } from './data';
import { StateType } from './model';
import { ListItemDataType } from './data.d';
import StandardFormRow from './components/StandardFormRow';
import TagSelect from './components/TagSelect';
import styles from './style.less';
......@@ -18,7 +18,7 @@ const pageSize = 5;
interface PAGE_NAME_UPPER_CAMEL_CASEProps extends FormComponentProps {
dispatch: Dispatch<any>;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: boolean;
}
......@@ -252,7 +252,7 @@ export default connect(
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: { models: { [key: string]: boolean } };
}) => ({
BLOCK_NAME_CAMEL_CASE,
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
import { queryFakeList } from './service';
export interface IStateType {
export interface StateType {
list: ListItemDataType[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
appendFetch: Effect;
};
reducers: {
queryList: Reducer<IStateType>;
appendList: Reducer<IStateType>;
queryList: Reducer<StateType>;
appendList: Reducer<StateType>;
};
}
......@@ -60,7 +60,7 @@ const Model: ModelType = {
appendList(state, action) {
return {
...state,
list: state!.list.concat(action.payload),
list: (state as StateType).list.concat(action.payload),
};
},
},
......
import request from 'umi-request';
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
export async function queryFakeList(params: ListItemDataType) {
return request('/api/fake_list', {
......
......@@ -16,12 +16,13 @@
"dva": "^2.4.0",
"moment": "^2.22.2",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
const titles = [
'Alipay',
......
......@@ -6,8 +6,8 @@ import { FormComponentProps } from 'antd/es/form';
import { connect } from 'dva';
import moment from 'moment';
import AvatarList from './components/AvatarList';
import { IStateType } from './model';
import { ListItemDataType } from './data';
import { StateType } from './model';
import { ListItemDataType } from './data.d';
import StandardFormRow from './components/StandardFormRow';
import TagSelect from './components/TagSelect';
import styles from './style.less';
......@@ -18,7 +18,7 @@ const { Paragraph } = Typography;
interface PAGE_NAME_UPPER_CAMEL_CASEProps extends FormComponentProps {
dispatch: Dispatch<any>;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: boolean;
}
......@@ -66,9 +66,9 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<PAGE_NAME_UPPER_CAMEL_CASEPro
<span>{moment(item.updatedAt).fromNow()}</span>
<div className={styles.avatarList}>
<AvatarList size="small">
{item.members.map((member, i) => (
{item.members.map(member => (
<AvatarList.Item
key={`${item.id}-avatar-${i}`}
key={`${item.id}-avatar`}
src={member.avatar}
tips={member.name}
/>
......@@ -162,7 +162,7 @@ export default connect(
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: { models: { [key: string]: boolean } };
}) => ({
BLOCK_NAME_CAMEL_CASE,
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { ListItemDataType } from './data';
import { ListItemDataType } from './data.d';
import { queryFakeList } from './service';
export interface IStateType {
export interface StateType {
list: ListItemDataType[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
};
reducers: {
queryList: Reducer<IStateType>;
queryList: Reducer<StateType>;
};
}
......
......@@ -11,16 +11,18 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/tablelist"
},
"dependencies": {
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"dva": "^2.4.0",
"moment": "^2.22.2",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
import { parse } from 'url';
import { TableListItem, TableListParams } from './data';
import { TableListItem, TableListParams } from './data.d';
// mock tableListDataSource
let tableListDataSource: TableListItem[] = [];
......@@ -39,7 +39,8 @@ function getRule(
) {
let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
url = req.url; // eslint-disable-line
// eslint-disable-next-line prefer-destructuring
url = req.url;
}
const params = (parse(url, true).query as unknown) as TableListParams;
......@@ -101,7 +102,8 @@ function postRule(
) {
let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
url = req.url; // eslint-disable-line
// eslint-disable-next-line prefer-destructuring
url = req.url;
}
const body = (b && b.body) || req.body;
......
import { Alert, Table } from 'antd';
import { ColumnProps, SorterResult, TableProps } from 'antd/es/table';
import { ColumnProps, TableRowSelection, TableProps } from 'antd/es/table';
import React, { Component, Fragment } from 'react';
import { TableListItem } from '../../data';
import { TableListItem } from '../../data.d';
import styles from './index.less';
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
......@@ -17,10 +17,10 @@ export interface StandardTableProps<T> extends Omit<TableProps<T>, 'columns'> {
onSelectRow: (rows: any) => void;
}
export type StandardTableColumnProps = ColumnProps<TableListItem> & {
export interface StandardTableColumnProps extends ColumnProps<TableListItem> {
needTotal?: boolean;
total?: number;
};
}
function initTotalList(columns: StandardTableColumnProps[]) {
if (!columns) {
......@@ -64,24 +64,28 @@ class StandardTable extends Component<StandardTableProps<TableListItem>, Standar
};
}
handleRowSelectChange = (selectedRowKeys: string[], selectedRows: TableListItem[]) => {
handleRowSelectChange: TableRowSelection<TableListItem>['onChange'] = (
selectedRowKeys,
selectedRows: TableListItem[],
) => {
const currySelectedRowKeys = selectedRowKeys as string[];
let { needTotalList } = this.state;
needTotalList = needTotalList.map(item => ({
...item,
total: selectedRows.reduce((sum, val) => sum + parseFloat(val[item.dataIndex], 10), 0),
total: selectedRows.reduce((sum, val) => sum + parseFloat(val[item.dataIndex || 0]), 0),
}));
const { onSelectRow } = this.props;
if (onSelectRow) {
onSelectRow(selectedRows);
}
this.setState({ selectedRowKeys, needTotalList });
this.setState({ selectedRowKeys: currySelectedRowKeys, needTotalList });
};
handleTableChange = (
pagination: StandardTableProps<TableListItem>['pagination'],
filters: Record<keyof TableListItem, string[]>,
sorter: SorterResult<TableListItem>,
handleTableChange: TableProps<TableListItem>['onChange'] = (
pagination,
filters,
sorter,
...rest
) => {
const { onChange } = this.props;
......@@ -91,7 +95,9 @@ class StandardTable extends Component<StandardTableProps<TableListItem>, Standar
};
cleanSelectedKeys = () => {
this.handleRowSelectChange([], []);
if (this.handleRowSelectChange) {
this.handleRowSelectChange([], []);
}
};
render() {
......@@ -105,7 +111,7 @@ class StandardTable extends Component<StandardTableProps<TableListItem>, Standar
...pagination,
};
const rowSelection = {
const rowSelection: TableRowSelection<TableListItem> = {
selectedRowKeys,
onChange: this.handleRowSelectChange,
getCheckboxProps: (record: TableListItem) => ({
......
......@@ -2,19 +2,19 @@ import { Button, DatePicker, Form, Input, Modal, Radio, Select, Steps } from 'an
import React, { Component } from 'react';
import { FormComponentProps } from 'antd/es/form';
import { TableListItem } from '../data';
import { TableListItem } from '../data.d';
export type IFormValsType = {
export interface FormValsType extends Partial<TableListItem> {
target?: string;
template?: string;
type?: string;
time?: string;
frequency?: string;
} & Partial<TableListItem>;
}
export interface UpdateFormProps extends FormComponentProps {
handleUpdateModalVisible: (flag?: boolean, formVals?: IFormValsType) => void;
handleUpdate: (values: IFormValsType) => void;
handleUpdateModalVisible: (flag?: boolean, formVals?: FormValsType) => void;
handleUpdate: (values: FormValsType) => void;
updateModalVisible: boolean;
values: Partial<TableListItem>;
}
......@@ -25,7 +25,7 @@ const { Option } = Select;
const RadioGroup = Radio.Group;
export interface UpdateFormState {
formVals: IFormValsType;
formVals: FormValsType;
currentStep: number;
}
......@@ -94,7 +94,7 @@ class UpdateForm extends Component<UpdateFormProps, UpdateFormState> {
});
};
renderContent = (currentStep: number, formVals: IFormValsType) => {
renderContent = (currentStep: number, formVals: FormValsType) => {
const { form } = this.props;
if (currentStep === 1) {
return [
......
......@@ -23,11 +23,12 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { SorterResult } from 'antd/es/table';
import { connect } from 'dva';
import moment from 'moment';
import { IStateType } from './model';
import { StateType } from './model';
import CreateForm from './components/CreateForm';
import UpdateForm, { IFormValsType } from './components/UpdateForm';
import { TableListItem, TableListPagination, TableListParams } from './data';
import StandardTable, { StandardTableColumnProps } from './components/StandardTable';
import UpdateForm, { FormValsType } from './components/UpdateForm';
import { TableListItem, TableListPagination, TableListParams } from './data.d';
import styles from './style.less';
const FormItem = Form.Item;
......@@ -44,7 +45,7 @@ const status = ['关闭', '运行中', '已上线', '异常'];
interface TableListProps extends FormComponentProps {
dispatch: Dispatch<any>;
loading: boolean;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
}
interface TableListState {
......@@ -62,7 +63,7 @@ interface TableListState {
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: {
models: {
[key: string]: boolean;
......@@ -260,7 +261,7 @@ class TableList extends Component<TableListProps, TableListState> {
});
};
handleUpdateModalVisible = (flag?: boolean, record?: IFormValsType) => {
handleUpdateModalVisible = (flag?: boolean, record?: FormValsType) => {
this.setState({
updateModalVisible: !!flag,
stepFormValues: record || {},
......@@ -280,7 +281,7 @@ class TableList extends Component<TableListProps, TableListState> {
this.handleModalVisible();
};
handleUpdate = (fields: IFormValsType) => {
handleUpdate = (fields: FormValsType) => {
const { dispatch } = this.props;
dispatch({
type: 'BLOCK_NAME_CAMEL_CASE/update',
......
......@@ -2,20 +2,20 @@ import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { addRule, queryRule, removeRule, updateRule } from './service';
import { TableListDate } from './data';
import { TableListDate } from './data.d';
export interface IStateType {
export interface StateType {
data: TableListDate;
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetch: Effect;
add: Effect;
......@@ -23,7 +23,7 @@ export interface ModelType {
update: Effect;
};
reducers: {
save: Reducer<IStateType>;
save: Reducer<StateType>;
};
}
......
import request from 'umi-request';
import { TableListParams } from './data';
import { TableListParams } from './data.d';
export async function queryRule(params: TableListParams) {
return request('/api/rule', {
......
......@@ -11,18 +11,19 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/advancedprofile"
},
"dependencies": {
"@ant-design/pro-layout": "^4.0.5",
"antd": "^3.16.3",
"classnames": "^2.2.6",
"dva": "^2.4.0",
"lodash-decorators": "^6.0.0",
"react": "^16.6.3",
"umi-request": "^1.0.0",
"@ant-design/pro-layout": "^4.0.5"
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
......@@ -20,7 +20,7 @@ import React, { Component, Fragment } from 'react';
import { Dispatch } from 'redux';
import classNames from 'classnames';
import { connect } from 'dva';
import { AdvancedProfileData } from './data';
import { AdvancedProfileData } from './data.d';
import styles from './style.less';
const { Step } = Steps;
......@@ -122,14 +122,16 @@ const customDot = (
}: {
status: string;
},
) =>
status === 'process' ? (
<Popover placement="topLeft" arrowPointAtCenter content={popoverContent}>
{dot}
</Popover>
) : (
dot
);
) => {
if (status === 'process') {
return (
<Popover placement="topLeft" arrowPointAtCenter content={popoverContent}>
{dot}
</Popover>
);
}
return dot;
};
const operationTabList = [
{
......@@ -161,12 +163,12 @@ const columns = [
title: '执行结果',
dataIndex: 'status',
key: 'status',
render: (text: string) =>
text === 'agree' ? (
<Badge status="success" text="成功" />
) : (
<Badge status="error" text="驳回" />
),
render: (text: string) => {
if (text === 'agree') {
return <Badge status="success" text="成功" />;
}
return <Badge status="error" text="驳回" />;
},
},
{
title: '操作时间',
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { AdvancedProfileData } from './data';
import { AdvancedProfileData } from './data.d';
import { queryAdvancedProfile } from './service';
export type Effect = (
......
......@@ -11,15 +11,17 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/basicprofile"
},
"dependencies": {
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"dva": "^2.4.0",
"react": "^16.6.3",
"redux": "^4.0.1",
"umi-request": "^1.0.0"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"license": "ISC",
"blockConfig": {
......
export interface BasicGood {
id: string;
name: string;
barcode: string;
price: string;
num: string | number;
amount: string | number;
name?: string;
barcode?: string;
price?: string;
num?: string | number;
amount?: string | number;
}
export interface BasicProgress {
......
......@@ -4,7 +4,7 @@ import React, { Component } from 'react';
import { Dispatch } from 'redux';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { connect } from 'dva';
import { BasicGood, BasicProfileDataType } from './data';
import { BasicProfileDataType } from './data.d';
import styles from './style.less';
const progressColumns = [
......@@ -22,13 +22,14 @@ const progressColumns = [
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text: string) =>
text === 'success' ? (
<Badge status="success" text="成功" />
) : (
<Badge status="processing" text="进行中" />
),
render: (text: string) => {
if (text === 'success') {
return <Badge status="success" text="成功" />;
}
return <Badge status="processing" text="进行中" />;
},
},
{
title: '操作员ID',
dataIndex: 'operator',
......@@ -90,14 +91,15 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
id: '总计',
num,
amount,
} as BasicGood);
});
}
const renderContent = (value: any, row: any, index: any) => {
const obj = {
const obj: {
children: any;
props: { colSpan?: number };
} = {
children: value,
props: {} as {
colSpan?: number;
},
props: {},
};
if (index === basicGoods.length) {
obj.props.colSpan = 0;
......
import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { BasicGood } from './data';
import { BasicGood } from './data.d';
import { queryBasicProfile } from './service';
export interface IStateType {
export interface StateType {
basicGoods: BasicGood[];
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
fetchBasic: Effect;
};
reducers: {
show: Reducer<IStateType>;
show: Reducer<StateType>;
};
}
......
......@@ -11,12 +11,14 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/resultfail"
},
"dependencies": {
"react": "^16.6.3",
"antd": "^3.16.3"
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"classnames": "^2.2.6",
"umi-plugin-react": "^1.7.2",
"react": "^16.6.3"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "ISC",
......
......@@ -11,8 +11,11 @@
"url": "https://github.com/umijs/umi-blocks/ant-design-pro/resultsuccess"
},
"dependencies": {
"react": "^16.6.3",
"antd": "^3.10.9"
"@ant-design/pro-layout": "^4.5.5",
"antd": "^3.16.3",
"classnames": "^2.2.6",
"umi-plugin-react": "^1.7.2",
"react": "^16.6.3"
},
"devDependencies": {
"umi": "^2.6.9",
......
......@@ -16,13 +16,14 @@
"moment": "^2.22.2",
"qs": "^6.7.0",
"react": "^16.6.3",
"umi-request": "^1.0.0"
"redux": "^4.0.1",
"umi-request": "^1.0.0",
"umi-plugin-react": "^1.3.0"
},
"devDependencies": {
"@types/qs": "^6.5.3",
"umi": "^2.6.9",
"umi-plugin-block-dev": "^1.0.0",
"umi-plugin-react": "^1.3.0-beta.1",
"@types/qs": "^6.5.3"
"umi-plugin-block-dev": "^1.0.0"
},
"license": "MIT",
"blockConfig": {
......
......@@ -7,7 +7,7 @@ import { Dispatch } from 'redux';
import { FormComponentProps } from 'antd/es/form';
import Link from 'umi/link';
import { connect } from 'dva';
import { IStateType } from './model';
import { StateType } from './model';
import LoginComponents from './components/Login';
import styles from './style.less';
......@@ -15,7 +15,7 @@ const { Tab, UserName, Password, Mobile, Captcha, Submit } = LoginComponents;
interface PAGE_NAME_UPPER_CAMEL_CASEProps {
dispatch: Dispatch<any>;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
submitting: boolean;
}
interface PAGE_NAME_UPPER_CAMEL_CASEState {
......@@ -34,7 +34,7 @@ export interface FromDataType {
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: {
effects: {
[key: string]: string;
......@@ -54,8 +54,28 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
autoLogin: true,
};
changeAutoLogin = (e: CheckboxChangeEvent) => {
this.setState({
autoLogin: e.target.checked,
});
};
loginForm: FormComponentProps['form'] | undefined | null;
handleSubmit = (err: any, values: FromDataType) => {
const { type } = this.state;
if (!err) {
const { dispatch } = this.props;
dispatch({
type: 'BLOCK_NAME_CAMEL_CASE/login',
payload: {
...values,
type,
},
});
}
};
onTabChange = (type: string) => {
this.setState({ type });
};
......@@ -80,26 +100,6 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
});
});
handleSubmit = (err: any, values: FromDataType) => {
const { type } = this.state;
if (!err) {
const { dispatch } = this.props;
dispatch({
type: 'BLOCK_NAME_CAMEL_CASE/login',
payload: {
...values,
type,
},
});
}
};
changeAutoLogin = (e: CheckboxChangeEvent) => {
this.setState({
autoLogin: e.target.checked,
});
};
renderMessage = (content: string) => (
<Alert style={{ marginBottom: 24 }} message={content} type="error" showIcon />
);
......
......@@ -4,7 +4,7 @@ import { routerRedux } from 'dva/router';
import { fakeAccountLogin, getFakeCaptcha } from './service';
import { getPageQuery, setAuthority } from './utils/utils';
export interface IStateType {
export interface StateType {
status?: 'ok' | 'error';
type?: string;
currentAuthority?: 'user' | 'guest' | 'admin';
......@@ -12,18 +12,18 @@ export interface IStateType {
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
login: Effect;
getCaptcha: Effect;
};
reducers: {
changeLoginStatus: Reducer<IStateType>;
changeLoginStatus: Reducer<StateType>;
};
}
......
......@@ -17,11 +17,12 @@
"moment": "^2.22.2",
"nzh": "^1.0.3",
"react": "^16.6.3",
"umi-request": "^1.0.0"
"redux": "^4.0.1",
"umi-request": "^1.0.0",
"umi-plugin-react": "^1.7.2"
},
"devDependencies": {
"umi": "^2.6.9",
"umi-plugin-react": "^1.7.2",
"umi-plugin-block-dev": "^1.0.0"
},
"license": "MIT",
......
......@@ -7,7 +7,7 @@ import { FormComponentProps } from 'antd/es/form';
import Link from 'umi/link';
import { connect } from 'dva';
import router from 'umi/router';
import { IStateType } from './model';
import { StateType } from './model';
import styles from './style.less';
const FormItem = Form.Item;
......@@ -44,7 +44,7 @@ const passwordProgressMap: {
interface BLOCK_NAME_CAMEL_CASEProps extends FormComponentProps {
dispatch: Dispatch<any>;
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
submitting: boolean;
}
interface BLOCK_NAME_CAMEL_CASEState {
......@@ -55,7 +55,7 @@ interface BLOCK_NAME_CAMEL_CASEState {
prefix: string;
}
export interface IUserRegisterParams {
export interface UserRegisterParams {
mail: string;
password: string;
confirm: string;
......@@ -69,7 +69,7 @@ export interface IUserRegisterParams {
BLOCK_NAME_CAMEL_CASE,
loading,
}: {
BLOCK_NAME_CAMEL_CASE: IStateType;
BLOCK_NAME_CAMEL_CASE: StateType;
loading: {
effects: {
[key: string]: string;
......@@ -92,8 +92,6 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
prefix: '86',
};
interval: number | undefined;
componentDidUpdate() {
const { BLOCK_NAME_CAMEL_CASE, form } = this.props;
const account = form.getFieldValue('mail');
......@@ -197,6 +195,8 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
});
};
interval: number | undefined;
renderPasswordProgress = () => {
const { form } = this.props;
const value = form.getFieldValue('password');
......@@ -204,7 +204,6 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
return value && value.length ? (
<div className={styles[`progress-${passwordStatus}`]}>
<Progress
default={passwordProgressMap[passwordStatus]}
status={passwordProgressMap[passwordStatus]}
className={styles.progress}
strokeWidth={6}
......@@ -246,9 +245,12 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<
</FormItem>
<FormItem help={help}>
<Popover
getPopupContainer={node =>
node && node.parentNode ? (node.parentNode as HTMLElement) : node
}
getPopupContainer={node => {
if (node && node.parentNode) {
return node.parentNode as HTMLElement;
}
return node;
}}
content={
<div style={{ padding: '4px 0' }}>
{passwordStatusMap[this.getPasswordStatus()]}
......
......@@ -3,24 +3,24 @@ import { AnyAction, Reducer } from 'redux';
import { EffectsCommandMap } from 'dva';
import { fakeRegister } from './service';
export interface IStateType {
export interface StateType {
status?: 'ok' | 'error';
currentAuthority?: 'user' | 'guest' | 'admin';
}
export type Effect = (
action: AnyAction,
effects: EffectsCommandMap & { select: <T>(func: (state: IStateType) => T) => T },
effects: EffectsCommandMap & { select: <T>(func: (state: StateType) => T) => T },
) => void;
export interface ModelType {
namespace: string;
state: IStateType;
state: StateType;
effects: {
submit: Effect;
};
reducers: {
registerHandle: Reducer<IStateType>;
registerHandle: Reducer<StateType>;
};
}
......
import request from 'umi-request';
import { IUserRegisterParams } from './index';
import { UserRegisterParams } from './index';
export async function fakeRegister(params: IUserRegisterParams) {
export async function fakeRegister(params: UserRegisterParams) {
return request('/api/register', {
method: 'POST',
data: params,
......
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