Showing
2 changed files
with
25 additions
and
26 deletions
@@ -193,28 +193,27 @@ exports.getBrands4Filter = (params) => { | @@ -193,28 +193,27 @@ exports.getBrands4Filter = (params) => { | ||
193 | * @return {[type]} [description] | 193 | * @return {[type]} [description] |
194 | */ | 194 | */ |
195 | exports.getSearchRecommend = (channel, params) => { | 195 | exports.getSearchRecommend = (channel, params) => { |
196 | - return searchApi.getSearchRecommend(channel, params).then(result => { | ||
197 | 196 | ||
198 | - if (result.code === 200) { | 197 | + let channelNum = 1; |
199 | 198 | ||
200 | - let channelNum = 1; // -eslint-disable-line | ||
201 | - | ||
202 | - switch (channel) { | ||
203 | - case 'boys': | ||
204 | - channelNum = 1; | ||
205 | - break; | ||
206 | - case 'girls': | ||
207 | - channelNum = 2; | ||
208 | - break; | ||
209 | - case 'kids': | ||
210 | - channelNum = 3; | ||
211 | - break; | ||
212 | - case 'lifestyle': | ||
213 | - channelNum = 3; | ||
214 | - break; | ||
215 | - default: | ||
216 | - break; | ||
217 | - } | 199 | + switch (channel) { |
200 | + case 'boys': | ||
201 | + channelNum = 1; | ||
202 | + break; | ||
203 | + case 'girls': | ||
204 | + channelNum = 2; | ||
205 | + break; | ||
206 | + case 'kids': | ||
207 | + case 'lifestyle': | ||
208 | + channelNum = 3; | ||
209 | + break; | ||
210 | + default: | ||
211 | + break; | ||
212 | + } | ||
213 | + | ||
214 | + return searchApi.getSearchRecommend(channelNum, params).then(result => { | ||
215 | + | ||
216 | + if (result.code === 200) { | ||
218 | 217 | ||
219 | let resData = { | 218 | let resData = { |
220 | hotTerms: [] | 219 | hotTerms: [] |
@@ -934,8 +934,10 @@ $('.search-suggest-history').mouseenter(function() { | @@ -934,8 +934,10 @@ $('.search-suggest-history').mouseenter(function() { | ||
934 | * 搜索 热门搜索和默认搜索 api | 934 | * 搜索 热门搜索和默认搜索 api |
935 | * @return {[type]} [description] | 935 | * @return {[type]} [description] |
936 | */ | 936 | */ |
937 | -function searchSuggestRecommend(key) { | 937 | +function searchSuggestRecommend(channel,key) { |
938 | + | ||
938 | var param = { | 939 | var param = { |
940 | + channel: channel, | ||
939 | return_type: 'jsonp', | 941 | return_type: 'jsonp', |
940 | keyword: key | 942 | keyword: key |
941 | }; | 943 | }; |
@@ -944,15 +946,13 @@ function searchSuggestRecommend(key) { | @@ -944,15 +946,13 @@ function searchSuggestRecommend(key) { | ||
944 | 946 | ||
945 | var searchSuggestRecommendHtml; //eslint-disable-line | 947 | var searchSuggestRecommendHtml; //eslint-disable-line |
946 | 948 | ||
947 | - if (jsonData.code === 200) { | ||
948 | - if (jsonData.data && jsonData.data.hotTerms.length) { | 949 | + if (jsonData.code == 200) { |
949 | 950 | ||
950 | searchSuggestRecommendHtml = handlebars.compile($searchRecommendHbs.html() || ''); | 951 | searchSuggestRecommendHtml = handlebars.compile($searchRecommendHbs.html() || ''); |
951 | $searchRecommend.html(searchSuggestRecommendHtml(jsonData)).show(); | 952 | $searchRecommend.html(searchSuggestRecommendHtml(jsonData)).show(); |
952 | 953 | ||
953 | - } else { | ||
954 | - $searchRecommend.hide(); | ||
955 | - } | 954 | + }else{ |
955 | + $searchRecommend.hide(); | ||
956 | } | 956 | } |
957 | 957 | ||
958 | }); | 958 | }); |
-
Please register or login to post a comment