Commit 260e14e5 by Sweet Zhang

孩子疾病

parent f16774c7
......@@ -48,12 +48,11 @@ export class ChildrenHealthComponent implements OnInit {
}
ngOnInit() {
this.surveyInfo()
this.surveyInfo();
}
// 选择健康情况(多选)
selectedHealth(option, lastFlag) {
// debugger;
if (lastFlag === false) {
option['selected'] = !option['selected'];
}
......@@ -77,8 +76,6 @@ export class ChildrenHealthComponent implements OnInit {
pageId: this.curPageData['pageId'],
questions: this.childTotalQuestions,
};
// console.log(this.pageAnswers);
// console.log(this.curPageData)
if (this.pageAnswers.questions.every(item => item.options.length > 0)) {
this.nextBtn = true;
} else {
......@@ -111,16 +108,14 @@ export class ChildrenHealthComponent implements OnInit {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['12'];
// debugger;
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 13).pop();
console.log(this.lastQuestions)
this.id = this.route.snapshot.params['childId'];
if (this.lastQuestions) {
this.childTotalQuestions = this.lastQuestions['questions'];
for (let i = 0; i < this.lastQuestions['questions'].length; i++) {
for (let j = 0; j < this.curPageData['questions'].length; j++) {
if (this.lastQuestions['questions'][i].questionId == this.curPageData['questions'][j].questionId) {
// console.log(this.lastQuestions)
// console.log(this.curPageData)
if (this.lastQuestions['questions'][i].questionSubId == this.curPageData['questions'][j].questionSubId) {
if (this.id == this.lastQuestions['questions'][i]['childId']) {
this.lastQuestions['questions'][i]['options'].forEach(option => {
if (Object.keys(option).indexOf('optionId') > -1) {
const targetObj = option;
......@@ -130,17 +125,13 @@ export class ChildrenHealthComponent implements OnInit {
}
});
this.selectedHealth(targetObj, true);
// console.log(this.targetObj);
}
});
}
}
}
}
}
console.log(this.curPageData)
}
})
}
......@@ -171,6 +162,7 @@ export class ChildrenHealthComponent implements OnInit {
// 上一步
before() {
this.surveyInfo();
this.commonService.before();
}
}
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