import {Component, ViewChild} from '@angular/core';
import {IonicPage, Navbar, NavController, NavParams, Slides, ToastController} from 'ionic-angular';
import {message} from "../../../../app/main";
import {LearnService} from "../learn.service";
import {AppService} from "../../../../service/appHttpService";

@IonicPage()
@Component({
  selector: 'page-review-result',
  templateUrl: 'review-result.html',
})
export class ReviewResultPage {
  @ViewChild(Navbar) navbar:Navbar;

    testId;
    title;
    result;

    starList = [
        {class: 'star-yellow'},
        {class: 'star-yellow'},
        {class: 'star-yellow'},
    ];

    constructor(public navCtrl: NavController, public navParams: NavParams,
                public learnSer:LearnService) {
    }

    ionViewDidLoad() {
        this.result = this.navParams.get('result');
        this.title = this.navParams.get('title');

        this.navbar.backButtonClick = (event)=>{
            let index = this.navCtrl.length() -2;
            this.navCtrl.remove(2,index)
        }
    }

    //测试回顾
    reviewTest() {
        this.navCtrl.push("ReviewLearnPage",{
            recordId:this.result.recordId,
            score:this.result.score
        })
    }

    //重新测试
    resetTest() {
        this.navCtrl.push('LearningDoPage',{
            testId: this.testId,
            title:this.title,
            type:'reset'
        });
    }
}
