Authored by ccbikai

Merge branch 'develop' of http://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);
... ...
... ... @@ -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
... ...
... ... @@ -256,6 +256,13 @@
}
}
}
&.no-item{
height: pxToRem(200px);
line-height: pxToRem(200px);
color: #e0e0e0;
text-align: center;
}
}
}
... ...
... ... @@ -318,7 +318,7 @@ $basicBtnC:#eb0313;
.store-logo {
// padding-right: 35rem/$pxConvertRem;
img {
width: pxToRem(109px);
width: auto;
height: pxToRem(68px);
margin-left: 0;
margin-right: pxToRem(-25px);
... ... @@ -392,9 +392,11 @@ $basicBtnC:#eb0313;
}
}
.recommend-for-you {
margin-bottom: pxToRem(120px);
margin-bottom: pxToRem(30px);
}
}
.bottom-blank{
height: pxToRem(120px);
}
@import "comments-consults";
@import "product-description";
... ...
... ... @@ -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}}
... ...
{{> layout/header}}
<div class="iHelp">
<div class="helpSearch">
<input type="text">
<input type="text" placeholder="查找关键字">
<i class="iconfont">&#xe60f;</i>
</div>
<ul>
... ...
... ... @@ -113,8 +113,8 @@
</div>
{{/ enterStore}}
<!-- <div id="productDesc"></div> -->
{{> product/product-description}}
<div id="productDesc"></div>
<!-- {{> product/product-description}} -->
{{> product/recommend-for-you}}
{{#cartInfo}}
... ... @@ -140,4 +140,5 @@
{{/if}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
<div class="bottom-blank"></div>
\ No newline at end of file
... ...
... ... @@ -55,7 +55,7 @@
<span class="iconfont">&#xe604;</span></a>
</div>
{{else}}
<div class="comment-content-main content-main no-item">
<div class="consult-content-main content-main no-item">
<span class="iconfont">&#xe63c;</span>暂无咨询
</div>
<div class="consult-content-footer">
... ...