Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {AppGlobal} from "../../../service/http.service";
import {DomSanitizer} from "@angular/platform-browser";
import {TabsService} from "../../tabs/tabs.service";
import {CommonService} from "../../../provide/common.service";
@IonicPage()
@Component({
selector: 'page-verify-handle',
templateUrl: 'verify-handle.html',
})
export class VerifyHandlePage {
stuffObj;
url = AppGlobal.domain + '/wisdomgroup';
attachments; //附件
footerView = false;
stuffId;
constructor(public navCtrl: NavController, public navParams: NavParams, private commonSer: CommonService,
public sanitizer: DomSanitizer, private tabSer: TabsService) {
setTimeout(() => {
this.footerView = true;
}, 300)
this.stuffId = this.navParams.get('id');
this.getStuff();
}
ionViewWillLeave() {
this.footerView = false;
}
//获取文章信息
getStuff() {
this.tabSer.stuffInfo(this.stuffId).subscribe(
(res) => {
this.stuffObj = res.data;
this.attachments = res.data.attachments;
let con = this.stuffObj.content.replace(/\r?\n/g, "<br />");
this.stuffObj.content = this.sanitizer.bypassSecurityTrustHtml(con);
}
)
handle(status) {
let message;
if (status == 1) message = '确定退回当前内容?';
if (status == 3) message = '确定通过当前内容?';
this.commonSer.alert(message, () => {
this.tabSer.stuffPublish(this.stuffId).subscribe(
(res) => {
this.commonSer.toast('已提交');
setTimeout(() => {
this.navCtrl.pop()
}, 800)
}
)
}
this.tabSer.stuffRecall(this.stuffId).subscribe(
(res) => {
this.commonSer.toast('已提交');
setTimeout(() => {
this.navCtrl.pop()
}, 800)
}
)
}
this.navCtrl.push('VerifyEditPage', {stuffId: this.stuffId,source:'verify'});