|
@@ -37,17 +37,15 @@ plusstar = { |
|
@@ -37,17 +37,15 @@ plusstar = { |
37
|
|
37
|
|
38
|
$tabUlDom = $('.plusstar-page .tab-nav ul');
|
38
|
$tabUlDom = $('.plusstar-page .tab-nav ul');
|
39
|
|
39
|
|
40
|
- // 重置tab code位置
|
|
|
41
|
- if (window.localStorage) {
|
|
|
42
|
- $tabUlDom.find('li').each(function() {
|
|
|
43
|
- localStorage.setItem($(this).data('code'), 0);
|
|
|
44
|
- });
|
|
|
45
|
- }
|
|
|
46
|
-
|
|
|
47
|
$tabUlDom.find('li').css({
|
40
|
$tabUlDom.find('li').css({
|
48
|
width: 100 / $tabUlDom.find('li').length + '%'
|
41
|
width: 100 / $tabUlDom.find('li').length + '%'
|
49
|
});
|
42
|
});
|
50
|
|
43
|
|
|
|
44
|
+ $tabUlDom.find('li').each(function() {
|
|
|
45
|
+ // 重新进入滑动位置清除
|
|
|
46
|
+ window.setCookie($(this).data('code'), 0);
|
|
|
47
|
+ });
|
|
|
48
|
+
|
51
|
// 事情委托机制
|
49
|
// 事情委托机制
|
52
|
$tabUlDom.bind('click', function(event) {
|
50
|
$tabUlDom.bind('click', function(event) {
|
53
|
$liDom = $(event.target).closest('li');
|
51
|
$liDom = $(event.target).closest('li');
|
|
@@ -65,16 +63,16 @@ plusstar = { |
|
@@ -65,16 +63,16 @@ plusstar = { |
65
|
if (window._yas && window._yas.sendCustomInfo) {
|
63
|
if (window._yas && window._yas.sendCustomInfo) {
|
66
|
window._yas.sendCustomInfo({
|
64
|
window._yas.sendCustomInfo({
|
67
|
op: 'YB_FASHION_TAB_C',
|
65
|
op: 'YB_FASHION_TAB_C',
|
68
|
- param: JSON.stringify($.extend(speckParamApp, {
|
66
|
+ param: JSON.stringify($.extend({
|
69
|
TAB_ID: $liDom.index() + 1
|
67
|
TAB_ID: $liDom.index() + 1
|
70
|
- }))
|
68
|
+ }, speckParamApp))
|
71
|
}, true);
|
69
|
}, true);
|
72
|
|
70
|
|
73
|
window._yas.sendCustomInfo({
|
71
|
window._yas.sendCustomInfo({
|
74
|
op: 'YB_FASHION_HOME_L',
|
72
|
op: 'YB_FASHION_HOME_L',
|
75
|
- param: JSON.stringify($.extend(speckParamApp, {
|
73
|
+ param: JSON.stringify($.extend({
|
76
|
TAB_ID: that.ParentLiDom.index() + 1
|
74
|
TAB_ID: that.ParentLiDom.index() + 1
|
77
|
- }))
|
75
|
+ }, speckParamApp))
|
78
|
}, true);
|
76
|
}, true);
|
79
|
}
|
77
|
}
|
80
|
});
|
78
|
});
|
|
@@ -87,10 +85,10 @@ plusstar = { |
|
@@ -87,10 +85,10 @@ plusstar = { |
87
|
}
|
85
|
}
|
88
|
$tabUlDom.find('li').removeClass('focus');
|
86
|
$tabUlDom.find('li').removeClass('focus');
|
89
|
$liDom.addClass('focus');
|
87
|
$liDom.addClass('focus');
|
|
|
88
|
+ that.ParentLiDom = $liDom;// 保留当前tab先中的对象
|
90
|
that.tabNav($liDom.data('code'));
|
89
|
that.tabNav($liDom.data('code'));
|
91
|
|
90
|
|
92
|
// ent -- 默认选中
|
91
|
// ent -- 默认选中
|
93
|
- that.ParentLiDom = $liDom;// 保留当前tab先中的对象
|
|
|
94
|
setTimeout(function() {
|
92
|
setTimeout(function() {
|
95
|
that._yas();
|
93
|
that._yas();
|
96
|
}, 1000);
|
94
|
}, 1000);
|
|
@@ -111,28 +109,28 @@ plusstar = { |
|
@@ -111,28 +109,28 @@ plusstar = { |
111
|
// 商品单击埋点
|
109
|
// 商品单击埋点
|
112
|
$dom = $(event.target).closest('.good-info');
|
110
|
$dom = $(event.target).closest('.good-info');
|
113
|
index = $dom.index() + 1;
|
111
|
index = $dom.index() + 1;
|
114
|
- window.givePoint($.extend(speckParamApp, {
|
112
|
+ window.givePoint($.extend({
|
115
|
REC_POSE: RECPOSE,
|
113
|
REC_POSE: RECPOSE,
|
116
|
PRD_ID: $dom.data('good-id'),
|
114
|
PRD_ID: $dom.data('good-id'),
|
117
|
ORDER_CODE: '',
|
115
|
ORDER_CODE: '',
|
118
|
PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize,
|
116
|
PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize,
|
119
|
ACTION_ID: 1,
|
117
|
ACTION_ID: 1,
|
120
|
page_num: Math.ceil(index / that.common.pagesize)
|
118
|
page_num: Math.ceil(index / that.common.pagesize)
|
121
|
- }));
|
119
|
+ }, speckParamApp));
|
122
|
} else if ($(event.target).closest('.banner-top').length > 0) {
|
120
|
} else if ($(event.target).closest('.banner-top').length > 0) {
|
123
|
// 头部banner楼层埋点
|
121
|
// 头部banner楼层埋点
|
124
|
$dom = $(event.target).closest('li');
|
122
|
$dom = $(event.target).closest('li');
|
125
|
index = $dom.index() + 1;
|
123
|
index = $dom.index() + 1;
|
126
|
window._yas.sendCustomInfo({
|
124
|
window._yas.sendCustomInfo({
|
127
|
op: 'YB_FASHION_FLR_C',
|
125
|
op: 'YB_FASHION_FLR_C',
|
128
|
- param: JSON.stringify($.extend(speckParamApp, {
|
126
|
+ param: JSON.stringify($.extend({
|
129
|
TAB_ID: that.ParentLiDom.index() + 1,
|
127
|
TAB_ID: that.ParentLiDom.index() + 1,
|
130
|
F_ID: $dom.closest('ul').data('id'),
|
128
|
F_ID: $dom.closest('ul').data('id'),
|
131
|
F_NAME: '焦点图',
|
129
|
F_NAME: '焦点图',
|
132
|
F_URL: $dom.find('a').attr('href'),
|
130
|
F_URL: $dom.find('a').attr('href'),
|
133
|
F_INDEX: 1,
|
131
|
F_INDEX: 1,
|
134
|
I_INDEX: index % 2 + 1// banner,li是双倍的
|
132
|
I_INDEX: index % 2 + 1// banner,li是双倍的
|
135
|
- }))
|
133
|
+ }, speckParamApp))
|
136
|
}, true);
|
134
|
}, true);
|
137
|
} else if ($(event.target).closest('.speck-title-image a').length > 0) {
|
135
|
} else if ($(event.target).closest('.speck-title-image a').length > 0) {
|
138
|
// 各楼层埋点
|
136
|
// 各楼层埋点
|
|
@@ -141,14 +139,14 @@ plusstar = { |
|
@@ -141,14 +139,14 @@ plusstar = { |
141
|
|
139
|
|
142
|
window._yas.sendCustomInfo({
|
140
|
window._yas.sendCustomInfo({
|
143
|
op: 'YB_FASHION_FLR_C',
|
141
|
op: 'YB_FASHION_FLR_C',
|
144
|
- param: JSON.stringify($.extend(speckParamApp, {
|
142
|
+ param: JSON.stringify($.extend({
|
145
|
TAB_ID: that.ParentLiDom.index() + 1,
|
143
|
TAB_ID: that.ParentLiDom.index() + 1,
|
146
|
F_ID: $dom.data('fid'),
|
144
|
F_ID: $dom.data('fid'),
|
147
|
F_NAME: $dom.data('name'),
|
145
|
F_NAME: $dom.data('name'),
|
148
|
F_URL: $domA.attr('href'),
|
146
|
F_URL: $domA.attr('href'),
|
149
|
F_INDEX: $dom.index() + 1,
|
147
|
F_INDEX: $dom.index() + 1,
|
150
|
I_INDEX: $domA.hasClass('more') ? 0 : ($domA.index() + 1)
|
148
|
I_INDEX: $domA.hasClass('more') ? 0 : ($domA.index() + 1)
|
151
|
- }))
|
149
|
+ }, speckParamApp))
|
152
|
}, true);
|
150
|
}, true);
|
153
|
}
|
151
|
}
|
154
|
});
|
152
|
});
|
|
@@ -156,9 +154,9 @@ plusstar = { |
|
@@ -156,9 +154,9 @@ plusstar = { |
156
|
// 潮流优选首页加载时
|
154
|
// 潮流优选首页加载时
|
157
|
window._yas.sendCustomInfo({
|
155
|
window._yas.sendCustomInfo({
|
158
|
op: 'YB_FASHION_HOME_L',
|
156
|
op: 'YB_FASHION_HOME_L',
|
159
|
- param: JSON.stringify($.extend(speckParamApp, {
|
157
|
+ param: JSON.stringify($.extend({
|
160
|
TAB_ID: that.ParentLiDom.index() + 1
|
158
|
TAB_ID: that.ParentLiDom.index() + 1
|
161
|
- }))
|
159
|
+ }, speckParamApp))
|
162
|
}, true);
|
160
|
}, true);
|
163
|
},
|
161
|
},
|
164
|
tabNav: function(code) {
|
162
|
tabNav: function(code) {
|
|
@@ -166,14 +164,16 @@ plusstar = { |
|
@@ -166,14 +164,16 @@ plusstar = { |
166
|
|
164
|
|
167
|
this.common.codeDefault = code;// 记住最后一次的tab code
|
165
|
this.common.codeDefault = code;// 记住最后一次的tab code
|
168
|
this.common.page = 1;// 商品列表从第一页开始
|
166
|
this.common.page = 1;// 商品列表从第一页开始
|
169
|
- searching = false;
|
167
|
+ searching = false;//初始化翻页
|
170
|
|
168
|
|
171
|
$.ajax({
|
169
|
$.ajax({
|
172
|
type: 'GET',
|
170
|
type: 'GET',
|
173
|
url: '/guang/plusstar/resources-template',
|
171
|
url: '/guang/plusstar/resources-template',
|
174
|
data: {
|
172
|
data: {
|
175
|
code: code,
|
173
|
code: code,
|
176
|
- app_version: isApp
|
174
|
+ uid: window.queryString.uid,
|
|
|
175
|
+ app_version: isApp,
|
|
|
176
|
+ yh_channel: that.ParentLiDom.index() + 1
|
177
|
},
|
177
|
},
|
178
|
dataType: 'html',
|
178
|
dataType: 'html',
|
179
|
success: function(data) {
|
179
|
success: function(data) {
|
|
@@ -186,20 +186,19 @@ plusstar = { |
|
@@ -186,20 +186,19 @@ plusstar = { |
186
|
return true;
|
186
|
return true;
|
187
|
}
|
187
|
}
|
188
|
|
188
|
|
|
|
189
|
+ // 记录切换tab位置
|
|
|
190
|
+ $(document).scrollTop(window.cookie(code) || 0);
|
|
|
191
|
+
|
189
|
that.resInit();
|
192
|
that.resInit();
|
190
|
|
193
|
|
191
|
$('.plusstar-resources').find('img.lazy').lazyload();
|
194
|
$('.plusstar-resources').find('img.lazy').lazyload();
|
192
|
|
195
|
|
193
|
- // 设置滚动条的位置
|
|
|
194
|
- if (window.localStorage) {
|
|
|
195
|
- $(document).scrollTop(localStorage.getItem(code) || 0);
|
|
|
196
|
- }
|
|
|
197
|
-
|
|
|
198
|
productSkns = $(data).find('.product-skns').val();
|
196
|
productSkns = $(data).find('.product-skns').val();
|
199
|
-
|
|
|
200
|
if (productSkns) {
|
197
|
if (productSkns) {
|
201
|
that.common.productSkns = productSkns.split(',');
|
198
|
that.common.productSkns = productSkns.split(',');
|
202
|
}
|
199
|
}
|
|
|
200
|
+
|
|
|
201
|
+ that.common.pageTotal = Math.ceil(that.common.productSkns.length / that.common.pagesize);
|
203
|
},
|
202
|
},
|
204
|
error: function() {
|
203
|
error: function() {
|
205
|
tip.show('网络断开连接了~');
|
204
|
tip.show('网络断开连接了~');
|
|
@@ -226,9 +225,8 @@ plusstar = { |
|
@@ -226,9 +225,8 @@ plusstar = { |
226
|
skn = [];
|
225
|
skn = [];
|
227
|
|
226
|
|
228
|
if (searching) {
|
227
|
if (searching) {
|
229
|
- return true;
|
228
|
+ return;
|
230
|
}
|
229
|
}
|
231
|
-
|
|
|
232
|
searching = true;
|
230
|
searching = true;
|
233
|
|
231
|
|
234
|
if (that.common.page > that.common.pageTotal) {
|
232
|
if (that.common.page > that.common.pageTotal) {
|
|
@@ -236,44 +234,38 @@ plusstar = { |
|
@@ -236,44 +234,38 @@ plusstar = { |
236
|
}
|
234
|
}
|
237
|
|
235
|
|
238
|
loading.showLoadingMask();
|
236
|
loading.showLoadingMask();
|
239
|
-
|
237
|
+ skn = that.common.productSkns.slice((that.common.page - 1) * that.common.pagesize, that.common.page * that.common.pagesize);
|
240
|
$.ajax({
|
238
|
$.ajax({
|
241
|
type: 'POST',
|
239
|
type: 'POST',
|
242
|
url: '/guang/plusstar/resources-goodsList',
|
240
|
url: '/guang/plusstar/resources-goodsList',
|
243
|
timeout: 5000,
|
241
|
timeout: 5000,
|
244
|
data: {
|
242
|
data: {
|
245
|
- productSkn: that.common.productSkns.join(','),
|
|
|
246
|
- app_version: isApp,
|
|
|
247
|
- limit: that.common.pagesize,
|
|
|
248
|
- page: that.common.page,
|
|
|
249
|
- yh_channel: that.ParentLiDom.index() + 1
|
243
|
+ productSkn: skn.join(','),
|
|
|
244
|
+ app_version: isApp
|
250
|
},
|
245
|
},
|
251
|
dataType: 'html',
|
246
|
dataType: 'html',
|
252
|
success: function(data) {
|
247
|
success: function(data) {
|
253
|
skn = [];
|
248
|
skn = [];
|
254
|
- searching = false;
|
|
|
255
|
loading.hideLoadingMask();
|
249
|
loading.hideLoadingMask();
|
|
|
250
|
+ searching = false;
|
|
|
251
|
+ that.common.page++;
|
256
|
|
252
|
|
257
|
if (data === '') {
|
253
|
if (data === '') {
|
258
|
return true;
|
254
|
return true;
|
259
|
}
|
255
|
}
|
260
|
|
256
|
|
261
|
- if (that.common.page <= 1) {
|
|
|
262
|
- that.common.pageTotal = $(data).siblings('.page-total').val();
|
|
|
263
|
- }
|
|
|
264
|
-
|
|
|
265
|
$.each($(data).siblings('.good-info'), function() {
|
257
|
$.each($(data).siblings('.good-info'), function() {
|
266
|
skn.push($(this).data('good-id'));
|
258
|
skn.push($(this).data('good-id'));
|
267
|
});
|
259
|
});
|
268
|
|
260
|
|
269
|
- window.givePoint($.extend(speckParamApp, {
|
261
|
+ window.givePoint($.extend({
|
270
|
REC_POSE: RECPOSE,
|
262
|
REC_POSE: RECPOSE,
|
271
|
PRD_ID: skn.join(','),
|
263
|
PRD_ID: skn.join(','),
|
272
|
ORDER_CODE: '',
|
264
|
ORDER_CODE: '',
|
273
|
PRD_NUM: that.common.pagesize,
|
265
|
PRD_NUM: that.common.pagesize,
|
274
|
ACTION_ID: 0,
|
266
|
ACTION_ID: 0,
|
275
|
- page_num: that.common.page++
|
|
|
276
|
- }));
|
267
|
+ page_num: that.common.page - 1
|
|
|
268
|
+ }, speckParamApp));
|
277
|
|
269
|
|
278
|
$('.plusstar-resources .goods').append(data);
|
270
|
$('.plusstar-resources .goods').append(data);
|
279
|
|
271
|
|
|
@@ -292,15 +284,14 @@ plusstar = { |
|
@@ -292,15 +284,14 @@ plusstar = { |
292
|
scrollFn = debounce(function() {
|
284
|
scrollFn = debounce(function() {
|
293
|
scrollTop = $(document).scrollTop();
|
285
|
scrollTop = $(document).scrollTop();
|
294
|
|
286
|
|
|
|
287
|
+ // 保留滑动位置,产品要求
|
|
|
288
|
+ window.setCookie(plusstar.common.codeDefault, $(this).scrollTop());
|
|
|
289
|
+
|
295
|
// 当scroll到最后一列商品的高度后继续请求下一页数据
|
290
|
// 当scroll到最后一列商品的高度后继续请求下一页数据
|
296
|
if (400 + scrollTop >= $(document).height() - windowHeight) {
|
291
|
if (400 + scrollTop >= $(document).height() - windowHeight) {
|
297
|
plusstar.goodsList();
|
292
|
plusstar.goodsList();
|
298
|
}
|
293
|
}
|
299
|
|
294
|
|
300
|
- if (window.localStorage) {
|
|
|
301
|
- localStorage.setItem(plusstar.common.codeDefault, $(this).scrollTop());
|
|
|
302
|
- }
|
|
|
303
|
-
|
|
|
304
|
}, 200);
|
295
|
}, 200);
|
305
|
|
296
|
|
306
|
$(function() {
|
297
|
$(function() {
|