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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import {Component, ViewChild} from '@angular/core';
import {IonicPage, Navbar, NavController, NavParams, Slides} from 'ionic-angular';
import {AppService} from "../../../../service/http.service";
import {LearnManageService} from "../learnManage.service";
import {CommonService} from "../../../../provide/common.service";
@IonicPage()
@Component({
selector: 'page-read-learn',
templateUrl: 'read-learn.html',
})
export class ReadLearnPage {
@ViewChild(Navbar) navbar: Navbar;
@ViewChild(Slides) slides:Slides;
testId;
pageNumber = 1;
pageSize = 100;
index = 0;
list = [];
message;
constructor(public navCtrl: NavController, public navParams: NavParams, public appService: AppService,
public learnManSer: LearnManageService,public commonSer:CommonService) {
}
ionViewDidLoad() {
this.testId = this.navParams.get("testId");
const data = {
testId: this.testId,
pageNumber: this.pageNumber,
pageSize: this.pageSize
};
this.learnManSer.getMarkList(data).subscribe(
(res)=>{
this.list = res.data;
}
)
this.navbar.backButtonClick = () => {
this.commonSer.alert("是否退出批阅,当前批阅不会保存?",()=>{
this.navCtrl.pop()
})
}
}
slideChanged(){
this.index = this.slides.realIndex;
}
//上一题
prev() {
if (this.index == 0) {
this.commonSer.toast('已经是第一份试卷了!')
} else {
this.index -= 1;
this.slides.slideTo(this.index)
}
}
//下一题
next() {
if (this.index == this.list.length - 1) {
this.commonSer.toast('已经是最后一份试卷了!')
} else {
this.index += 1;
this.slides.slideTo(this.index)
}
}
//
select(test, boolean) {
test.result = boolean;
}
//提交批阅结果
submit(){
if(!this.check()){
return false;
}
let arr = [];
this.list.forEach(l=>{
if(l.unSubmit == 0){ //当前试卷均题目都批阅了
l.vos.forEach(v=>{
arr.push({
recordId:v.recordId,
result:v.result,
answerId:v.answerId,
questionId:v.questionId,
score:v.score,
})
})
}
});
this.commonSer.alert(this.message,()=>{
this.learnManSer.submitMarkResult(arr).subscribe(
(res)=>{
this.commonSer.toast("批阅完成!")
this.navCtrl.pop();
}
)
})
}
/**
* unSubmit 是对每个试卷的未批阅数目,当未批阅数目大于0时,将该试卷的批阅不提交
* @returns {boolean}
*/
check(){
let num = 0;
this.list.forEach(l=>{
l.unSubmit = 0;
l.vos.forEach(v=>{
if(v.result != 0 && v.result != 1){
l.unSubmit ++;
num ++;
}
})
});
if(num > 0){
this.message = "有试卷的题目未批阅(有题目未批阅的试卷不会被提交)";
}else{
this.message = "确定提交当前批阅?"
}
return true;
}
}