Merge branch 'local' into develop
Showing
4 changed files
with
36 additions
and
15 deletions
@@ -37,6 +37,7 @@ export default class Search extends Component { | @@ -37,6 +37,7 @@ export default class Search extends Component { | ||
37 | <ProductShopCell | 37 | <ProductShopCell |
38 | key={'row' + rowID} | 38 | key={'row' + rowID} |
39 | data={rowData} | 39 | data={rowData} |
40 | + onPressShop={this.props.onPressShop} | ||
40 | /> | 41 | /> |
41 | ); | 42 | ); |
42 | case 'placeholder': | 43 | case 'placeholder': |
@@ -60,6 +61,7 @@ export default class Search extends Component { | @@ -60,6 +61,7 @@ export default class Search extends Component { | ||
60 | key={'row' + rowID} | 61 | key={'row' + rowID} |
61 | rowID={rowID} | 62 | rowID={rowID} |
62 | data={rowData} | 63 | data={rowData} |
64 | + onPressProduct={this.props.onPressProduct} | ||
63 | /> | 65 | /> |
64 | ); | 66 | ); |
65 | default: | 67 | default: |
@@ -124,23 +124,31 @@ export default class Search extends Component { | @@ -124,23 +124,31 @@ export default class Search extends Component { | ||
124 | 124 | ||
125 | 125 | ||
126 | render() { | 126 | render() { |
127 | - let {data, sourceType, style} = this.props; | 127 | + let {data, sourceType, rowID, style} = this.props; |
128 | let name = data.get('product_name') ? data.get('product_name') : ''; | 128 | let name = data.get('product_name') ? data.get('product_name') : ''; |
129 | 129 | ||
130 | return ( | 130 | return ( |
131 | - <View style={[styles.container, style]}> | 131 | + <TouchableOpacity |
132 | + style={[styles.container, style]} | ||
133 | + activeOpacity={1} | ||
134 | + onPress={() => { | ||
135 | + this.props.onPressProduct && this.props.onPressProduct(data, rowID); | ||
136 | + }} | ||
137 | + > | ||
138 | + <View> | ||
139 | + | ||
140 | + {this._renderTags()} | ||
141 | + | ||
142 | + {this._renderImages()} | ||
143 | + | ||
144 | + <View style={styles.nameContainer}> | ||
145 | + <Text style={styles.name} numberOfLines={2}>{name}</Text> | ||
146 | + </View> | ||
132 | 147 | ||
133 | - {this._renderTags()} | 148 | + {this._renderPrice()} |
134 | 149 | ||
135 | - {this._renderImages()} | ||
136 | - | ||
137 | - <View style={styles.nameContainer}> | ||
138 | - <Text style={styles.name} numberOfLines={2}>{name}</Text> | ||
139 | </View> | 150 | </View> |
140 | - | ||
141 | - {this._renderPrice()} | ||
142 | - | ||
143 | - </View> | 151 | + </TouchableOpacity> |
144 | ); | 152 | ); |
145 | } | 153 | } |
146 | } | 154 | } |
@@ -52,6 +52,8 @@ class SearchContainer extends Component { | @@ -52,6 +52,8 @@ class SearchContainer extends Component { | ||
52 | this._onPressClearHistory = this._onPressClearHistory.bind(this); | 52 | this._onPressClearHistory = this._onPressClearHistory.bind(this); |
53 | this._onPressFilter = this._onPressFilter.bind(this); | 53 | this._onPressFilter = this._onPressFilter.bind(this); |
54 | this._onEndReached = this._onEndReached.bind(this); | 54 | this._onEndReached = this._onEndReached.bind(this); |
55 | + this._onPressShop = this._onPressShop.bind(this); | ||
56 | + this._onPressProduct = this._onPressProduct.bind(this); | ||
55 | 57 | ||
56 | this.subscription = NativeAppEventEmitter.addListener( | 58 | this.subscription = NativeAppEventEmitter.addListener( |
57 | "SearchKeywordDidChangeEvent", | 59 | "SearchKeywordDidChangeEvent", |
@@ -99,6 +101,15 @@ class SearchContainer extends Component { | @@ -99,6 +101,15 @@ class SearchContainer extends Component { | ||
99 | this.props.actions.searchProductList(this.props.search.keyword); | 101 | this.props.actions.searchProductList(this.props.search.keyword); |
100 | } | 102 | } |
101 | 103 | ||
104 | + _onPressShop(data) { | ||
105 | + ReactNative.NativeModules.YH_SearchHelper.goToBrandShop(data.toJS()); | ||
106 | + } | ||
107 | + | ||
108 | + _onPressProduct(data, index='0') { | ||
109 | + console.log(index) | ||
110 | + ReactNative.NativeModules.YH_SearchHelper.goToProductDetail(data.toJS(), index, this.props.search.productList.filter); | ||
111 | + } | ||
112 | + | ||
102 | _renderSearch() { | 113 | _renderSearch() { |
103 | let {status, keyword, placeholder, searchHistory, hotKeyword, fuzzySearch, jumpUrl, productList} = this.props.search; | 114 | let {status, keyword, placeholder, searchHistory, hotKeyword, fuzzySearch, jumpUrl, productList} = this.props.search; |
104 | if (status == 0) { | 115 | if (status == 0) { |
@@ -118,8 +129,6 @@ class SearchContainer extends Component { | @@ -118,8 +129,6 @@ class SearchContainer extends Component { | ||
118 | /> | 129 | /> |
119 | ); | 130 | ); |
120 | } else if (status == 2) { | 131 | } else if (status == 2) { |
121 | - console.log('currentPage: ' + productList.currentPage) | ||
122 | - console.log('isFetching: ' + productList.isFetching) | ||
123 | let isLoadingMore = productList.isFetching && productList.currentPage > 0; | 132 | let isLoadingMore = productList.isFetching && productList.currentPage > 0; |
124 | return ( | 133 | return ( |
125 | <ProductList | 134 | <ProductList |
@@ -130,6 +139,8 @@ class SearchContainer extends Component { | @@ -130,6 +139,8 @@ class SearchContainer extends Component { | ||
130 | endReached={productList.endReached} | 139 | endReached={productList.endReached} |
131 | onPressFilter={this._onPressFilter} | 140 | onPressFilter={this._onPressFilter} |
132 | onEndReached={this._onEndReached} | 141 | onEndReached={this._onEndReached} |
142 | + onPressShop={this._onPressShop} | ||
143 | + onPressProduct={this._onPressProduct} | ||
133 | /> | 144 | /> |
134 | ); | 145 | ); |
135 | } | 146 | } |
@@ -149,7 +149,7 @@ export function searchProductList(keyword, reload=false) { | @@ -149,7 +149,7 @@ export function searchProductList(keyword, reload=false) { | ||
149 | let order = productList.filter; | 149 | let order = productList.filter; |
150 | let page = productList.currentPage + 1; | 150 | let page = productList.currentPage + 1; |
151 | let pageSize = productList.pageSize; | 151 | let pageSize = productList.pageSize; |
152 | - ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_SearchProListVC') | 152 | + ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_RNSearchViewController') |
153 | .then(data => { | 153 | .then(data => { |
154 | sourcePage = data; | 154 | sourcePage = data; |
155 | return ReactNative.NativeModules.YH_CommonHelper.uid(); | 155 | return ReactNative.NativeModules.YH_CommonHelper.uid(); |
@@ -241,7 +241,7 @@ export function jumpUrl(keyword) { | @@ -241,7 +241,7 @@ export function jumpUrl(keyword) { | ||
241 | 241 | ||
242 | let uid = 0; | 242 | let uid = 0; |
243 | let sourcePage = ''; | 243 | let sourcePage = ''; |
244 | - ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_SearchProListVC') | 244 | + ReactNative.NativeModules.YH_CommonHelper.sourcePage('YH_RNSearchViewController') |
245 | .then(data => { | 245 | .then(data => { |
246 | sourcePage = data; | 246 | sourcePage = data; |
247 | return ReactNative.NativeModules.YH_CommonHelper.uid(); | 247 | return ReactNative.NativeModules.YH_CommonHelper.uid(); |
-
Please register or login to post a comment