|
@@ -82,8 +82,8 @@ export default {
|
|
|
...mapState(["examQuestionList"]),
|
|
|
},
|
|
|
watch: {
|
|
|
- $route: function() {
|
|
|
- this.updateQuestion();
|
|
|
+ $route: function(to, from) {
|
|
|
+ this.updateQuestion(to, from);
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
@@ -92,11 +92,25 @@ export default {
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
...mapMutations(["updateExamQuestion"]),
|
|
|
- async updateQuestion() {
|
|
|
+ async updateQuestion(to, from) {
|
|
|
const currentExamQuestion = this.examQuestion; // 避免以后执行时,this.examQuestion换掉了
|
|
|
const examRecordDataId = this.$route.params.examRecordDataId;
|
|
|
- this.parentQuestionBody = null;
|
|
|
- this.question = null;
|
|
|
+ // if(this.examQuestion.questionId) {
|
|
|
+ // this.parentQuestionBody = null;
|
|
|
+ // this.question = null;
|
|
|
+ // }
|
|
|
+ // console.log(from, to);
|
|
|
+ if (from && to) {
|
|
|
+ const orderFrom = from.params.order - 1;
|
|
|
+ const toFrom = to.params.order - 1;
|
|
|
+ if (
|
|
|
+ this.examQuestionList[orderFrom].questionId !==
|
|
|
+ this.examQuestionList[toFrom].questionId
|
|
|
+ ) {
|
|
|
+ this.parentQuestionBody = null;
|
|
|
+ this.question = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
let qContentRes = null;
|
|
|
try {
|
|
|
qContentRes = await this.$http.get(
|
|
@@ -111,7 +125,10 @@ export default {
|
|
|
console.log(
|
|
|
"QuestionView: 如果网络异常,又离开本页面后,不再后续处理此请求 "
|
|
|
);
|
|
|
+ return;
|
|
|
}
|
|
|
+ this.parentQuestionBody = null;
|
|
|
+ this.question = null;
|
|
|
return;
|
|
|
}
|
|
|
|