Authored by Lynnic

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

... ... @@ -9,7 +9,10 @@ var $searchBox = $('.search-box'),
$box = $('.box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo'),
$channelLink = $('.index-channel a');
$channelLink = $('.index-channel a'),
$win = $(window),
$doc = $(document),
$appFloatLayer = $('#float-layer-app');
var $search = $searchBox.children('input[type="text"]'),
$cancelSearch = $box.children('.no-search'),
... ... @@ -65,3 +68,43 @@ $channelLink.on('touchstart', function() {
borderColor: '#fff'
});
});
var removeAppFloatLayerFixed = (function() {
var init = false;
return function() {
var winHeight = window.innerHeight;
var bodyHeight = $doc.height();
var scrollTopPosition = $win.scrollTop();
var layerHeight = $appFloatLayer.height();
var layerPaddingTop = parseInt($appFloatLayer.css('padding-top'));
var layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom'));
var newPosition;
if(init){
newPosition = bodyHeight - winHeight- scrollTopPosition;
}else{
init = true;
newPosition = bodyHeight - winHeight - scrollTopPosition + layerHeight + layerPaddingTop + layerPaddingBottom;
}
$appFloatLayer.css({
'position': 'relative',
'bottom': newPosition + 'px'
});
};
})();
$win.scroll(function() {
clearTimeout($.data(this, 'scrollTimer'));
$.data(this, 'scrollTimer', setTimeout(function() {
removeAppFloatLayerFixed();
}, 2));
});
$win.on('resize', function(){
console.log('resize');
});
$win.on('scrollstop', function(){
console.log('stop');
});
$doc.on('ready', removeAppFloatLayerFixed);
... ...
... ... @@ -7,6 +7,7 @@
require('./order');
require('./order-detail');
require('./fav');
require('./suggest');
require('./index');
require('./coupons');
require('./online-service');
... ...
... ... @@ -44,7 +44,6 @@ function initSwiper() {
$swiperList = $('.swiper-container');
for (i = 0; i < $swiperList.length; i++) {
id = $swiperList.eq(i).attr('data-id');
console.log(id);
if (!!swiperObj[id]) {
swiperObj[id].destroy(true, true);
... ... @@ -91,7 +90,7 @@ function loadData($parent, url, page) {
} else if (data.length > 10) {
$parent.append(data);
$parent.closest('.fav-type').find('.fav-content-loading').remove();
if (url === 'favBrand') {
initSwiper();//如果是收藏品牌需要初始化swiper
... ... @@ -142,6 +141,7 @@ favTabHammer.on('tap', function(e) {
loadData($favProductList, 'favProduct', 1);
}
} else {
brandTab = true;
if ($favBrandList.find('div').length === 0 &&
$favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) {
loadData($favBrandList, 'favBrand', 1);
... ... @@ -211,12 +211,13 @@ $(document).scroll(function() {
if ($(window).scrollTop() + winH >= $(document).height() - footerH) {
if (brandTab) {
console.log(1);
$brandLoadMore.filter('.hide').removeClass('hide');
if (!brandLockId) {
brandPageId++;
loadData($favBrandList, 'favBrand', brandPageId);
}
} else {
... ... @@ -224,7 +225,6 @@ $(document).scroll(function() {
$loadMore.filter('.hide').removeClass('hide');
if (!lockId) {
console.log(222);
pageId++;
loadData($favProductList, 'favProduct', pageId);
}
... ...
... ... @@ -20,14 +20,15 @@ var $uploadImgList = $('.upload-img-list'),
$likeBtn = $('.suggest-item .like-btn'),
$disLikeBtn = $('.suggest-item .dislike-btn'),
$imgAdd = $('.img-add'),
imgStr = '';
imgStr = '',
uploadImgNum = 0;
require('./jquery.uploadifive');
imgTpl = '{{# imgList}}' +
'<li>' +
'<img src="{{imgUrl}}" />' +
'<span class="upload-img-remove"></span>' +
'{{# imgUrl}}<img src="{{.}}" />' +
'<span class="upload-img-remove"></span>{{/ imgUrl}}' +
'</li>' +
'{{/ imgList}}';
... ... @@ -41,16 +42,20 @@ $('#upload-img').uploadifive({
fileSizeLimit: 1024,
height: '100%',
width: '100%',
queueSizeLimit: 1,
multi: false,
onAddQueueItem: function(files) {
//TODO
$uploadImgList.html(imgTemplate({
imgList: true
}));
},
onUploadComplete: function(file, data) {
$uploadImgList.html('');
imgStr = JSON.parse(data).imgList[0].imgRelUrl;
$uploadImgList.html(imgTemplate(JSON.parse(data)));
$imgAdd.hide();
uploadImgNum++;
}
});
... ... @@ -92,6 +97,7 @@ if (document.getElementById('img-form') !== null) {
if ($(e.target).hasClass('upload-img-remove')) {
$uploadImgList.html('');
imgStr = '';
uploadImgNum--;
setTimeout(function() {
$imgAdd.show();
}, 50);
... ...
... ... @@ -180,6 +180,7 @@
}
.my-address-list-page {
position: relative;
width: 100%;
color: #444;
background: #fff;
... ...
... ... @@ -291,4 +291,10 @@
@include background-size(auto 40%);
}
}
.fav-content-loading {
width: 100%;
height: 2rem;
background: image_url('loading.gif') center center no-repeat;
@include background-size(auto 40%);
}
}
\ No newline at end of file
... ...
.my-page {
color: #444;
background: #f0f0f0;
padding-bottom: pxToRem(20px);
a {
color: #444;
... ...
... ... @@ -8,6 +8,7 @@
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list"></ul>
<div class="fav-content-loading"></div>
<div class="fav-null-box hide">
<span class="fav-null">您暂无收藏任何商品</span>
... ... @@ -17,12 +18,13 @@
</div>
<div class="fav-type">
<div class="fav-brand-swiper"></div>
<div class="fav-content-loading"></div>
<div class="fav-null-box hide">
<span class="fav-null">您暂无收藏任何品牌</span>
<a class="go-shopping" href="{{brandUrl}}">随便逛逛</a>
</div>
<div class="fav-brand-load-more load-background hide"></div>
<div class="fav-brand-load-more fav-load-background hide"></div>
</div>
</div>
{{/ favorite}}
... ...