Newer
Older
import {Component, ViewChild} from '@angular/core';
import {IonicPage, NavController, NavParams, Slides, ToastController} from 'ionic-angular';
import {AppService} from "../../../../service/appHttpService";
import {message} from "../../../../app/main";
@IonicPage()
@Component({
selector: 'page-review-learn',
templateUrl: 'review-learn.html',
})
export class ReviewLearnPage {
constructor(public navCtrl: NavController, public navParams: NavParams,public learnSer:LearnService,
public toastCtrl:ToastController,public appService:AppService,public commonSer:CommonService) {
const recordId = this.navParams.get('recordId');
this.score = this.navParams.get('score');
const data = {
recordId:recordId,
}
this.learnSer.viewAnswerDetail(data).subscribe(
(res)=>{
this.list = res.data;
this.list.forEach(e=>{
if(e.questionType == 4){
e.options = [
{option:'A', comment:'是'},
{option:'B', comment:'否'},
];
e.myAnswer = e.myAnswer == '1'?'A':'B';
e.correctAnswer = e.correctAnswer == '1'?'A':'B';
}
if(e.questionType == 1 || e.questionType == 2 || e.questionType == 4){
e.options.forEach(s=>{
if(e.correctAnswer.includes(s.option)){
s.answer = 'right';
}else if(!e.correctAnswer.includes(s.option) && e.myAnswer.includes(s.option)){
s.answer = 'error'
}else{
s.answer = 'normal'
}
})
}
})
const toast = this.toastCtrl.create(message);
toast.setMessage('已经是第一题哦');
toast.present();
const toast = this.toastCtrl.create(message);
toast.setMessage('已经是最后一题了哦');
toast.present();
lookError(){
this.index = 1;
this.slides.slideTo(this.index-1)
let arr = [];
this.list.map(e=>{
if(e.result == 0){
arr.push(e);
}
});
this.list = arr;
const data = {
questionId:this.list[this.index].questionId,
questionType:this.list[this.index].questionType,
content:this.errorContent
};
this.commonSer.log(data);
this.learnSer.questionCorrecting(data).subscribe(
(res)=>{
this.commonSer.toast("提交成功!");
this.error = false;
}
)
}
cancel(){
this.error = false;
this.errorContent = "";
}