|
@@ -9,6 +9,7 @@ Page({
|
|
|
answerId:0,
|
|
|
index:0,
|
|
|
type:1,
|
|
|
+ answerMap:{},
|
|
|
showResult: false,
|
|
|
types:{
|
|
|
1:'判断题',
|
|
@@ -52,22 +53,24 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
checkAnswer( e ){
|
|
|
- let item = this.data.item;
|
|
|
- if( !item.select ){
|
|
|
- app.message("还未作答", 'error')
|
|
|
- return;
|
|
|
- }
|
|
|
- let param = {answerId: item.answerId}
|
|
|
+ let {showResult, info, answerMap, groupId} = this.data;
|
|
|
+ let answerId= info.answerId||0;
|
|
|
+ if( showResult ) return;
|
|
|
+ if(!answerId) return;
|
|
|
+ let param = {answerId, groupId}
|
|
|
// 多选
|
|
|
- if( item.type == mulSelect ){
|
|
|
- item.correct = item.select.join("") == item.result;
|
|
|
+ if( info.type == 3 ){
|
|
|
+ info.correct = info.select == info.result;
|
|
|
}else{
|
|
|
- item.correct = item.select == item.result;
|
|
|
+ info.correct = info.select == info.result;
|
|
|
}
|
|
|
- param.correct = item.correct?1:0
|
|
|
+ param.correct = info.correct?1:0;
|
|
|
+ let result = answerMap[answerId];
|
|
|
+ if( result === param.correct) return;
|
|
|
+ answerMap[answerId] = param.correct;
|
|
|
// 打开下一题
|
|
|
app.formPost('Exam.EditErrorAnswer', param).then(res => {
|
|
|
- this.setData({item, next:true})
|
|
|
+ this.setData({info, next:true, answerMap})
|
|
|
})
|
|
|
},
|
|
|
radioChange( e ){
|
|
@@ -102,6 +105,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
finishAnswer( e ){
|
|
|
+ this.checkAnswer()
|
|
|
let action = e.currentTarget.dataset.action;
|
|
|
let {groupId, unfinish, type, showResult, total, index} = this.data
|
|
|
let correct = this.data.info.select == this.data.info.result?1:0;
|