Newer
Older
import {Component, ViewChild} from '@angular/core';
import {InfiniteScrollContent, IonicPage, NavController, NavParams} from 'ionic-angular';
import {AppGlobal} from "../../../service/http.service";
import {MineService} from "../mine.service";
import {CommonService} from "../../../provide/common.service";
import {timer} from "rxjs/observable/timer";
@ViewChild(InfiniteScrollContent) infiniteScrollContent: InfiniteScrollContent;
integraList = [];
picture: string = AppGlobal.domain + '/wisdomgroup';
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
loadMore = true;
totalNum; //总条数
constructor(public navCtrl: NavController, public navParams: NavParams,
public mineSer: MineService, public commonSer: CommonService) {
}
ionViewDidEnter() {
this.getList();
}
getList() {
const data = {
pageNum: this.pageNum,
pageSize: this.pageCount
};
this.mineSer.personPointDetail(data).subscribe(
(res) => {
this.integraList = res.list;
this.isLoad = false;
this.totalNum = res.total;
}
)
}
//下拉刷新
doRefresh(e) {
this.loadMore = true;
this.infiniteScrollContent.inf.enable(true);
const data = {
pageNum: 1,
pageSize: this.pageCount
};
this.mineSer.personPointDetail(data).subscribe(
(res) => {
this.integraList = res.list;
this.totalNum = res.total;
timer(800).subscribe(() => {
this.commonSer.toast('刷新成功');
e.complete()
});
}
)
}
//加载更多
doInfinite(e) {
console.log("doInfinite")
if (this.totalNum == this.integraList.length) {
console.log("没有更多了")
this.loadMore = false;
e.enable(false);
return false;
}
this.pageNum++;
const data = {
pageNum: this.pageNum,
pageSize: this.pageCount
};
this.mineSer.personPointDetail(data).subscribe(
(res) => {
this.totalNum = res.total;
res.list.forEach(e => {
this.integraList.push(e);
});
timer(800).subscribe(() => e.complete());
}
)
}