...
|
...
|
@@ -7,6 +7,7 @@ import { bindActionCreators } from 'redux'; |
|
|
import { clearFilter } from '../../actions/filterData';
|
|
|
import './index.scss';
|
|
|
import goYohoBuy from '../../assets/images/goYohoBuy@3x.png';
|
|
|
import event from '../../utils/event.js';
|
|
|
|
|
|
@connect(({ filterMenu, filterData }) => ({
|
|
|
filterMenu,
|
...
|
...
|
@@ -96,48 +97,36 @@ export default class SearchList extends Component { |
|
|
this.setState(obj, () => {
|
|
|
this.getProductData();
|
|
|
});
|
|
|
event.on('reset-page-loading', this.resetPageAndStopLoading.bind(this));
|
|
|
}
|
|
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
let { destroy, page, stopLoading } = this.state;
|
|
|
if (!destroy) {
|
|
|
if (Object.keys(page).length > 0) {
|
|
|
Object.keys(page).forEach((key) => {
|
|
|
page[key] = 1
|
|
|
});
|
|
|
}
|
|
|
if (Object.keys(stopLoading).length > 0) {
|
|
|
Object.keys(stopLoading).forEach((key) => {
|
|
|
stopLoading[key] = false
|
|
|
})
|
|
|
}
|
|
|
this.setState({
|
|
|
page: page,
|
|
|
stopLoading
|
|
|
}, () => {
|
|
|
this.getProductData(nextProps.filterMenu);
|
|
|
});
|
|
|
// this.getProductData(nextProps.filterMenu);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
componentDidShow() {
|
|
|
let { page, stopLoading } = this.state;
|
|
|
if (Object.keys(page).length > 0) {
|
|
|
Object.keys(page).forEach((key) => {
|
|
|
page[key] = 1
|
|
|
});
|
|
|
}
|
|
|
if (Object.keys(stopLoading).length > 0) {
|
|
|
Object.keys(stopLoading).forEach((key) => {
|
|
|
stopLoading[key] = false
|
|
|
})
|
|
|
}
|
|
|
this.setState({
|
|
|
page: page,
|
|
|
stopLoading
|
|
|
}, () => {
|
|
|
this.getProductData();
|
|
|
});
|
|
|
resetPageAndStopLoading(props) {
|
|
|
let { page, stopLoading } = this.state;
|
|
|
if (Object.keys(page).length > 0) {
|
|
|
Object.keys(page).forEach((key) => {
|
|
|
page[key] = 1
|
|
|
});
|
|
|
}
|
|
|
if (Object.keys(stopLoading).length > 0) {
|
|
|
Object.keys(stopLoading).forEach((key) => {
|
|
|
stopLoading[key] = false
|
|
|
})
|
|
|
}
|
|
|
console.log(page);
|
|
|
console.log(stopLoading);
|
|
|
this.setState({
|
|
|
page: page,
|
|
|
stopLoading
|
|
|
}, () => {
|
|
|
this.getProductData(props.filterMenu);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
componentWillUnmount() {
|
...
|
...
|
@@ -227,7 +216,9 @@ export default class SearchList extends Component { |
|
|
getProductData(obj, isSearch) {
|
|
|
let { filterMenu, filterData } = this.props;
|
|
|
let { page, productList, stopLoading, query } = this.state;
|
|
|
console.log('obj: ', obj);
|
|
|
console.log('filterMenu: ', filterMenu);
|
|
|
console.log('filterData: ', filterData);
|
|
|
|
|
|
let order = '';
|
|
|
obj = obj || filterMenu;
|
...
|
...
|
|