Authored by 于良

Merge branch 'develop' into brand_store

Conflicts:
	js/App.js
	js/brandStore/BrandStore.js
	js/brandStore/constants/actionTypes.js
	js/brandStore/containers/BrandStoreContainer.js
	js/brandStore/reducers/brandStore/brandStoreActions.js
	js/brandStore/reducers/brandStore/brandStoreInitialState.js
	js/brandStore/reducers/brandStore/brandStoreReducer.js
	js/brandStore/services/BrandStoreService.js
	js/coupon/reducers/coupon/couponActions.js
<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);
}
... ...
... ... @@ -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();
... ...