...
|
...
|
@@ -3,13 +3,18 @@ import { View, Button } from '@tarojs/components'; |
|
|
import { SearchBar, FilterMenu, ProductList, PageTitle } from '../../components';
|
|
|
import { common as commonModel } from '../../models';
|
|
|
import { connect } from '@tarojs/redux';
|
|
|
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
import { clearFilter } from '../../actions/filterData';
|
|
|
import './index.scss';
|
|
|
|
|
|
@connect(({ filterMenu, filterData }) => ({
|
|
|
filterMenu,
|
|
|
filterData
|
|
|
}))
|
|
|
}), (dispatch) => {
|
|
|
return bindActionCreators({
|
|
|
clearFilter
|
|
|
}, dispatch);
|
|
|
})
|
|
|
|
|
|
export default class SearchList extends Component {
|
|
|
constructor(props) {
|
...
|
...
|
@@ -67,7 +72,6 @@ export default class SearchList extends Component { |
|
|
}
|
|
|
}
|
|
|
|
|
|
params.gender = ''
|
|
|
|
|
|
// 初始化数据
|
|
|
tabs.map(item => {
|
...
|
...
|
@@ -101,6 +105,11 @@ export default class SearchList extends Component { |
|
|
this.getProductData(nextProps.filterMenu);
|
|
|
}
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
let { clearFilter } = this.props;
|
|
|
clearFilter();
|
|
|
}
|
|
|
|
|
|
onScroll(e) {
|
|
|
if (e.detail.scrollTop > 72 && !this.state.isFixed) {
|
|
|
this.setState({
|
...
|
...
|
@@ -193,8 +202,6 @@ export default class SearchList extends Component { |
|
|
|
|
|
if (order) {
|
|
|
params.order = order;
|
|
|
} else {
|
|
|
// params.type = order ? '' : type;
|
|
|
}
|
|
|
|
|
|
// 系列,品牌,品类
|
...
|
...
|
@@ -260,15 +267,15 @@ export default class SearchList extends Component { |
|
|
searchList = latelySearch || []
|
|
|
}
|
|
|
console.log(searchList);
|
|
|
if (searchList.length >= 10) {
|
|
|
searchList.pop();
|
|
|
}
|
|
|
searchList.unshift({search_word: e.detail.value});
|
|
|
try {
|
|
|
Taro.setStorageSync('latelySearch', searchList);
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
|
if (searchList.length >= 10) {
|
|
|
searchList.pop();
|
|
|
}
|
|
|
searchList.unshift({search_word: e.detail.value});
|
|
|
try {
|
|
|
Taro.setStorageSync('latelySearch', searchList);
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
render() {
|
...
|
...
|
@@ -307,7 +314,7 @@ export default class SearchList extends Component { |
|
|
<PageTitle pageTitle={pageTitle} selfClass="pd"></PageTitle>
|
|
|
}
|
|
|
<View className={ this.state.fixed ? 'fixed' : '' }>
|
|
|
<FilterMenu filterMenu={filterMenu} tabs={ this.state.tabs } fromPage="search" hasFilter = { this.state.hasFilter } > </FilterMenu>
|
|
|
<FilterMenu filterMenu={ filterMenu } tabs = { this.state.tabs } fromPage = "search" hasFilter = { this.state.hasFilter } screen={this.$router.params} > </FilterMenu>
|
|
|
< /View>
|
|
|
<ProductList list={productList[type]}></ProductList>
|
|
|
</ScrollView>
|
...
|
...
|
|