前端:商品添加。提交部分,让小范帮忙看看~
This commit is contained in:
@@ -77,52 +77,13 @@ class ProductSpuList extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
handleModalVisible = (flag, modalType, initValues) => {
|
||||
this.setState({
|
||||
modalVisible: !!flag,
|
||||
initValues: initValues || {},
|
||||
modalType: modalType || 'add',
|
||||
redirectToAdd = () => {
|
||||
const { dispatch } = this.props;
|
||||
dispatch({
|
||||
type: 'productSpuList/redirectToAdd',
|
||||
});
|
||||
};
|
||||
|
||||
handleAdd = ({ fields, modalType, initValues }) => {
|
||||
const { dispatch, data } = this.props;
|
||||
const queryParams = {
|
||||
pageNo: data.pageNo,
|
||||
pageSize: data.pageSize,
|
||||
};
|
||||
if (modalType === 'add') {
|
||||
dispatch({
|
||||
type: 'roleList/add',
|
||||
payload: {
|
||||
body: {
|
||||
...fields,
|
||||
},
|
||||
queryParams,
|
||||
callback: () => {
|
||||
message.success('添加成功');
|
||||
this.handleModalVisible();
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
dispatch({
|
||||
type: 'roleList/update',
|
||||
payload: {
|
||||
body: {
|
||||
...initValues,
|
||||
...fields,
|
||||
},
|
||||
queryParams,
|
||||
callback: () => {
|
||||
message.success('更新成功');
|
||||
this.handleModalVisible();
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
// debugger;
|
||||
const { list, data } = this.props;
|
||||
@@ -199,7 +160,7 @@ class ProductSpuList extends PureComponent {
|
||||
<Button
|
||||
icon="plus"
|
||||
type="primary"
|
||||
onClick={() => this.handleModalVisible(true, 'add', {})}
|
||||
onClick={this.redirectToAdd}
|
||||
>
|
||||
发布商品
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user