Commit 260e14e5 by Sweet Zhang

孩子疾病

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