Authored by 于良

Merge branch 'local' into develop

... ... @@ -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();
... ...