Authored by 梁志锋

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $nav = $('.category-nav'),
$categoryContainer = $('.category-container'),
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper');
var info = require('./info'),
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
... ... @@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) {
success: function(data) {
if (data.code === 200) {
$this.toggleClass('like');
} else if (data.code === 400) {
} else if (data.code === 400 || data.code === 412) {
//code:412 用户ID不正确,即未登录
tip.show('未登录');
} else {
tip.show(data.message);
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
... ...
... ... @@ -4,7 +4,7 @@
* @date: 2015/10/12
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload'),
$mobileWrap = $('.mobile-wrap'),
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho.lazyload');
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var floatLayerCloseHammer, floatLayerBtnHammer;
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $input = $('#search-input input');
... ...
... ... @@ -6,7 +6,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Hammer = require('yoho.hammer');
var $filter;
... ... @@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态
//隐藏筛选界面
function hideFilter() {
$filter.addClass('hide');
if (missStatus) {
//重置一级筛选项选中状态
$filter.find('.classify-item.active').removeClass('active');
$filter.find('.classify-item:first-child').addClass('active');
}
}
//显示筛选界面
... ... @@ -31,6 +24,7 @@ function showFilter() {
$filter.removeClass('hide');
}
//主筛选项Tap事件句柄
function classifyTapEvt($this) {
if ($this.hasClass('active')) {
return;
... ... @@ -41,9 +35,8 @@ function classifyTapEvt($this) {
$this.addClass('active');
}
function subClassifyTapEvt($this) {
var id = $this.data('id');
//子筛选项选中处理
function setSubClassify($this) {
var $sub = $this.closest('.sub-classify');
var $shower = $sub.siblings('.shower');
... ... @@ -72,6 +65,17 @@ function subClassifyTapEvt($this) {
$shower.removeClass('default');
}
return $sub;
}
//子筛选项Tap句柄
function subClassifyTapEvt($this) {
var id = $this.data('id');
var $sub;
$sub = setSubClassify($this);
if (fCbFn) {
fCbFn({
type: $sub.data('type'),
... ... @@ -80,12 +84,6 @@ function subClassifyTapEvt($this) {
}
hideFilter();
//重置选中状态
if (missStatus) {
$this.removeClass('chosed');
$sub.children(':first-child').addClass('chosed');
}
}
//初始化筛选
... ... @@ -133,8 +131,25 @@ function initFilter(opt) {
});
}
//重置筛选面板
function resetFilter() {
if (typeof $filter === 'undefined') {
return;
}
//重置子筛选项
$('.sub-classify').each(function() {
setSubClassify($(this).children(':first-child'));
});
//重置主筛选项
classifyTapEvt($('.classify > :first-child'));
}
exports.initFilter = initFilter;
exports.showFilter = showFilter;
exports.hideFilter = hideFilter;
\ No newline at end of file
exports.hideFilter = hideFilter;
exports.resetFilter = resetFilter;
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
//品牌页参数
... ...
... ... @@ -6,7 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var swiper;
... ...
... ... @@ -6,7 +6,7 @@
var $ = require('jquery'),
Swiper = require('yoho.iswiper'),
Hammer = require('hammer'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
var swiper,
... ... @@ -41,6 +41,8 @@ var defaultOpt = {
dayLimit: 1
};
var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置
var now = new Date(),
month = now.getMonth() + 1,
date = now.getDate();
... ... @@ -267,8 +269,7 @@ $.ajax({
//切换active状态到$pre上
$pre.addClass('active');
$pre.siblings('.filter').removeClass('active');
},
missStatus: true
}
});
}
});
... ... @@ -343,6 +344,10 @@ navHammer.on('tap', function(e) {
$dgc.removeClass('hide');
break;
}
//重置筛选项
filter.resetFilter();
defaultOpt = $.extend({}, storeOpt);
}
$active.removeClass('active');
... ...
... ... @@ -23,7 +23,7 @@
"import-style": "1.0.0",
"yoho.lazyload": "1.1.0",
"yoho.handlebars": "3.0.3",
"hammer": "2.0.4"
"yoho.hammer": "2.0.4"
},
"devDependencies": {
"expect.js": "0.3.1"
... ...
... ... @@ -91,20 +91,20 @@
padding-top: 50%;
width: 100%;
position: absolute;
top: -230rem / $pxConvertRem;
top: -180rem / $pxConvertRem;
.list-item {
display: block;
position: relative;
margin: 0 auto 50rem / $pxConvertRem;
width: 444rem / $pxConvertRem;
height: 110rem / $pxConvertRem;
margin: 0 auto 40rem / $pxConvertRem;
width: 216px;
height: 52px;
text-align: center;
font-size: 30rem / $pxConvertRem;
line-height: 110rem / $pxConvertRem;
font-size: 16px;
line-height: 52px;
color: #fff;
background: #000;
border: 5rem / $pxConvertRem solid #fff;
border: 4px solid #fff;
font-weight: bold;
}
.lighter {
... ...