Commit aba6a967 by Chao Sun

age selected fix

parent 9fc8d2ae
......@@ -40,7 +40,6 @@ export class AgeComponent implements OnInit {
}
ngOnInit() {
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 3).pop();
this.commonService.surveyInfo().then(res => {
this.curPageData = res['data']['survey']['pages'].filter(item => item.pageId === 3).pop();
this.pageAnswers.pageId = this.curPageData['pageId'];
......@@ -73,6 +72,13 @@ export class AgeComponent implements OnInit {
// 如果有孩子,需要考虑是孩子几的年龄
if (this.curPageData['questions'][j]['questionSubId'] == this.curQues.questionSubId) {
this.curPageData['questions'][j].optionName = options.optionName;
for (let m = 0; m < this.curPageData['questions'][j].options.length; m++) {
if (this.curPageData['questions'][j].options[m].optionId == options.optionId) {
this.curPageData['questions'][j].options[m]['selected'] = true;
} else {
this.curPageData['questions'][j].options[m]['selected'] = false;
}
}
}
}
}
......
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