|
@@ -8,6 +8,7 @@ import dialog from 'js/plugin/dialog'; |
|
@@ -8,6 +8,7 @@ import dialog from 'js/plugin/dialog'; |
8
|
import lazyLoad from 'yoho-jquery-lazyload';
|
8
|
import lazyLoad from 'yoho-jquery-lazyload';
|
9
|
import yoSdk from 'yoho-activity-sdk';
|
9
|
import yoSdk from 'yoho-activity-sdk';
|
10
|
let yoho = require('js/yoho-app');
|
10
|
let yoho = require('js/yoho-app');
|
|
|
11
|
+let recItem = require('hbs/activity/group/progress-rec-item.hbs');
|
11
|
|
12
|
|
12
|
class GroupProgress extends Page {
|
13
|
class GroupProgress extends Page {
|
13
|
constructor() {
|
14
|
constructor() {
|
|
@@ -30,6 +31,7 @@ class GroupProgress extends Page { |
|
@@ -30,6 +31,7 @@ class GroupProgress extends Page { |
30
|
groupPrice: '',
|
31
|
groupPrice: '',
|
31
|
shareImgUrl: ''
|
32
|
shareImgUrl: ''
|
32
|
};
|
33
|
};
|
|
|
34
|
+ this.page = 2;
|
33
|
this.loading = false;
|
35
|
this.loading = false;
|
34
|
this.loadedAll = false;
|
36
|
this.loadedAll = false;
|
35
|
|
37
|
|
|
@@ -50,7 +52,6 @@ class GroupProgress extends Page { |
|
@@ -50,7 +52,6 @@ class GroupProgress extends Page { |
50
|
let self = this;
|
52
|
let self = this;
|
51
|
|
53
|
|
52
|
window.onscroll = function() {
|
54
|
window.onscroll = function() {
|
53
|
-
|
|
|
54
|
if (timeout !== null) {
|
55
|
if (timeout !== null) {
|
55
|
clearTimeout(timeout);
|
56
|
clearTimeout(timeout);
|
56
|
}
|
57
|
}
|
|
@@ -82,7 +83,7 @@ class GroupProgress extends Page { |
|
@@ -82,7 +83,7 @@ class GroupProgress extends Page { |
82
|
}
|
83
|
}
|
83
|
|
84
|
|
84
|
bindEvents() {
|
85
|
bindEvents() {
|
85
|
- this.selector.$productItem.on('click', this.goDetail.bind(this));
|
86
|
+ $(document).on('click', '.product-item', this.goDetail.bind(this));
|
86
|
this.selector.$goJoin.on('click', this.goJoin.bind(this));
|
87
|
this.selector.$goJoin.on('click', this.goJoin.bind(this));
|
87
|
this.selector.$joinGroup.on('click', this.joinGroup.bind(this));
|
88
|
this.selector.$joinGroup.on('click', this.joinGroup.bind(this));
|
88
|
this.selector.$inviteJoin.on('click', this.inviteJoin.bind(this));
|
89
|
this.selector.$inviteJoin.on('click', this.inviteJoin.bind(this));
|
|
@@ -326,7 +327,7 @@ class GroupProgress extends Page { |
|
@@ -326,7 +327,7 @@ class GroupProgress extends Page { |
326
|
}
|
327
|
}
|
327
|
|
328
|
|
328
|
loadMoreData() {
|
329
|
loadMoreData() {
|
329
|
- if (this.loading && !this.loadedAll) {
|
330
|
+ if (this.loading || this.loadedAll) {
|
330
|
return;
|
331
|
return;
|
331
|
}
|
332
|
}
|
332
|
|
333
|
|
|
@@ -334,15 +335,35 @@ class GroupProgress extends Page { |
|
@@ -334,15 +335,35 @@ class GroupProgress extends Page { |
334
|
this.ajax({
|
335
|
this.ajax({
|
335
|
url: '/activity/group/groupResultRec',
|
336
|
url: '/activity/group/groupResultRec',
|
336
|
data: {
|
337
|
data: {
|
337
|
- page: 2,
|
|
|
338
|
- limit: 2
|
338
|
+ page: this.page,
|
|
|
339
|
+ limit: 4
|
|
|
340
|
+ }
|
|
|
341
|
+ }).then(result => {
|
|
|
342
|
+ if (!result.collageProductVoList) {
|
|
|
343
|
+ this.loading = false;
|
|
|
344
|
+ this.loadedAll = true;
|
|
|
345
|
+ return;
|
339
|
}
|
346
|
}
|
340
|
- }).then(() => {
|
347
|
+
|
|
|
348
|
+ this.page = this.page + 1;
|
|
|
349
|
+ this.renderMoreData(result.collageProductVoList);
|
341
|
this.loading = false;
|
350
|
this.loading = false;
|
342
|
}).catch(() => {
|
351
|
}).catch(() => {
|
343
|
this.loading = false;
|
352
|
this.loading = false;
|
344
|
});
|
353
|
});
|
345
|
}
|
354
|
}
|
|
|
355
|
+
|
|
|
356
|
+ renderMoreData(list) {
|
|
|
357
|
+ console.log('render data');
|
|
|
358
|
+
|
|
|
359
|
+ let appendHtml = '';
|
|
|
360
|
+
|
|
|
361
|
+ list.forEach(item => {
|
|
|
362
|
+ appendHtml += recItem(item);
|
|
|
363
|
+ });
|
|
|
364
|
+
|
|
|
365
|
+ $('.recommend').append(appendHtml);
|
|
|
366
|
+ }
|
346
|
}
|
367
|
}
|
347
|
|
368
|
|
348
|
$(() => {
|
369
|
$(() => {
|