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";
@ViewChild(InfiniteScrollContent) infiniteScrollContent: InfiniteScrollContent;
pageNum = 1;
pageCount = 100;
publicList = [];
draftList = [];
changeType = 1;
picture: string = AppGlobal.domain + '/wisdomgroup';
constructor(public navCtrl: NavController, public navParams: NavParams,
public mineSer: MineService, public commonSer: CommonService) {
}
ionViewDidLoad() {
this.getDraftList();
}
change(type) {
this.changeType = type;
this.getPublishList();
}
//已发布
getPublishList() {
this.changeType = 1;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount
};
this.mineSer.myPublish(data).subscribe(
(res) => {
this.publicList = res.data.list;
}
)
}
//草稿箱
getDraftList() {
this.changeType = 2;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount
};
this.mineSer.myDraft(data).subscribe(
(res) => {
if (res.data) {
this.draftList = res.data.list;
}
}
)
}
//下拉刷新
doRefresh(e) {
this.getDraftList();
this.getPublishList();
//查看文章详情
goToDetail(item) {
this.navCtrl.push(StuffDetailPage, {
id: item.id
})
}
goTo(item) {
this.navCtrl.push('VerifyEditPage', {stuffId: item.id, source: 'publish'});