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 {StuffDetailPage} from "../../home-pages/stuff-detail/stuff-detail";
import {CommonService} from "../../../provide/common.service";
@IonicPage()
@Component({
selector: 'page-my-publish',
templateUrl: 'my-publish.html',
})
export class MyPublishPage {
@ViewChild(InfiniteScrollContent) infiniteScrollContent:InfiniteScrollContent;
publicList = [];
picture: string = AppGlobal.domain + '/wisdomgroup';
constructor(public navCtrl: NavController, public navParams: NavParams,
public mineSer:MineService,public commonSer:CommonService) {
}
ionViewDidLoad() {
this.getList();
}
getList(){
const data = {
pageNum:this.pageNum,
pageCount:this.pageCount
};
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
this.isLoad = false;
this.totalNum = res.data.total;
}
)
}
//下拉刷新
doRefresh(e){
this.loadMore = true;
this.infiniteScrollContent.inf.enable(true);
const data = {
pageNum: 1,
pageCount: this.pageCount
};
this.mineSer.myPublish(data).subscribe(
(res) => {
this.publicList = res.data.list;
this.totalNum = res.data.total;
setTimeout(()=>{
this.commonSer.toast('刷新成功')
e.complete()
},800);
}
)
}
//加载更多
doInfinite(e){
if(this.totalNum == this.publicList.length ){
this.loadMore = false;
e.enable(false);
return false;
}
this.pageNum ++;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount
};
this.mineSer.myPublish(data).subscribe(
(res) => {
this.totalNum = res.data.total;
res.data.list.forEach(e=>{
this.publicList.push(e);
});
setTimeout(()=>{
e.complete()
},800);
//查看文章详情
goToDetail(item) {
this.navCtrl.push(StuffDetailPage, {
id: item.id
})
}