Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
11 changed files
with
86 additions
and
18 deletions
@@ -9,7 +9,10 @@ var $searchBox = $('.search-box'), | @@ -9,7 +9,10 @@ var $searchBox = $('.search-box'), | ||
9 | $box = $('.box'), | 9 | $box = $('.box'), |
10 | $indexSearch = $('.index-search'), | 10 | $indexSearch = $('.index-search'), |
11 | $indexLogo = $('.index-logo'), | 11 | $indexLogo = $('.index-logo'), |
12 | - $channelLink = $('.index-channel a'); | 12 | + $channelLink = $('.index-channel a'), |
13 | + $win = $(window), | ||
14 | + $doc = $(document), | ||
15 | + $appFloatLayer = $('#float-layer-app'); | ||
13 | 16 | ||
14 | var $search = $searchBox.children('input[type="text"]'), | 17 | var $search = $searchBox.children('input[type="text"]'), |
15 | $cancelSearch = $box.children('.no-search'), | 18 | $cancelSearch = $box.children('.no-search'), |
@@ -65,3 +68,43 @@ $channelLink.on('touchstart', function() { | @@ -65,3 +68,43 @@ $channelLink.on('touchstart', function() { | ||
65 | borderColor: '#fff' | 68 | borderColor: '#fff' |
66 | }); | 69 | }); |
67 | }); | 70 | }); |
71 | +var removeAppFloatLayerFixed = (function() { | ||
72 | + var init = false; | ||
73 | + return function() { | ||
74 | + var winHeight = window.innerHeight; | ||
75 | + var bodyHeight = $doc.height(); | ||
76 | + var scrollTopPosition = $win.scrollTop(); | ||
77 | + var layerHeight = $appFloatLayer.height(); | ||
78 | + var layerPaddingTop = parseInt($appFloatLayer.css('padding-top')); | ||
79 | + var layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom')); | ||
80 | + var newPosition; | ||
81 | + if(init){ | ||
82 | + newPosition = bodyHeight - winHeight- scrollTopPosition; | ||
83 | + }else{ | ||
84 | + init = true; | ||
85 | + newPosition = bodyHeight - winHeight - scrollTopPosition + layerHeight + layerPaddingTop + layerPaddingBottom; | ||
86 | + } | ||
87 | + $appFloatLayer.css({ | ||
88 | + 'position': 'relative', | ||
89 | + 'bottom': newPosition + 'px' | ||
90 | + }); | ||
91 | + }; | ||
92 | +})(); | ||
93 | + | ||
94 | +$win.scroll(function() { | ||
95 | + | ||
96 | + clearTimeout($.data(this, 'scrollTimer')); | ||
97 | + $.data(this, 'scrollTimer', setTimeout(function() { | ||
98 | + removeAppFloatLayerFixed(); | ||
99 | + }, 2)); | ||
100 | +}); | ||
101 | + | ||
102 | +$win.on('resize', function(){ | ||
103 | + console.log('resize'); | ||
104 | +}); | ||
105 | + | ||
106 | +$win.on('scrollstop', function(){ | ||
107 | + console.log('stop'); | ||
108 | +}); | ||
109 | + | ||
110 | +$doc.on('ready', removeAppFloatLayerFixed); |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | require('./order'); | 7 | require('./order'); |
8 | require('./order-detail'); | 8 | require('./order-detail'); |
9 | require('./fav'); | 9 | require('./fav'); |
10 | +require('./suggest'); | ||
10 | require('./index'); | 11 | require('./index'); |
11 | require('./coupons'); | 12 | require('./coupons'); |
12 | require('./online-service'); | 13 | require('./online-service'); |
@@ -44,7 +44,6 @@ function initSwiper() { | @@ -44,7 +44,6 @@ function initSwiper() { | ||
44 | $swiperList = $('.swiper-container'); | 44 | $swiperList = $('.swiper-container'); |
45 | for (i = 0; i < $swiperList.length; i++) { | 45 | for (i = 0; i < $swiperList.length; i++) { |
46 | id = $swiperList.eq(i).attr('data-id'); | 46 | id = $swiperList.eq(i).attr('data-id'); |
47 | - console.log(id); | ||
48 | 47 | ||
49 | if (!!swiperObj[id]) { | 48 | if (!!swiperObj[id]) { |
50 | swiperObj[id].destroy(true, true); | 49 | swiperObj[id].destroy(true, true); |
@@ -91,7 +90,7 @@ function loadData($parent, url, page) { | @@ -91,7 +90,7 @@ function loadData($parent, url, page) { | ||
91 | 90 | ||
92 | } else if (data.length > 10) { | 91 | } else if (data.length > 10) { |
93 | $parent.append(data); | 92 | $parent.append(data); |
94 | - | 93 | + $parent.closest('.fav-type').find('.fav-content-loading').remove(); |
95 | if (url === 'favBrand') { | 94 | if (url === 'favBrand') { |
96 | initSwiper();//如果是收藏品牌需要初始化swiper | 95 | initSwiper();//如果是收藏品牌需要初始化swiper |
97 | 96 | ||
@@ -142,6 +141,7 @@ favTabHammer.on('tap', function(e) { | @@ -142,6 +141,7 @@ favTabHammer.on('tap', function(e) { | ||
142 | loadData($favProductList, 'favProduct', 1); | 141 | loadData($favProductList, 'favProduct', 1); |
143 | } | 142 | } |
144 | } else { | 143 | } else { |
144 | + brandTab = true; | ||
145 | if ($favBrandList.find('div').length === 0 && | 145 | if ($favBrandList.find('div').length === 0 && |
146 | $favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) { | 146 | $favBrandList.closest('.fav-type').find('.fav-null-box').hasClass('hide')) { |
147 | loadData($favBrandList, 'favBrand', 1); | 147 | loadData($favBrandList, 'favBrand', 1); |
@@ -211,12 +211,13 @@ $(document).scroll(function() { | @@ -211,12 +211,13 @@ $(document).scroll(function() { | ||
211 | if ($(window).scrollTop() + winH >= $(document).height() - footerH) { | 211 | if ($(window).scrollTop() + winH >= $(document).height() - footerH) { |
212 | 212 | ||
213 | if (brandTab) { | 213 | if (brandTab) { |
214 | + console.log(1); | ||
214 | 215 | ||
215 | $brandLoadMore.filter('.hide').removeClass('hide'); | 216 | $brandLoadMore.filter('.hide').removeClass('hide'); |
216 | 217 | ||
217 | if (!brandLockId) { | 218 | if (!brandLockId) { |
218 | - | ||
219 | brandPageId++; | 219 | brandPageId++; |
220 | + loadData($favBrandList, 'favBrand', brandPageId); | ||
220 | } | 221 | } |
221 | 222 | ||
222 | } else { | 223 | } else { |
@@ -224,7 +225,6 @@ $(document).scroll(function() { | @@ -224,7 +225,6 @@ $(document).scroll(function() { | ||
224 | $loadMore.filter('.hide').removeClass('hide'); | 225 | $loadMore.filter('.hide').removeClass('hide'); |
225 | 226 | ||
226 | if (!lockId) { | 227 | if (!lockId) { |
227 | - console.log(222); | ||
228 | pageId++; | 228 | pageId++; |
229 | loadData($favProductList, 'favProduct', pageId); | 229 | loadData($favProductList, 'favProduct', pageId); |
230 | } | 230 | } |
@@ -20,14 +20,15 @@ var $uploadImgList = $('.upload-img-list'), | @@ -20,14 +20,15 @@ var $uploadImgList = $('.upload-img-list'), | ||
20 | $likeBtn = $('.suggest-item .like-btn'), | 20 | $likeBtn = $('.suggest-item .like-btn'), |
21 | $disLikeBtn = $('.suggest-item .dislike-btn'), | 21 | $disLikeBtn = $('.suggest-item .dislike-btn'), |
22 | $imgAdd = $('.img-add'), | 22 | $imgAdd = $('.img-add'), |
23 | - imgStr = ''; | 23 | + imgStr = '', |
24 | + uploadImgNum = 0; | ||
24 | 25 | ||
25 | require('./jquery.uploadifive'); | 26 | require('./jquery.uploadifive'); |
26 | 27 | ||
27 | imgTpl = '{{# imgList}}' + | 28 | imgTpl = '{{# imgList}}' + |
28 | '<li>' + | 29 | '<li>' + |
29 | - '<img src="{{imgUrl}}" />' + | ||
30 | - '<span class="upload-img-remove"></span>' + | 30 | + '{{# imgUrl}}<img src="{{.}}" />' + |
31 | + '<span class="upload-img-remove"></span>{{/ imgUrl}}' + | ||
31 | '</li>' + | 32 | '</li>' + |
32 | '{{/ imgList}}'; | 33 | '{{/ imgList}}'; |
33 | 34 | ||
@@ -41,16 +42,20 @@ $('#upload-img').uploadifive({ | @@ -41,16 +42,20 @@ $('#upload-img').uploadifive({ | ||
41 | fileSizeLimit: 1024, | 42 | fileSizeLimit: 1024, |
42 | height: '100%', | 43 | height: '100%', |
43 | width: '100%', | 44 | width: '100%', |
44 | - queueSizeLimit: 1, | ||
45 | - | 45 | + multi: false, |
46 | onAddQueueItem: function(files) { | 46 | onAddQueueItem: function(files) { |
47 | 47 | ||
48 | //TODO | 48 | //TODO |
49 | + $uploadImgList.html(imgTemplate({ | ||
50 | + imgList: true | ||
51 | + })); | ||
49 | }, | 52 | }, |
50 | onUploadComplete: function(file, data) { | 53 | onUploadComplete: function(file, data) { |
54 | + $uploadImgList.html(''); | ||
51 | imgStr = JSON.parse(data).imgList[0].imgRelUrl; | 55 | imgStr = JSON.parse(data).imgList[0].imgRelUrl; |
52 | $uploadImgList.html(imgTemplate(JSON.parse(data))); | 56 | $uploadImgList.html(imgTemplate(JSON.parse(data))); |
53 | $imgAdd.hide(); | 57 | $imgAdd.hide(); |
58 | + uploadImgNum++; | ||
54 | } | 59 | } |
55 | }); | 60 | }); |
56 | 61 | ||
@@ -92,6 +97,7 @@ if (document.getElementById('img-form') !== null) { | @@ -92,6 +97,7 @@ if (document.getElementById('img-form') !== null) { | ||
92 | if ($(e.target).hasClass('upload-img-remove')) { | 97 | if ($(e.target).hasClass('upload-img-remove')) { |
93 | $uploadImgList.html(''); | 98 | $uploadImgList.html(''); |
94 | imgStr = ''; | 99 | imgStr = ''; |
100 | + uploadImgNum--; | ||
95 | setTimeout(function() { | 101 | setTimeout(function() { |
96 | $imgAdd.show(); | 102 | $imgAdd.show(); |
97 | }, 50); | 103 | }, 50); |
@@ -291,4 +291,10 @@ | @@ -291,4 +291,10 @@ | ||
291 | @include background-size(auto 40%); | 291 | @include background-size(auto 40%); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | + .fav-content-loading { | ||
295 | + width: 100%; | ||
296 | + height: 2rem; | ||
297 | + background: image_url('loading.gif') center center no-repeat; | ||
298 | + @include background-size(auto 40%); | ||
299 | + } | ||
294 | } | 300 | } |
@@ -318,7 +318,7 @@ $basicBtnC:#eb0313; | @@ -318,7 +318,7 @@ $basicBtnC:#eb0313; | ||
318 | .store-logo { | 318 | .store-logo { |
319 | // padding-right: 35rem/$pxConvertRem; | 319 | // padding-right: 35rem/$pxConvertRem; |
320 | img { | 320 | img { |
321 | - width: pxToRem(109px); | 321 | + width: auto; |
322 | height: pxToRem(68px); | 322 | height: pxToRem(68px); |
323 | margin-left: 0; | 323 | margin-left: 0; |
324 | margin-right: pxToRem(-25px); | 324 | margin-right: pxToRem(-25px); |
@@ -392,9 +392,11 @@ $basicBtnC:#eb0313; | @@ -392,9 +392,11 @@ $basicBtnC:#eb0313; | ||
392 | } | 392 | } |
393 | } | 393 | } |
394 | .recommend-for-you { | 394 | .recommend-for-you { |
395 | - margin-bottom: pxToRem(120px); | 395 | + margin-bottom: pxToRem(30px); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | - | 398 | +.bottom-blank{ |
399 | + height: pxToRem(120px); | ||
400 | +} | ||
399 | @import "comments-consults"; | 401 | @import "comments-consults"; |
400 | @import "product-description"; | 402 | @import "product-description"; |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | <div class="fav-content" id="fav-content"> | 8 | <div class="fav-content" id="fav-content"> |
9 | <div class="fav-type"> | 9 | <div class="fav-type"> |
10 | <ul class="fav-product-list"></ul> | 10 | <ul class="fav-product-list"></ul> |
11 | + <div class="fav-content-loading"></div> | ||
11 | 12 | ||
12 | <div class="fav-null-box hide"> | 13 | <div class="fav-null-box hide"> |
13 | <span class="fav-null">您暂无收藏任何商品</span> | 14 | <span class="fav-null">您暂无收藏任何商品</span> |
@@ -17,12 +18,13 @@ | @@ -17,12 +18,13 @@ | ||
17 | </div> | 18 | </div> |
18 | <div class="fav-type"> | 19 | <div class="fav-type"> |
19 | <div class="fav-brand-swiper"></div> | 20 | <div class="fav-brand-swiper"></div> |
21 | + <div class="fav-content-loading"></div> | ||
20 | 22 | ||
21 | <div class="fav-null-box hide"> | 23 | <div class="fav-null-box hide"> |
22 | <span class="fav-null">您暂无收藏任何品牌</span> | 24 | <span class="fav-null">您暂无收藏任何品牌</span> |
23 | <a class="go-shopping" href="{{brandUrl}}">随便逛逛</a> | 25 | <a class="go-shopping" href="{{brandUrl}}">随便逛逛</a> |
24 | </div> | 26 | </div> |
25 | - <div class="fav-brand-load-more load-background hide"></div> | 27 | + <div class="fav-brand-load-more fav-load-background hide"></div> |
26 | </div> | 28 | </div> |
27 | </div> | 29 | </div> |
28 | {{/ favorite}} | 30 | {{/ favorite}} |
1 | {{> layout/header}} | 1 | {{> layout/header}} |
2 | <div class="iHelp"> | 2 | <div class="iHelp"> |
3 | <div class="helpSearch"> | 3 | <div class="helpSearch"> |
4 | - <input type="text"> | 4 | + <input type="text" placeholder="查找关键字"> |
5 | <i class="iconfont"></i> | 5 | <i class="iconfont"></i> |
6 | </div> | 6 | </div> |
7 | <ul> | 7 | <ul> |
@@ -113,8 +113,8 @@ | @@ -113,8 +113,8 @@ | ||
113 | </div> | 113 | </div> |
114 | {{/ enterStore}} | 114 | {{/ enterStore}} |
115 | 115 | ||
116 | - <!-- <div id="productDesc"></div> --> | ||
117 | - {{> product/product-description}} | 116 | + <div id="productDesc"></div> |
117 | + <!-- {{> product/product-description}} --> | ||
118 | {{> product/recommend-for-you}} | 118 | {{> product/recommend-for-you}} |
119 | 119 | ||
120 | {{#cartInfo}} | 120 | {{#cartInfo}} |
@@ -141,3 +141,4 @@ | @@ -141,3 +141,4 @@ | ||
141 | 141 | ||
142 | </div> | 142 | </div> |
143 | {{> layout/footer}} | 143 | {{> layout/footer}} |
144 | +<div class="bottom-blank"></div> |
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | <span class="iconfont"></span></a> | 55 | <span class="iconfont"></span></a> |
56 | </div> | 56 | </div> |
57 | {{else}} | 57 | {{else}} |
58 | - <div class="comment-content-main content-main no-item"> | 58 | + <div class="consult-content-main content-main no-item"> |
59 | <span class="iconfont"></span>暂无咨询 | 59 | <span class="iconfont"></span>暂无咨询 |
60 | </div> | 60 | </div> |
61 | <div class="consult-content-footer"> | 61 | <div class="consult-content-footer"> |
-
Please register or login to post a comment