|
@@ -23,10 +23,10 @@ var $navLi = $('#fav-tab > li'), |
|
@@ -23,10 +23,10 @@ var $navLi = $('#fav-tab > li'), |
23
|
$favProductList = $('.fav-product-list'),
|
23
|
$favProductList = $('.fav-product-list'),
|
24
|
$favBrandList = $('.fav-brand-swiper-wrapper'),
|
24
|
$favBrandList = $('.fav-brand-swiper-wrapper'),
|
25
|
pageId = 1,
|
25
|
pageId = 1,
|
26
|
- brandPageId = 1, // 收藏品牌的当前页数
|
26
|
+ brandPageId = 1, //收藏品牌的当前页数
|
27
|
lockId = true,
|
27
|
lockId = true,
|
28
|
- brandLockId = true, // 收藏品牌是否可下拉加载更多
|
|
|
29
|
- brandTab = false; // 当前是否停留在收藏品牌页
|
28
|
+ brandLockId = true, //收藏品牌是否可下拉加载更多
|
|
|
29
|
+ brandTab = false; //当前是否停留在收藏品牌页
|
30
|
|
30
|
|
31
|
require('../common');
|
31
|
require('../common');
|
32
|
|
32
|
|
|
@@ -38,7 +38,7 @@ function showFavTab(index) { |
|
@@ -38,7 +38,7 @@ function showFavTab(index) { |
38
|
$favContainer.eq(index).addClass('show');
|
38
|
$favContainer.eq(index).addClass('show');
|
39
|
}
|
39
|
}
|
40
|
|
40
|
|
41
|
-// 初始化swiper
|
41
|
+//初始化swiper
|
42
|
function initSwiper(data) {
|
42
|
function initSwiper(data) {
|
43
|
var i,
|
43
|
var i,
|
44
|
idStrReg = /container-(\d+)['"]{1}/gi,
|
44
|
idStrReg = /container-(\d+)['"]{1}/gi,
|
|
@@ -47,10 +47,10 @@ function initSwiper(data) { |
|
@@ -47,10 +47,10 @@ function initSwiper(data) { |
47
|
idArrLen = idArr.length,
|
47
|
idArrLen = idArr.length,
|
48
|
containerId;
|
48
|
containerId;
|
49
|
|
49
|
|
50
|
- // $swiperList = $('.swiper-container');
|
50
|
+ //$swiperList = $('.swiper-container');
|
51
|
for (i = 0; i < idArrLen; i++) {
|
51
|
for (i = 0; i < idArrLen; i++) {
|
52
|
|
52
|
|
53
|
- /* id = $swiperList.eq(i).attr('data-id');
|
53
|
+ /*id = $swiperList.eq(i).attr('data-id');
|
54
|
|
54
|
|
55
|
if (!!swiperObj[id]) {
|
55
|
if (!!swiperObj[id]) {
|
56
|
swiperObj[id].destroy(true, true);
|
56
|
swiperObj[id].destroy(true, true);
|
|
@@ -91,17 +91,18 @@ function loadData($parent, url, page) { |
|
@@ -91,17 +91,18 @@ function loadData($parent, url, page) { |
91
|
$loadMore.addClass('hide');
|
91
|
$loadMore.addClass('hide');
|
92
|
}
|
92
|
}
|
93
|
|
93
|
|
94
|
- if (data === ' ') {
|
94
|
+ if (data.total === 0) {
|
|
|
95
|
+
|
95
|
$loadingMask.addClass('hide');
|
96
|
$loadingMask.addClass('hide');
|
96
|
$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
|
97
|
$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
|
97
|
window.rePosFooter();
|
98
|
window.rePosFooter();
|
98
|
- } else if (data === 'end') {
|
99
|
+ } else if (data.end === true) {
|
99
|
|
100
|
|
100
|
- // 处理data等于end时如果loadingMask存在且没有hide样式的情况
|
101
|
+ //处理data等于end时如果loadingMask存在且没有hide样式的情况
|
101
|
if ($loadingMask && !$loadingMask.hasClass('hide')) {
|
102
|
if ($loadingMask && !$loadingMask.hasClass('hide')) {
|
102
|
$loadingMask.addClass('hide');
|
103
|
$loadingMask.addClass('hide');
|
103
|
|
104
|
|
104
|
- // $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
|
105
|
+ //$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
|
105
|
}
|
106
|
}
|
106
|
|
107
|
|
107
|
$parent.closest('.fav-type').find('.fav-load-background')
|
108
|
$parent.closest('.fav-type').find('.fav-load-background')
|
|
@@ -113,14 +114,14 @@ function loadData($parent, url, page) { |
|
@@ -113,14 +114,14 @@ function loadData($parent, url, page) { |
113
|
} else if (data.length > 10) {
|
114
|
} else if (data.length > 10) {
|
114
|
$parent.append(data);
|
115
|
$parent.append(data);
|
115
|
|
116
|
|
116
|
- // 如果有数据loadingMask会被remove掉
|
117
|
+ //如果有数据loadingMask会被remove掉
|
117
|
$loadingMask.remove();
|
118
|
$loadingMask.remove();
|
118
|
if (url === 'favBrand') {
|
119
|
if (url === 'favBrand') {
|
119
|
- initSwiper(data);// 如果是收藏品牌需要初始化swiper
|
120
|
+ initSwiper(data);//如果是收藏品牌需要初始化swiper
|
120
|
|
121
|
|
121
|
- brandLockId = false;// 请求成功后解锁品牌收藏page++
|
122
|
+ brandLockId = false;//请求成功后解锁品牌收藏page++
|
122
|
} else {
|
123
|
} else {
|
123
|
- lockId = false;// 请求成功后解锁商品收藏page++
|
124
|
+ lockId = false;//请求成功后解锁商品收藏page++
|
124
|
}
|
125
|
}
|
125
|
}
|
126
|
}
|
126
|
window.rePosFooter();
|
127
|
window.rePosFooter();
|
|
@@ -170,7 +171,7 @@ favTabHammer.on('tap', function(e) { |
|
@@ -170,7 +171,7 @@ favTabHammer.on('tap', function(e) { |
170
|
|
171
|
|
171
|
});
|
172
|
});
|
172
|
|
173
|
|
173
|
-// 删除收藏的商品
|
174
|
+//删除收藏的商品
|
174
|
favContentHammer = new Hammer(document.getElementById('fav-content'));
|
175
|
favContentHammer = new Hammer(document.getElementById('fav-content'));
|
175
|
|
176
|
|
176
|
favContentHammer.on('tap', function(e) {
|
177
|
favContentHammer.on('tap', function(e) {
|
|
@@ -218,7 +219,7 @@ favContentHammer.on('tap', function(e) { |
|
@@ -218,7 +219,7 @@ favContentHammer.on('tap', function(e) { |
218
|
}
|
219
|
}
|
219
|
}).fail(function() {
|
220
|
}).fail(function() {
|
220
|
|
221
|
|
221
|
- // TODO
|
222
|
+ //TODO
|
222
|
|
223
|
|
223
|
diaLog.showDialog({
|
224
|
diaLog.showDialog({
|
224
|
autoHide: true,
|
225
|
autoHide: true,
|
|
@@ -230,7 +231,7 @@ favContentHammer.on('tap', function(e) { |
|
@@ -230,7 +231,7 @@ favContentHammer.on('tap', function(e) { |
230
|
|
231
|
|
231
|
function scrollHandler() {
|
232
|
function scrollHandler() {
|
232
|
|
233
|
|
233
|
- // 距离底部未1/4列表高度+底部高度的时候加载更多
|
234
|
+ //距离底部未1/4列表高度+底部高度的时候加载更多
|
234
|
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $favBrandList.height() - footerH) {
|
235
|
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $favBrandList.height() - footerH) {
|
235
|
if (brandTab) {
|
236
|
if (brandTab) {
|
236
|
$brandLoadMore.filter('.hide').removeClass('hide');
|
237
|
$brandLoadMore.filter('.hide').removeClass('hide');
|
|
@@ -252,7 +253,7 @@ function scrollHandler() { |
|
@@ -252,7 +253,7 @@ function scrollHandler() { |
252
|
}
|
253
|
}
|
253
|
}
|
254
|
}
|
254
|
|
255
|
|
255
|
-// srcoll to load more
|
256
|
+//srcoll to load more
|
256
|
$(window).scroll(scrollHandler);
|
257
|
$(window).scroll(scrollHandler);
|
257
|
|
258
|
|
258
|
$(document).on('touchend', '.swiper-header', function() {
|
259
|
$(document).on('touchend', '.swiper-header', function() {
|