Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {TabsService} from "../../tabs/tabs.service";
import {CommonService} from "../../../provide/common.service";
@IonicPage()
@Component({
constructor(public navCtrl: NavController, public navParams: NavParams,
private tabSer: TabsService, private commonSer: CommonService) {
}
ionViewDidLoad() {
this.id = this.navParams.get('id');
this.getDetail();
getDetail() {
this.tabSer.personDetail(this.id).subscribe(
(res) => {
this.item = res.data;
if(this.item.answers && this.item.answers.length > 0){
this.item.answers.forEach(e => {
if (e.isAccept == 1) {
this.acceptBol = true;
}
})
}
)
}
//采纳回答
accept(answerId) {
const data = {
answerId: answerId
this.tabSer.accept(data).subscribe(
(res) => {
if (res.errcode == '1000') {
this.commonSer.toast('采纳成功');
this.getDetail();
} else {
this.commonSer.toast(res.errmsg);
}
}
)
}