Authored by 孙凯

add product list review by hongmo

... ... @@ -34,6 +34,7 @@ export default class OutletPageListView extends Component {
this.renderRow = this.renderRow.bind(this);
this._onRefresh = this._onRefresh.bind(this);
this.setActivityFliter = this.setActivityFliter.bind(this);
this._onPressFilter = this._onPressFilter.bind(this);
}
componentDidMount() {
... ... @@ -50,6 +51,17 @@ export default class OutletPageListView extends Component {
this.props.getOutletActivityList && this.props.getOutletActivityList(resource.get('content_code'));
}
_onPressFilter(value){
let {
resource,
} = this.props;
let categoryNavigationList = resource.get('categoryNavigationList')?resource.get('categoryNavigationList').toArray():null;
let categoryNavigationItem = categoryNavigationList?categoryNavigationList[value].toJS():null;
this.props.onPressFilter && this.props.onPressFilter(resource.get('content_code'),value,categoryNavigationItem);
}
setActivityFliter() {
let {
resource,
... ... @@ -71,7 +83,7 @@ export default class OutletPageListView extends Component {
return (
<ProductFliter
resource={categoryNavigationList}
onPressFilter={this.props.onPressFilter}
onPressFilter={this._onPressFilter}
/>
);
}
... ... @@ -139,7 +151,8 @@ export default class OutletPageListView extends Component {
let activityList = resource.get('activityList')?resource.get('activityList').toArray():null;
let activityMore = resource.get('activityMore');
let categoryNavigationList = resource.get('categoryNavigationList')?resource.get('categoryNavigationList').toArray():null;
let productObj = categoryNavigationList?categoryNavigationList[0].get('list'):null;
let fliter = resource.get('value')?resource.get('value'):0;
let productObj = categoryNavigationList?categoryNavigationList[fliter].get('list'):null;
let productList = productObj?productObj.get('product_list'):null;
let error = resource.get('error');
let ptr = resource.get('ptr')==true ? true : false;
... ...
... ... @@ -9,6 +9,7 @@ export default keyMirror({
SET_CATEGORYID: null,
SET_ACTIVITY_FLITER: null,
SET_FLITER: null,
GET_CATEGORY_REQUEST: null,
GET_CATEGORY_SUCCESS: null,
... ...
... ... @@ -71,9 +71,12 @@ class OutletContainer extends Component {
console.log('_onPressProduct = '+url);
}
_onPressFilter(value){
console.log(value);
// this.props.actions.onPressFilter(value);
_onPressFilter(content_code,value,categoryNavigationItem){
this.props.actions.onPressFilter(content_code,value);
let list = categoryNavigationItem.list;
if (!list) {
this.props.actions.getProductList(content_code,categoryNavigationItem);
}
}
render() {
... ...
... ... @@ -10,6 +10,8 @@ const {
SET_ACTIVITY_FLITER,
SET_FLITER,
GET_CATEGORY_REQUEST,
GET_CATEGORY_SUCCESS,
GET_CATEGORY_FAILURE,
... ... @@ -222,3 +224,10 @@ export function setActivityFliter(content_code,activityMore) {
payload: {'activityMore':activityMore,'content_code':content_code}
};
}
export function onPressFilter(content_code,value) {
return {
type: SET_FLITER,
payload: {'value':value,'content_code':content_code}
};
}
... ...
... ... @@ -5,6 +5,7 @@ import Immutable, {Map} from 'immutable';
const {
SET_ACTIVITY_FLITER,
SET_FLITER,
GET_CATEGORY_REQUEST,
GET_CATEGORY_SUCCESS,
... ... @@ -184,6 +185,17 @@ export default function outletReducer(state=initialState, action) {
})
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
}
case SET_FLITER: {
let categoryList = state.categoryList.toJS();
let content_code1 = action.payload.content_code;
categoryList.list.map((item, i) => {
let content_code0 = item.content_code;
if (content_code1 == content_code0) {
item.value = action.payload.value;
}
})
return state.setIn(['categoryList', 'list'], Immutable.fromJS(categoryList.list))
}
}
return state;
... ...