Authored by 周少峰

Merge branch 'release/4.5' of http://git.dev.yoho.cn/web/yohobuywap into release/4.5

... ... @@ -15,11 +15,11 @@ function getRanToken() {
/**
* 增加单条记录
*/
function addHistory(brandId) {
function addHistory(brandName) {
$.ajax({
type: 'GET',
url: '/category/brand/addBrandSearch',
data: 'brandId=' + brandId,
data: 'brandName=' + brandName,
success: function(data) {
},
error: function() {
... ... @@ -30,20 +30,24 @@ function addHistory(brandId) {
//绑定提交前的存local操作
function bindWirteLocal($brandList) {
$brandList.on('click', 'p', function(e) {
var a,brandName,brandId,url;
var query = brandName + url,
var brandName,brandId,url;
var a = $(this).find('a');
var query = a.attr('brandName') + a.attr('href'),
historys;
e.preventDefault();
a = $(this).find('a');
brandName = a.attr('brandName');
brandId = a.attr('brandId');
url = a.attr('href');
e.preventDefault();
if ($('.net-search').length > 0) {
addHistory(brandName);
location.href = url;
return;
}
if (localStorage) {
historys = localStorage.getItem('historys-brand');
... ... @@ -64,9 +68,7 @@ function bindWirteLocal($brandList) {
localStorage.setItem('historys-brand', historys);
}
if ($('.net-search').length > 0) {
addHistory(brandId);
}
location.href = url;
});
... ...
... ... @@ -19,7 +19,7 @@
{{#if historySearch}}
<div class="history-search net-search hide">
<h3><span class="iconfont">&#xe64a;</span>最近搜索
<button id="clear-history" class="clear-icon iconfont hide">&#xe64c;;</button>
<button id="clear-history" class="clear-icon iconfont hide">&#xe64c;</button>
</h3>
<ul class="history clearfix">
{{# history}}
... ...