Commit 256da1ee by Chao Sun

判断问题长度和答案长度是否匹配

parent da97f053
...@@ -130,29 +130,37 @@ export class AskComponent implements OnInit { ...@@ -130,29 +130,37 @@ export class AskComponent implements OnInit {
getAllAnswer(e) { getAllAnswer(e) {
this.questionInfo = e; this.questionInfo = e;
// console.log(e) // console.log(e)
// debugger;
const page2Answer = this.allAnswers[1] const page2Answer = this.allAnswers[1]
if(this.curPage == 6 || this.curPage == 8){ //判断当前问题长度和当前回答长度
const optionId = page2Answer.questions[0].options[0].optionId
if(optionId==1 || optionId==3){
if(e['questions'].length>0){
this.nextBtn = true
}
}
}
if(this.curPageData['questions'].length == e['questions'].length){ if(this.curPageData['questions'].length == e['questions'].length){
for(let i=0;i<e['questions'].length;i++){ for(let i=0;i<e['questions'].length;i++){
if(e['questions'][i]['options'].length>0){ if(e['questions'][i]['options'].length>0){
for(let j=0;j<e['questions'][i]['options'].length;j++){ if(this.curPage==15){
if(!e['questions'][i]['options'][j]['optionId']){ this.nextBtn = true
this.nextBtn = false }else{
}else{ for(let j=0;j<e['questions'][i]['options'].length;j++){
this.nextBtn = true if(!e['questions'][i]['options'][j]['optionId']){
this.nextBtn = false
}else{
this.nextBtn = true
}
} }
} }
} }
} }
}else{ }else{
this.nextBtn = false //如果问题长度和答案长度不一样时判断问题页中是否配偶问题不显示
if(this.curPage == 6 || this.curPage == 8){
const optionId = page2Answer.questions[0].options[0].optionId
if(optionId==1 || optionId==3){
if(e['questions'].length>0){
this.nextBtn = true
}
}
}else{
this.nextBtn = false;
}
} }
} }
setCurPageData() { setCurPageData() {
......
...@@ -97,6 +97,7 @@ export class Page16Component implements OnInit { ...@@ -97,6 +97,7 @@ export class Page16Component implements OnInit {
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
console.log(ret)
} }
setOptionSelected() { setOptionSelected() {
......
...@@ -69,7 +69,6 @@ export class Page3Component implements OnInit { ...@@ -69,7 +69,6 @@ export class Page3Component implements OnInit {
pageId: 3, pageId: 3,
questions questions
}; };
console.log(ret);
this.getAllAnswer.emit(ret); this.getAllAnswer.emit(ret);
} }
...@@ -110,7 +109,6 @@ export class Page3Component implements OnInit { ...@@ -110,7 +109,6 @@ export class Page3Component implements OnInit {
pageId: 3, pageId: 3,
questions: this.questions questions: this.questions
}; };
console.log(ret);
this.getAllAnswer.emit(ret); this.getAllAnswer.emit(ret);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment