Showing
1 changed file
with
6 additions
and
2 deletions
@@ -22,23 +22,27 @@ class GradeController extends Controller { | @@ -22,23 +22,27 @@ class GradeController extends Controller { | ||
22 | this.content = new GetContent(); | 22 | this.content = new GetContent(); |
23 | this.content.on('search', this.doSearch.bind(this)); | 23 | this.content.on('search', this.doSearch.bind(this)); |
24 | this.page = 1; | 24 | this.page = 1; |
25 | + this.loading = false; | ||
25 | } | 26 | } |
26 | 27 | ||
27 | doSearch() { | 28 | doSearch() { |
28 | - if (!this.end) { | 29 | + if (!this.end && !this.loading) { |
29 | this.page ++; | 30 | this.page ++; |
30 | this.search(this.page); | 31 | this.search(this.page); |
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
34 | search(page) { | 35 | search(page) { |
36 | + this.loading = true; | ||
35 | search('//m.yohobuy.com/home/gradeNew/getHis', {page: page}).then(data => { | 37 | search('//m.yohobuy.com/home/gradeNew/getHis', {page: page}).then(data => { |
36 | if (data.detailHis <= 0) { | 38 | if (data.detailHis <= 0) { |
37 | this.end = true; | 39 | this.end = true; |
38 | } else { | 40 | } else { |
39 | $('.ul-detail:first').append(hisContent(data)); | 41 | $('.ul-detail:first').append(hisContent(data)); |
40 | } | 42 | } |
41 | - }).catch(() => {}); | 43 | + }).catch(() => {}).finally(() => { |
44 | + this.loading = false; | ||
45 | + }); | ||
42 | } | 46 | } |
43 | } | 47 | } |
44 | 48 |
-
Please register or login to post a comment