|
|
@@ -273,25 +273,34 @@ export function getQuestion(examId: string, studentId: string) {
|
|
|
response => {
|
|
|
hide()
|
|
|
if (response.err === 0) {
|
|
|
- store.dispatch(loadQuestion(response.res))
|
|
|
- const current = store.getState().loadCurrentQuestion
|
|
|
+ store.dispatch(loadQuestion(response.res));
|
|
|
+ const question = response.res;
|
|
|
+ const current = store.getState().loadCurrentQuestion;
|
|
|
if (Object.keys(current).length === 0) {
|
|
|
- store.dispatch(loadCurrentQuestion(response.res.codeList[0]))
|
|
|
- generateFileTree(response.res.codeList[0])
|
|
|
+ store.dispatch(loadCurrentQuestion(response.res.codeList[0]));
|
|
|
+ generateFileTree(response.res.codeList[0]);
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < question.codeList.length; i++){
|
|
|
+ if (question.codeList[i].questionId === current.questionId) {
|
|
|
+ store.dispatch(loadCurrentQuestion(question.codeList[i]));
|
|
|
+ generateFileTree(question.codeList[i]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return response;
|
|
|
}).then(response => {
|
|
|
if (response.err) {
|
|
|
- notification.error({key: 'QuestionError', message: response.msg})
|
|
|
+ notification.error({key: 'QuestionError', message: response.msg});
|
|
|
}
|
|
|
}
|
|
|
).catch(reason => {
|
|
|
console.log(reason)
|
|
|
- notification.error({key: 'QuestionError', message: reason})
|
|
|
+ notification.error({key: 'QuestionError', message: reason});
|
|
|
}
|
|
|
)
|
|
|
} else {
|
|
|
- notification.error({key: 'ParamError', message: "Parameter Error"})
|
|
|
+ notification.error({key: 'ParamError', message: "Parameter Error"});
|
|
|
}
|
|
|
-}
|
|
|
+}
|