Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
item;
answer = "";
constructor(public navCtrl: NavController, public navParams: NavParams,
private tabSer: TabsService, private commonSer: CommonService) {
//多选
mutiSelect(i, option) {
if (this.answer.includes(option)) {
this.answer = this.answer.replace(option, '');
} else {
this.answer += option + ";";
if(!this.answer){
this.commonSer.toast("请输入您的答案!");
return false;
}
const data = {
questionId: this.item.id,
answer: this.answer
};
this.tabSer.answerMineQuestion(data).subscribe(
(res) => {
this.commonSer.toast('回答成功');
this.navCtrl.pop();
}
)
}
//采纳回答
accept(answerId){
const data = {
answerId:answerId
}
this.tabSer.accept(data).subscribe(
(res)=>{
}
)
}