...
|
...
|
@@ -15,11 +15,11 @@ var swiper, |
|
|
$brandList = $('.brand-list'),
|
|
|
$icon = $('.search-icon'),
|
|
|
$genderItem = $('.genderNav li'),
|
|
|
$searchAction = $('.search-action'),
|
|
|
hotBrandsSwiper;
|
|
|
$brandItem = $('.brandNav li'),
|
|
|
$newBrandWall = $('.new-brand-wall'),
|
|
|
$recommandBrandWall = $('.recommand-brand-wall');
|
|
|
$recommandBrandWall = $('.recommand-brand-wall'),
|
|
|
$searchAction = $('.search-action'),
|
|
|
hotBrandsSwiper;
|
|
|
|
|
|
var searchH = $('.newbrand-search').outerHeight(),
|
|
|
headerH = $('.yoho-header').outerHeight(),
|
...
|
...
|
@@ -40,7 +40,7 @@ var writeSearch = require('./write-search'); |
|
|
|
|
|
var ranToken = writeSearch.getRanToken();
|
|
|
|
|
|
var chHammer, cHammer;
|
|
|
var chHammer;
|
|
|
|
|
|
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -70,11 +70,11 @@ $('.yoho-header').css({ |
|
|
|
|
|
//热门品牌滑动
|
|
|
hotBrandsSwiper = new Swiper('.brands-swiper', {
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
|
|
wrapperClass: 'brands-list',
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
grabCursor: true,
|
|
|
slidesPerView: 'auto',
|
|
|
wrapperClass: 'brands-list',
|
|
|
slideElement: 'li'
|
|
|
});
|
|
|
})();
|
|
|
|
|
|
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
|
...
|
...
|
@@ -154,7 +154,8 @@ function searchResult() { |
|
|
brandHtml.push('</h2></div>');
|
|
|
$.each(v, function(i, brand) {
|
|
|
|
|
|
brandHtml.push('<p><a href="' + brand.url + '" brandName = "'+brand.name+'" brandId = "' + brand.brandId + '">' + brand.name);
|
|
|
brandHtml.push('<p><a href="' + brand.url + '" brandName = "' + brand.name +
|
|
|
'" brandId = "' + brand.brandId + '" brandDomain = "' + brand.brandDomain + '">' + brand.name);
|
|
|
if (brand.isNew) {
|
|
|
brandHtml.push('<i class="icon-new">NEW</i>');
|
|
|
}
|
...
|
...
|
@@ -170,17 +171,16 @@ function searchResult() { |
|
|
}
|
|
|
|
|
|
//没填入关键词时显示最热搜索
|
|
|
if(keyword.length >0){
|
|
|
if (keyword.length > 0) {
|
|
|
$('.search-brand-page').addClass('hide');
|
|
|
}else{
|
|
|
} else {
|
|
|
$('.search-brand-page').removeClass('hide');
|
|
|
}
|
|
|
|
|
|
// 插入 dom,绑定事件
|
|
|
$('.search-result').html(html);
|
|
|
changeBackground();
|
|
|
var $brandList = $('.brand-list');
|
|
|
writeSearch.bindWirteLocal($brandList);
|
|
|
writeSearch.bindWirteLocal($('.brand-list'));
|
|
|
}
|
|
|
|
|
|
if ($('.brand-search-page').length > 0) {
|
...
|
...
|
@@ -237,7 +237,7 @@ if ($genderItem.length > 0) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
if ($brandItem.length > 0 ) {
|
|
|
if ($brandItem.length > 0) {
|
|
|
$brandItem.on('click', function() {
|
|
|
var index = $(this).data('id');
|
|
|
|
...
|
...
|
@@ -245,25 +245,47 @@ if ($brandItem.length > 0 ) { |
|
|
$(this).addClass('active');
|
|
|
|
|
|
|
|
|
if (index === 0){
|
|
|
if (index === 0) {
|
|
|
|
|
|
$recommandBrandWall.not('.hide').addClass('hide');
|
|
|
$newBrandWall.not('.hide').addClass('hide');
|
|
|
$brandList.removeClass('hide');
|
|
|
}else if (index === 1){
|
|
|
|
|
|
} else if (index === 1) {
|
|
|
|
|
|
$newBrandWall.removeClass('hide');
|
|
|
$brandList.not('.hide').addClass('hide');
|
|
|
$recommandBrandWall.not('.hide').addClass('hide');
|
|
|
}else {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$recommandBrandWall.removeClass('hide');
|
|
|
$brandList.not('.hide').addClass('hide');
|
|
|
$newBrandWall.not('.hide').addClass('hide');
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 清除记录
|
|
|
*/
|
|
|
function removeHistory() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/category/brand/delBrandHistory',
|
|
|
data: '',
|
|
|
success: function(data) {
|
|
|
},
|
|
|
error: function() {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//初始化历史搜索的内容
|
|
|
if ($('.brand-search-page').length >0) {
|
|
|
|
|
|
if ($('.brand-search-page').length > 0) {
|
|
|
|
|
|
chHammer = new Hammer($clearHistory[0]);
|
|
|
chHammer.on('tap', function() {
|
...
|
...
|
@@ -273,7 +295,7 @@ if ($('.brand-search-page').length >0) { |
|
|
$historySearch.hide();
|
|
|
$clearHistory.hide();
|
|
|
|
|
|
if ($('.net-search').length > 0){
|
|
|
if ($('.net-search').length > 0) {
|
|
|
removeHistory();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -282,7 +304,7 @@ if ($('.brand-search-page').length >0) { |
|
|
|
|
|
//搜索页面
|
|
|
|
|
|
(function () {
|
|
|
(function() {
|
|
|
var html = '',
|
|
|
history,
|
|
|
historys, i,
|
...
|
...
|
@@ -299,7 +321,7 @@ if ($('.brand-search-page').length >0) { |
|
|
if (history === '') {
|
|
|
continue;
|
|
|
}
|
|
|
locate = history.indexOf("http://");
|
|
|
locate = history.indexOf('http://');
|
|
|
brand = history.substr(0, locate);
|
|
|
url = history.substr(locate, history.length - locate);
|
|
|
|
...
|
...
|
@@ -317,21 +339,3 @@ if ($('.brand-search-page').length >0) { |
|
|
}());
|
|
|
|
|
|
} |
|
|
|
|
|
/**
|
|
|
* 清除记录
|
|
|
*/
|
|
|
function removeHistory()
|
|
|
{
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/category/brand/delBrandHistory',
|
|
|
data: '',
|
|
|
success: function (data) {
|
|
|
|
|
|
},
|
|
|
error: function () {
|
|
|
//showTip('网络断开连接啦~');
|
|
|
}
|
|
|
});
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|