Commit 256da1ee by Chao Sun

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

parent da97f053
......@@ -130,29 +130,37 @@ export class AskComponent implements OnInit {
getAllAnswer(e) {
this.questionInfo = e;
// console.log(e)
// debugger;
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){
for(let i=0;i<e['questions'].length;i++){
if(e['questions'][i]['options'].length>0){
for(let j=0;j<e['questions'][i]['options'].length;j++){
if(!e['questions'][i]['options'][j]['optionId']){
this.nextBtn = false
}else{
this.nextBtn = true
if(this.curPage==15){
this.nextBtn = true
}else{
for(let j=0;j<e['questions'][i]['options'].length;j++){
if(!e['questions'][i]['options'][j]['optionId']){
this.nextBtn = false
}else{
this.nextBtn = true
}
}
}
}
}
}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() {
......
......@@ -97,6 +97,7 @@ export class Page16Component implements OnInit {
]
}
this.getAllAnswer.emit(ret)
console.log(ret)
}
setOptionSelected() {
......
......@@ -69,7 +69,6 @@ export class Page3Component implements OnInit {
pageId: 3,
questions
};
console.log(ret);
this.getAllAnswer.emit(ret);
}
......@@ -110,7 +109,6 @@ export class Page3Component implements OnInit {
pageId: 3,
questions: this.questions
};
console.log(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