|
@@ -11,16 +11,6 @@ import {
|
|
|
import bitmap from '../../../assets/bitmap.png';
|
|
|
import styles from './RecommendPoster.less';
|
|
|
|
|
|
-function dataSort(array) {
|
|
|
- if (!array || !Array.isArray(array)) {
|
|
|
- return array;
|
|
|
- }
|
|
|
- const sorted = array.sort((a, b) => {
|
|
|
- return a.sort - b.sort;
|
|
|
- });
|
|
|
- return sorted;
|
|
|
-}
|
|
|
-
|
|
|
@connect(({ loading, merchant, shelves, resource }) => ({
|
|
|
shelves,
|
|
|
merchant,
|
|
@@ -79,7 +69,7 @@ export default class RecommendPosterEditPage extends Component {
|
|
|
};
|
|
|
/**
|
|
|
* 4.删除一条海报
|
|
|
- * @param postId
|
|
|
+ * @param posterId
|
|
|
* @param isNew
|
|
|
*/
|
|
|
handlePosterItemDelete = (posterId, isNew) => {
|
|
@@ -96,10 +86,10 @@ export default class RecommendPosterEditPage extends Component {
|
|
|
type: 'merchant/deleteMerchantPosterItem',
|
|
|
payload: { posterId },
|
|
|
});
|
|
|
- }
|
|
|
+ };
|
|
|
/**
|
|
|
* 5.编辑一条海报
|
|
|
- * @param postId
|
|
|
+ * @param posterId
|
|
|
*/
|
|
|
handlePosterItemEdit = (posterId) => {
|
|
|
const newData = [...this.props.merchant.posterList];
|
|
@@ -116,6 +106,7 @@ export default class RecommendPosterEditPage extends Component {
|
|
|
/**
|
|
|
* 6.控制模态框的展现
|
|
|
* @param {String} flag
|
|
|
+ * @param {String} posterId
|
|
|
*/
|
|
|
handleSelectorModalShow = (flag, posterId) => {
|
|
|
this.setState({
|
|
@@ -307,7 +298,8 @@ export default class RecommendPosterEditPage extends Component {
|
|
|
key: 3,
|
|
|
render: (_, record) => {
|
|
|
// 将产品信息渲染成一个小表格
|
|
|
- const { id, type, name, code, isEdit, isNew } = record;
|
|
|
+ const { id, product = {}, isEdit, isNew } = record;
|
|
|
+ const { code, name, type } = product;
|
|
|
const columns = [{
|
|
|
dataIndex: 'label',
|
|
|
width: '40%',
|
|
@@ -490,7 +482,7 @@ export default class RecommendPosterEditPage extends Component {
|
|
|
<Table
|
|
|
pagination={false}
|
|
|
loading={mLoading}
|
|
|
- dataSource={dataSort(posterList)}
|
|
|
+ dataSource={posterList}
|
|
|
columns={posterColumns}
|
|
|
rowKey={record => record.id}
|
|
|
className={styles.posterTable}
|