diff --git a/admin-web/src/models/product/productSpuAddOrUpdate.js b/admin-web/src/models/product/productSpuAddOrUpdate.js index da9f0afc8..6ceaa56e7 100644 --- a/admin-web/src/models/product/productSpuAddOrUpdate.js +++ b/admin-web/src/models/product/productSpuAddOrUpdate.js @@ -119,10 +119,23 @@ export default { if (callback) { callback(response); } - yield put({ - type: 'tree', - payload: {}, - }); + // yield put({ + // type: 'tree', + // payload: {}, + // }); + alert('添加成功!后续改成跳转到手机站的详情'); + }, + *update({ payload }, { call, put }) { + const { callback, body } = payload; + const response = yield call(productSpuAdd, body); + if (callback) { + callback(response); + } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + alert('修改成功!后续改成跳转到手机站的详情'); }, }, diff --git a/admin-web/src/models/product/productSpuList.js b/admin-web/src/models/product/productSpuList.js index d4492f3cb..cc9ad9607 100644 --- a/admin-web/src/models/product/productSpuList.js +++ b/admin-web/src/models/product/productSpuList.js @@ -1,5 +1,6 @@ import { message } from 'antd'; import { productSpuPage, productCategoryAdd, productCategoryUpdate, productCategoryUpdateStatus, productCategoryDelete } from '../../services/product'; +import {routerRedux} from "dva/router"; export default { namespace: 'productSpuList', @@ -9,46 +10,50 @@ export default { }, effects: { - *add({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryAdd, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *update({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryUpdate, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *updateStatus({ payload }, { call, put }) { - const { callback, body } = payload; - const response = yield call(productCategoryUpdateStatus, body); - if (callback) { - callback(response); - } - yield put({ - type: 'tree', - payload: {}, - }); - }, - *delete({ payload }, { call, put }) { - const response = yield call(productCategoryDelete, payload); - message.info('删除成功!'); - yield put({ - type: 'tree', - payload: {}, - }); + // *add({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryAdd, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *update({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryUpdate, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *updateStatus({ payload }, { call, put }) { + // const { callback, body } = payload; + // const response = yield call(productCategoryUpdateStatus, body); + // if (callback) { + // callback(response); + // } + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + // *delete({ payload }, { call, put }) { + // const response = yield call(productCategoryDelete, payload); + // message.info('删除成功!'); + // yield put({ + // type: 'tree', + // payload: {}, + // }); + // }, + *redirectToAdd({ payload }, { call, put }) { + // const { callback, body } = payload; + yield put(routerRedux.replace('/product/product-spu-add')); }, *page({ payload }, { call, put }) { const { queryParams } = payload; diff --git a/admin-web/src/pages/Product/ProductSpuList.js b/admin-web/src/pages/Product/ProductSpuList.js index 6435529fc..6abb3de4a 100644 --- a/admin-web/src/pages/Product/ProductSpuList.js +++ b/admin-web/src/pages/Product/ProductSpuList.js @@ -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 {