Authored by OF1706

service

... ... @@ -190,17 +190,17 @@ exports.getBrands4Filter = (params) => {
/**
* 搜索 历史记录提示
*/
exports.getSearchHistory = (params) => {
return searchApi.getSearchHistory(params).then(result => {
let resData = [];
if (result.code === 200) {
resData = searchHandler.handleSuggest(result.data);
}
return resData;
});
};
// exports.getSearchHistory = (params) => {
// return searchApi.getSearchHistory(params).then(result => {
// let resData = [];
//
// if (result.code === 200) {
// resData = searchHandler.handleSuggest(result.data);
// }
//
// return resData;
// });
// };
/**
... ...
... ... @@ -870,9 +870,6 @@ function searchSuggestHistory() {
// $searchKey.val($('#defaultsearch').val());
// }
// 保存搜索的内容
// writeSearch.setHistoryValFun($searchKey.val());
// exeCookieMap();
let $queryKey = $('#query-key');
$.getJSON('//search.yohobuy.com/product/search/history?query=' + $queryKey.val(), function(jsonData) {
... ... @@ -882,13 +879,18 @@ function searchSuggestHistory() {
// if (jsonData.data && jsonData.data.length) {
searchSuggestHistoryHtml = handlebars.compile($searchHistoryHbs.html() || '');
console.log(jsonData);
$searchHistory.html(searchSuggestHistoryHtml(jsonData)).show();
// } else {
// $searchHistory.hide();
// }
// }
$(".search-suggest-title .searchDel").click(function(){
console.log("****&&&&&&&&&&&");
$.cookie('_History',null,{path:'/'});
return false;
});
});
}
... ... @@ -921,27 +923,24 @@ function searchSuggestRecommend(key) {
};
$.getJSON('//search.yohobuy.com/product/search/recommend?callback=?', param, function(jsonData) {
console.log("*********************");
console.log(jsonData);
console.log("*********************");
// console.log("*********************");
// console.log(jsonData);
// console.log("*********************");
var searchSuggestRecommendHtml;
if (jsonData.code === 200) {
if (jsonData.data && jsonData.data.hotTerms.length) {
searchSuggestRecommendHtml = handlebars.compile($searchRecommendHbs.html() || '');
console.log(searchSuggestRecommendHtml(jsonData));
$searchRecommend.html(searchSuggestRecommendHtml(jsonData)).show();
} else {
$searchRecommend.hide();
}
}
});
}
... ...