...
|
...
|
@@ -72,7 +72,7 @@ require('../../common'); |
|
|
ellipsis.init();
|
|
|
|
|
|
// pageCache 获取是否收藏
|
|
|
(function () {
|
|
|
(function() {
|
|
|
if ($('.domain').val()) {
|
|
|
$.ajax({
|
|
|
url: '/product/index/brandFav',
|
...
|
...
|
@@ -80,12 +80,12 @@ ellipsis.init(); |
|
|
domain: $('.domain').val()
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
if (data.collected) {
|
|
|
$('.brand-header .btn-col').addClass('coled');
|
|
|
}
|
|
|
},
|
|
|
error: function () {
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -96,12 +96,12 @@ ellipsis.init(); |
|
|
shopId: $('.shopId').val()
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
if (data.collect) {
|
|
|
$('.brand-header .btn-col').addClass('coled');
|
|
|
}
|
|
|
},
|
|
|
error: function () {
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -114,7 +114,7 @@ function inputAction() { |
|
|
var $icon = $('.search-icon');
|
|
|
var $searchItems = $('.search-items');
|
|
|
|
|
|
$input.on('input', function () {
|
|
|
$input.on('input', function() {
|
|
|
if ($input.val() === '') {
|
|
|
$icon.css('color', '#b2b2b2');
|
|
|
$clear.addClass('hide');
|
...
|
...
|
@@ -134,7 +134,7 @@ function inputAction() { |
|
|
keyword: $input.val()
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
var ajaxHtml = '';
|
|
|
var i;
|
|
|
|
...
|
...
|
@@ -150,12 +150,12 @@ function inputAction() { |
|
|
$searchAssociate.html('');
|
|
|
}
|
|
|
|
|
|
$searchAssociate.find('li').on('touchend', function () {
|
|
|
$searchAssociate.find('li').on('touchend', function() {
|
|
|
$buriedpoint.val($(this).find('.keyword').html());
|
|
|
$search.closest('form').submit();
|
|
|
});
|
|
|
},
|
|
|
error: function () {
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -164,14 +164,14 @@ function inputAction() { |
|
|
|
|
|
inputAction();
|
|
|
|
|
|
$clear.on('touchend', function () {
|
|
|
$clear.on('touchend', function() {
|
|
|
$input.val('').trigger('input');
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 手动触发搜索
|
|
|
*/
|
|
|
$search.on('touchend', function () {
|
|
|
$search.on('touchend', function() {
|
|
|
$(this).closest('form').submit();
|
|
|
return false;
|
|
|
});
|
...
|
...
|
@@ -196,6 +196,7 @@ age_level = getQueryString('ageLevel'); |
|
|
app_type = getQueryString('app_type');
|
|
|
msort = getQueryString('msort');
|
|
|
misort = getQueryString('misort');
|
|
|
|
|
|
/**
|
|
|
* 筛选注册的回调,筛选子项点击后逻辑
|
|
|
* 需要执行search的场景:1.点选筛选项;2.relaod为true时切换导航;3.下拉加载
|
...
|
...
|
@@ -353,7 +354,7 @@ function search(opt) { |
|
|
type: 'GET',
|
|
|
url: location.protocol + '//m.yohobuy.com/product/search/search',
|
|
|
data: setting,
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
var noResult = '<p class="no-result">未找到相关搜索结果</p>',
|
|
|
num,
|
|
|
$container;
|
...
|
...
|
@@ -400,7 +401,7 @@ function search(opt) { |
|
|
|
|
|
window.rePosFooter();
|
|
|
|
|
|
$('.good-detail-text .name').each(function () {
|
|
|
$('.good-detail-text .name').each(function() {
|
|
|
$this = $(this);
|
|
|
$title = $this.find('a');
|
|
|
|
...
|
...
|
@@ -442,13 +443,13 @@ $.ajax({ |
|
|
type: 'GET',
|
|
|
url: location.protocol + '//m.yohobuy.com/product/search/filter',
|
|
|
data: defaultOpt,
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
$goodsContainer.append(data);
|
|
|
|
|
|
// 初始化filter&注册filter回调
|
|
|
filter.initFilter({
|
|
|
fCbFn: search,
|
|
|
hCbFn: function () {
|
|
|
hCbFn: function() {
|
|
|
|
|
|
// 切换active状态到$pre上
|
|
|
$pre.addClass('active');
|
...
|
...
|
@@ -469,11 +470,11 @@ writeSearch.bindWirteLocal($('#search-form')); |
|
|
// 4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
|
|
|
// 5.当前active为筛选并且点击其他项时,隐藏筛选面板
|
|
|
|
|
|
$listNav.bind('contextmenu', function () {
|
|
|
$listNav.bind('contextmenu', function() {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$listNav.on('touchend touchcancel', function (e) {
|
|
|
$listNav.on('touchend touchcancel', function(e) {
|
|
|
var $this = $(e.target).closest('li'),
|
|
|
nav,
|
|
|
navType,
|
...
|
...
|
@@ -575,7 +576,7 @@ function scrollHandler() { |
|
|
}
|
|
|
|
|
|
// srcoll to load more
|
|
|
$(window).scroll(function () {
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
|
...
|
...
|
@@ -583,7 +584,7 @@ if ($brandHeader.length > 0) { |
|
|
|
|
|
// 品牌介绍
|
|
|
btnIntroHammer = new Hammer($brandHeader.children('.btn-intro')[0]);
|
|
|
btnIntroHammer.on('tap', function () {
|
|
|
btnIntroHammer.on('tap', function() {
|
|
|
$introBox.removeClass('hide');
|
|
|
|
|
|
// 防止混合scroll发生
|
...
|
...
|
@@ -592,7 +593,7 @@ if ($brandHeader.length > 0) { |
|
|
|
|
|
// 关闭品牌介绍
|
|
|
introHammer = new Hammer(document.getElementById('intro-box'));
|
|
|
introHammer.on('tap', function (e) {
|
|
|
introHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target);
|
|
|
|
|
|
e.srcEvent.preventDefault();
|
...
|
...
|
@@ -606,7 +607,7 @@ if ($brandHeader.length > 0) { |
|
|
|
|
|
// 品牌收藏
|
|
|
brandColHammer = new Hammer($brandHeader.children('.btn-col')[0]);
|
|
|
brandColHammer.on('tap', function (e) {
|
|
|
brandColHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target).closest('.btn-col');
|
|
|
|
|
|
var id = $brandHeader.data('id'),
|
...
|
...
|
@@ -629,7 +630,7 @@ if ($brandHeader.length > 0) { |
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
success: function (data) {
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('coled');
|
|
|
|
...
|
...
|
@@ -645,7 +646,7 @@ if ($brandHeader.length > 0) { |
|
|
tip.show(data.message);
|
|
|
}
|
|
|
},
|
|
|
error: function () {
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -655,9 +656,9 @@ if ($brandHeader.length > 0) { |
|
|
// 初始请求最新第一页数据
|
|
|
search();
|
|
|
|
|
|
$listNav.on('touchstart', 'li', function () {
|
|
|
$listNav.on('touchstart', 'li', function() {
|
|
|
$listNav.find('li').removeClass('bytouch');
|
|
|
$(this).addClass('bytouch');
|
|
|
}).on('touchend touchcancel', 'li', function () {
|
|
|
}).on('touchend touchcancel', 'li', function() {
|
|
|
$listNav.find('li').removeClass('bytouch');
|
|
|
}); |
...
|
...
|
|