Authored by ccbikai

merge code

... ... @@ -430,6 +430,8 @@
//列表页
{
ps: {
sName: '',
pName: '',
star: [
{
deps: '',
... ...
... ... @@ -6,6 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
... ... @@ -14,9 +15,10 @@ var filter = require('../../plugin/filter');
var loading = require('../../plugin/loading');
var $goodsContainer = $('#goods-container'),
$ngc = $($goodsContainer.children().get(0)),
$pgc = $($goodsContainer.children().get(1)),
$dgc = $($goodsContainer.children().get(2));
$goodsChildren = $goodsContainer.children(),
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)),
$dgc = $($goodsChildren.get(2));
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -56,6 +58,7 @@ var $listNav = $('#list-nav'),
}
},
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
navHammer,
searching;
if ($('.swiper-container .swiper-slide').length > 1) {
... ... @@ -82,6 +85,10 @@ function search(opt) {
nav, navType,
page;
if (searching) {
return;
}
if (opt) {
//筛选项变更则重置reload为true
... ... @@ -136,9 +143,6 @@ function search(opt) {
$.extend(defaultOpt, ext); //扩展筛选项
}
if (searching) {
return;
}
//导航类别
if ($pre.hasClass('new')) {
... ... @@ -174,7 +178,8 @@ function search(opt) {
url: '/product/newsale/selectNewSale',
data: setting,
success: function(data) {
var $container;
var $container,
num;
switch (navType) {
case 'newest':
... ... @@ -197,11 +202,15 @@ function search(opt) {
} else {
if (nav.reload) {
$container.html(data);
lazyLoad($container.find('.lazy'));
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
lazyLoad($container.find('.lazy'));
}
nav.reload = false;
... ... @@ -214,19 +223,37 @@ function search(opt) {
}
$.ajax({
type: 'GET',
url: '/newArrival/filter',
data: defaultOpt,
success: function(data) {
$goodsContainer.append(data);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
});
}
});
lazyLoad($('.lazy'));
filter.registerCbFn(search);
// loading.initLoadingMask();
//导航栏点击逻辑说明:
//1.点击非active项时切换active状态
//2.价格和折扣active状态时继续点击切换排序
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
navHammer = new Hammer($listNav[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
nav,
navType,
$active;
... ...
... ... @@ -6,17 +6,22 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
var swiper,
$ngc,
$pgc,
$dgc;
var filter = require('../../plugin/filter');
var loading = require('../../plugin/loading');
var $goodsContainer = $('#goods-container'),
$ngc = $($goodsContainer.children().get(0)),
$pgc = $($goodsContainer.children().get(1)),
$dgc = $($goodsContainer.children().get(2));
$goodsChildren = $goodsContainer.children(),
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)).addClass('hide'),
$dgc = $($goodsChildren.get(2)).addClass('hide');
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -60,11 +65,9 @@ var $listNav = $('#list-nav'),
}
},
$pre = $listNav.find('.active'), //纪录进入筛选前的active项,初始为选中项
navHammer,
searching;
$pgc.addClass('hide');
$dgc.addClass('hide');
$('#today a').text(month + '月' + date + '号');
if ($('.swiper-container .swiper-slide').length > 1) {
... ... @@ -92,6 +95,10 @@ function search(opt) {
dayLimit,
page;
if (searching) {
return;
}
if (opt) {
//筛选项变更则重置reload为true
... ... @@ -161,10 +168,6 @@ function search(opt) {
$.extend(defaultOpt, ext); //扩展筛选项
}
if (searching) {
return;
}
//导航类别
if ($pre.hasClass('today')) {
navType = 'today';
... ... @@ -201,7 +204,8 @@ function search(opt) {
url: '/product/newsale/selectNewSale',
data: setting,
success: function(data) {
var $container;
var $container,
num;
switch (navType) {
case 'today':
... ... @@ -224,11 +228,15 @@ function search(opt) {
} else {
if (nav.reload) {
$container.html(data);
lazyLoad($container.find('.lazy'));
} else {
num = $container.find('.good-info').length;
$container.append(data);
//lazy good-infos who append in
lazyLoad($container.find('.good-info:gt(' + (num - 1) + ') .lazy'));
}
lazyLoad($container.find('.lazy'));
}
nav.reload = false;
... ... @@ -241,19 +249,37 @@ function search(opt) {
}
$.ajax({
type: 'GET',
url: '/product/newsale/filter',
data: defaultOpt,
success: function(data) {
$goodsContainer.append(data);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
hCbFn: function() {
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
});
}
});
lazyLoad($('.lazy'));
filter.registerCbFn(search);
//导航栏点击逻辑说明:
//1.点击非active项时切换active状态
//2.价格和折扣active状态时继续点击切换排序
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
navHammer = new Hammer($listNav[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
nav,
navType,
$active;
... ...
{{>layout/header}}
<div class="ps-list-page ps-page yoho-page">
{{# ps}}
<ul id="nav-tab" class="nav-tab clearfix">
<li class="star-nav focus">设计师</li>
<li class="plus-nav">经典潮牌</li>
</ul>
<div id="ps-content" class="ps-content">
<ul class="star-content content">
{{# star}}
{{> guang/ps_item}}
{{/ star}}
</ul>
<ul class="plus-content content hide">
{{# plus}}
{{> guang/ps_item}}
{{/ plus}}
</ul>
</div>
{{/ ps}}
</div>
{{>layout/footer}}
\ No newline at end of file
... ... @@ -2,8 +2,8 @@
<div class="ps-list-page ps-page yoho-page">
{{# ps}}
<ul id="nav-tab" class="nav-tab clearfix">
<li class="star-nav focus">明星潮品</li>
<li class="plus-nav">原创潮牌</li>
<li class="star-nav focus">{{sName}}</li>
<li class="plus-nav">{{pName}}</li>
</ul>
<div id="ps-content" class="ps-content">
<ul class="star-content content">
... ...