Authored by 孙凯

修改冲突

<resources>
<string name="app_name">YH_RNComponent</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
... ... @@ -5,7 +5,7 @@ import Plustar from './plustar/Plustar';
import Coupon from './coupon/Coupon';
import QRCode from './qrcode/QRCode';
import BrandStore from './brandStore/BrandStore';
import Search from './search/Search';
// import Search from './search/Search';
export default function native(platform) {
Community(platform);
... ... @@ -13,5 +13,5 @@ export default function native(platform) {
Coupon(platform);
QRCode(platform);
BrandStore(platform);
Search(platform);
// Search(platform);
}
... ...
... ... @@ -35,4 +35,7 @@ export default keyMirror({
PRODUCT_LIST_FORNEW_REQUEST:null,
PRODUCT_LIST_FORNEW_SUCCESS:null,
PRODUCT_LIST_FORNEW_FAILURE:null,
PRODUCT_FILTER_ACTION: null,
});
... ...
... ... @@ -43,6 +43,7 @@ const {
PRODUCT_LIST_FORNEW_SUCCESS,
PRODUCT_LIST_FORNEW_FAILURE,
PRODUCT_FILTER_ACTION,
} = require('../../constants/actionTypes').default;
export function onPressCoupon() {
... ... @@ -352,8 +353,31 @@ export function productListFailure(error) {
/*
* 筛选
*/
export function setProductFilterFactors(categort={key:'gender',name: '性别',isSelect: true,}, deatil) {
export function setProductFilterFactors(categort={key:'gender',name: '性别',isSelect: true,}, detail=null) {
return (dispatch, getState) => {
let {app, brandStore} = getState();
let {categoryFilterList, filterCategoryDetailFilterList} = brandStore;
categoryFilterList.map((item, i) => {
if (categort.key === item.key) {
item.isSelect = true;
categoryFilterList[i]=item;
}
if (detail && filterCategoryDetailFilterList.hasOwnProperty(categort.key)) {
let detailList = filterCategoryDetailFilterList[categort.key];
detailList.map((item, i) => {
if (item.key === detail.key) {
item.isSelect = true;
detailList[i] = item;
filterCategoryDetailFilterList[categort.key] = detailList;
}
});
}
});
return {
type: PRODUCT_FILTER_ACTION,
payload:[categoryFilterList, filterCategoryDetailFilterList]
}
};
}
/*
... ...
... ... @@ -42,6 +42,8 @@ const {
PRODUCT_LIST_FORNEW_SUCCESS,
PRODUCT_LIST_FORNEW_FAILURE,
PRODUCT_FILTER_ACTION,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -210,8 +212,17 @@ export default function brandStoreReducer(state=initialState, action) {
case PRODUCT_LIST_FAILURE: {
return state.setIn(['productList', 'isFetching'], false)
.setIn(['productList', 'error'], action.payload);
}
case PRODUCT_FILTER_ACTION: {
let {
categoryFilterList,
filterCategoryDetailFilterList,
} = action.payload;
return state.set('categoryFilterList', categoryFilterList)
.set('filterCategoryDetailFilterList', filterCategoryDetailFilterList);
}
case PRODUCT_LIST_FORPERSON_REQUEST:{
return state.setIn(['productListForPerson', 'isFetching'], true)
.setIn(['productListForPerson', 'error'], null);
... ...
... ... @@ -89,7 +89,7 @@ export function couponCenter(reload = false) {
fetchCouponInfo(contentCode, uid);
})
.catch(error => {
fetchCouponInfo(contentCode, 0);
fetchCouponInfo(contentCode, '0');
});
};
}
... ...
... ... @@ -37,6 +37,7 @@ export default class Search extends Component {
<ProductShopCell
key={'row' + rowID}
data={rowData}
onPressShop={this.props.onPressShop}
/>
);
case 'placeholder':
... ... @@ -60,6 +61,7 @@ export default class Search extends Component {
key={'row' + rowID}
rowID={rowID}
data={rowData}
onPressProduct={this.props.onPressProduct}
/>
);
default:
... ...
... ... @@ -124,23 +124,31 @@ export default class Search extends Component {
render() {
let {data, sourceType, style} = this.props;
let {data, sourceType, rowID, style} = this.props;
let name = data.get('product_name') ? data.get('product_name') : '';
return (
<View style={[styles.container, style]}>
<TouchableOpacity
style={[styles.container, style]}
activeOpacity={1}
onPress={() => {
this.props.onPressProduct && this.props.onPressProduct(data, rowID);
}}
>
<View>
{this._renderTags()}
{this._renderImages()}
<View style={styles.nameContainer}>
<Text style={styles.name} numberOfLines={2}>{name}</Text>
</View>
{this._renderTags()}
{this._renderPrice()}
{this._renderImages()}
<View style={styles.nameContainer}>
<Text style={styles.name} numberOfLines={2}>{name}</Text>
</View>
{this._renderPrice()}
</View>
</TouchableOpacity>
);
}
}
... ...
... ... @@ -52,6 +52,8 @@ class SearchContainer extends Component {
this._onPressClearHistory = this._onPressClearHistory.bind(this);
this._onPressFilter = this._onPressFilter.bind(this);
this._onEndReached = this._onEndReached.bind(this);
this._onPressShop = this._onPressShop.bind(this);
this._onPressProduct = this._onPressProduct.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
"SearchKeywordDidChangeEvent",
... ... @@ -99,6 +101,15 @@ class SearchContainer extends Component {
this.props.actions.searchProductList(this.props.search.keyword);
}
_onPressShop(data) {
ReactNative.NativeModules.YH_SearchHelper.goToBrandShop(data.toJS());
}
_onPressProduct(data, index='0') {
console.log(index)
ReactNative.NativeModules.YH_SearchHelper.goToProductDetail(data.toJS(), index, this.props.search.productList.filter);
}
_renderSearch() {
let {status, keyword, placeholder, searchHistory, hotKeyword, fuzzySearch, jumpUrl, productList} = this.props.search;
if (status == 0) {
... ... @@ -118,8 +129,6 @@ class SearchContainer extends Component {
/>
);
} else if (status == 2) {
console.log('currentPage: ' + productList.currentPage)
console.log('isFetching: ' + productList.isFetching)
let isLoadingMore = productList.isFetching && productList.currentPage > 0;
return (
<ProductList
... ... @@ -130,6 +139,8 @@ class SearchContainer extends Component {
endReached={productList.endReached}
onPressFilter={this._onPressFilter}
onEndReached={this._onEndReached}
onPressShop={this._onPressShop}
onPressProduct={this._onPressProduct}
/>
);
}
... ...
... ... @@ -149,7 +149,7 @@ export function searchProductList(keyword, reload=false) {
let order = productList.filter;
let page = productList.currentPage + 1;
let pageSize = productList.pageSize;
ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_SearchProListVC')
ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_RNSearchViewController')
.then(data => {
sourcePage = data;
return ReactNative.NativeModules.YH_CommonHelper.uid();
... ... @@ -241,7 +241,7 @@ export function jumpUrl(keyword) {
let uid = 0;
let sourcePage = '';
ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_SearchProListVC')
ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_RNSearchViewController')
.then(data => {
sourcePage = data;
return ReactNative.NativeModules.YH_CommonHelper.uid();
... ...