Commit e2da9242 by Sweet Zhang

增加年龄的判断

parent aa75d93c
......@@ -21,6 +21,7 @@ export class AgeComponent implements OnInit {
question: any;
// 上一次的答案
lastQuestions: Array<any>;
nextBtn: boolean = false;
constructor(private commonService: CommonService, private router: Router, private route: ActivatedRoute) {
/**
......@@ -96,14 +97,18 @@ export class AgeComponent implements OnInit {
// console.log(this.curPageData);
this.commonService.addAnswer(this.pageAnswers);
this.closeToast();
console.log(this.pageAnswers)
console.log(this.pageAnswers);
if (this.curPageData['questions'].length == this.pageAnswers.questions.length) {
this.nextBtn = true;
} else {
this.nextBtn = false;
}
}
showToast(question, idx) {
this.isShow = true;
this.curQues = question;
this.curQuesIndex = idx;
console.log(question)
for (let i = 0; i < question['options'].length; i++) {
if (question.optionName == question['options'][i].optionName) {
question['options'][i]['selected'] = true
......@@ -130,6 +135,11 @@ export class AgeComponent implements OnInit {
this.question.optionName = null;
this.question.questionName = '孩子' + this.questionSubId + '年龄';
this.curPageData['questions'].push(this.question);
if (this.curPageData['questions'].length == this.pageAnswers.questions.length) {
this.nextBtn = true;
} else {
this.nextBtn = false;
}
}
// 根据家庭结构处理展示数据
......@@ -146,6 +156,11 @@ export class AgeComponent implements OnInit {
// 下一步
next() {
this.router.navigate(['/job'], {queryParams: {type: this.type}});
if (this.nextBtn) {
this.router.navigate(['/job'], {queryParams: {type: this.type}});
} else {
return;
}
}
}
......@@ -66,7 +66,7 @@ export class FamilyComponent implements OnInit {
}],
};
this.commonService.addAnswer(this.pageAnswers);
// console.log(this.pageAnswers)
// console.log(this.pageAnswers);
if (this.pageAnswers.questions[0].options.every((item) => {
return item.selected;
})) {
......
......@@ -108,9 +108,7 @@ export class HealthComponent implements OnInit {
// 下一步
next() {
if (this.pageAnswers.questions[0].options.every((item) => {
return item.selected;
})) {
if (this.nextBtn) {
// 如果是二人世界或是多口之家跳转到配偶页
// 先判断当前页是您的页还是配偶页
if (this.id == 1) {
......
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