Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop
Showing
2 changed files
with
8 additions
and
5 deletions
framework @ 75bbc3b0
@@ -10,6 +10,8 @@ var $ = require('jquery'), | @@ -10,6 +10,8 @@ var $ = require('jquery'), | ||
10 | lazyLoad = require('yoho.lazyload'); | 10 | lazyLoad = require('yoho.lazyload'); |
11 | 11 | ||
12 | var swiper, | 12 | var swiper, |
13 | + $brandText, | ||
14 | + $brandHref, | ||
13 | $brandList = $('.brand-list'); | 15 | $brandList = $('.brand-list'); |
14 | 16 | ||
15 | var searchH = $('.newbrand-search').outerHeight(), | 17 | var searchH = $('.newbrand-search').outerHeight(), |
@@ -137,14 +139,15 @@ function searchResult() { | @@ -137,14 +139,15 @@ function searchResult() { | ||
137 | $('.search-result .brand-list p').each(function (index) { | 139 | $('.search-result .brand-list p').each(function (index) { |
138 | searchList = new Hammer($('.search-result .brand-list p').eq(index)[0]); | 140 | searchList = new Hammer($('.search-result .brand-list p').eq(index)[0]); |
139 | searchList.on('tap', function() { | 141 | searchList.on('tap', function() { |
142 | + $brandText = $('.search-result .brand-list p').eq(index).find('a').html(); | ||
143 | + $brandHref = $('.search-result .brand-list p').eq(index).find('a').attr('href'); | ||
140 | if (localStorage.getItem('yohoHistory')) { | 144 | if (localStorage.getItem('yohoHistory')) { |
141 | yohoHistory = localStorage.getItem('yohoHistory'); | 145 | yohoHistory = localStorage.getItem('yohoHistory'); |
142 | searchArray.push(yohoHistory); | 146 | searchArray.push(yohoHistory); |
143 | } | 147 | } |
144 | - searchArray.push('{"searchName":"' + | ||
145 | - $('.search-result .brand-list p').eq(index).find('a').html() + | ||
146 | - '","searchHref":"' + $('.search-result .brand-list p') | ||
147 | - .eq(index).find('a').attr('href') + '"}'); | 148 | + if (searchArray.toString().split($brandText).length < 2) { |
149 | + searchArray.push('{"searchName":"' + $brandText + '","searchHref":"' + $brandText + '"}'); | ||
150 | + } | ||
148 | localStorage.setItem('yohoHistory', searchArray); | 151 | localStorage.setItem('yohoHistory', searchArray); |
149 | }); | 152 | }); |
150 | }); | 153 | }); |
-
Please register or login to post a comment