Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {LearningDoPage} from "../learning-do/learning-do";
import {LearnService} from "../learn.service";
import {AppGlobal, AppService} from "../../../../service/http.service";
import {CommonService} from "../../../../provide/common.service";
@IonicPage()
@Component({
selector: 'page-learning-explain',
templateUrl: 'learning-explain.html',
})
export class LearningExplainPage {
testId;
title;
item = {
questionCount: 0,
fullMarks: 0,
timeLimit: 0,
testId:null,
score:0,
}; //测试对象
constructor(public navCtrl: NavController, public navParams: NavParams,
public learnSer: LearnService,public commonSer:CommonService) {
}
ionViewDidLoad() {
const item = this.navParams.get('item');
this.title = item.title;
this.testId = item.testId;
const data = {
testId: this.testId
};
this.learnSer.startTest(data).subscribe(
(res) => {
this.item = res.data;
this.item.score = Math.floor(this.item.fullMarks *0.6);
}
)
}
//跳转答题页面
goToDO() {
if(this.item.questionCount > 0){
this.navCtrl.push("LearningDoPage", {
testId: this.testId,
title:this.title
});
}else{
this.commonSer.toast('当前试卷试题为空');
}
}
}