Authored by 孙凯

接 筛选 确认 清除 事件 review by qiangbing

... ... @@ -16,6 +16,7 @@ export default keyMirror({
SET_TYPE: null,
SET_BRANDID: null,
SET_SHOP: null,
CANCEL_SELECT: null,
GET_BRAND_BANNER_INFO_REQUEST: null,
GET_BRAND_BANNER_INFO_SUCCESS: null,
GET_BRAND_BANNER_INFO_FAILURE: null,
... ...
... ... @@ -45,6 +45,14 @@ class ProductListContainer extends Component {
this._onLongPressProduct = this._onLongPressProduct.bind(this);
this._onPressFindSimilar = this._onPressFindSimilar.bind(this);
this._onPressProductCell = this._onPressProductCell.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'updateProductByFilter',
(array) => {
// this.props.actions.getProductList();
console.log(array);
console.log('ssssssssssssss');
}
);
}
componentDidMount() {
... ... @@ -55,6 +63,7 @@ class ProductListContainer extends Component {
}
componentWillUnmount() {
this.subscription && this.subscription.remove();
}
_onPressCoupon(rowData) {
... ...
... ... @@ -45,6 +45,14 @@ class ProductListForShopContainer extends Component {
this._onLongPressProduct = this._onLongPressProduct.bind(this);
this._onPressFindSimilar = this._onPressFindSimilar.bind(this);
this._onPressProductCell = this._onPressProductCell.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'updateProductByFilter',
(array) => {
// this.props.actions.getProductList();
console.log(array);
console.log('ssssssssssssss');
}
);
}
componentDidMount() {
... ... @@ -55,6 +63,7 @@ class ProductListForShopContainer extends Component {
}
componentWillUnmount() {
this.subscription && this.subscription.remove();
}
_onPressCoupon(rowData) {
... ...
... ... @@ -106,11 +106,24 @@ class ScreenContainer extends Component {
}
okAction() {
ReactNative.NativeModules.YH_ScreenCategoryViewHelper.okAction();
//刷新页面
let {app, screen} = this.props;
let categoryFilterList = screen&&screen.get('categoryFilterList')?screen.get('categoryFilterList').toJS():'';
let hasSelect = [];
for (let i = 0; i < categoryFilterList.length; i++) {
let obj = categoryFilterList[i];
hasSelect.push({
'key': obj.key,
'name': obj.select.name,
'keyCode': obj.select.key,
});
}
ReactNative.NativeModules.YH_ScreenCategoryViewHelper.okAction(hasSelect);
}
cancelAction() {
//清空数据
this.props.actions.cancelSelect();
}
onSelectItem(subFilter) {
... ...
... ... @@ -5,6 +5,7 @@ import ReactNative from 'react-native';
const {
SET_DATASOURCE,
SET_SELECTLIST,
CANCEL_SELECT,
} = require('../../constants/actionTypes').default;
... ... @@ -22,3 +23,19 @@ export function setSelectItem(list) {
payload: list
};
}
export function cancelSelectDispath(json) {
return {
type: CANCEL_SELECT,
payload: json
};
}
export function cancelSelect() {
return (dispatch, getState) => {
let {app, screen} = getState();
let {origincategoryFilterList} = screen;
let json = origincategoryFilterList?origincategoryFilterList.toJS():[];
dispatch(cancelSelectDispath(json));
};
}
... ...
... ... @@ -6,5 +6,6 @@ let InitialState = Record({
categoryFilterList: List(),
filterCategoryDetailFilterList: List(),
dataSourceType: 0,
origincategoryFilterList: List(),//包括初始化选择属性
});
export default InitialState;
... ...
... ... @@ -6,6 +6,7 @@ import Immutable, {Map} from 'immutable';
const {
SET_DATASOURCE,
SET_SELECTLIST,
CANCEL_SELECT,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -15,6 +16,7 @@ export default function screenReducer(state=initialState, action) {
case SET_DATASOURCE:
{
return state.set('categoryFilterList',Immutable.fromJS(action.payload.categoryFilterList))
.set('origincategoryFilterList',Immutable.fromJS(action.payload.categoryFilterList))
.set('filterCategoryDetailFilterList',Immutable.fromJS(action.payload.filterCategoryDetailFilterList))
.set('dataSourceType', action.payload.dataSourceType);
}
... ... @@ -22,6 +24,10 @@ export default function screenReducer(state=initialState, action) {
{
return state.set('categoryFilterList',Immutable.fromJS(action.payload));
}
case CANCEL_SELECT:
{
return state.set('categoryFilterList',Immutable.fromJS(action.payload));
}
}
return state;
}
... ...