Commit 2d00082b by Sweet Zhang

修改后退时出现的问题

parent d9e02c3f
......@@ -48,13 +48,13 @@
*ngIf="curPage == 10"
(getAllAnswer)="getAllAnswer($event)"
></app-page11>
<app-page12
[curPageData]="curPageData"
<app-page12
[curPageData]="curPageData"
*ngIf="curPage == 11"
(getAllAnswer)="getAllAnswer($event)"
></app-page12>
<app-page13
[curPageData]="curPageData"
<app-page13
[curPageData]="curPageData"
*ngIf="curPage == 12"
(getAllAnswer)="getAllAnswer($event)"
></app-page13>
......@@ -63,13 +63,13 @@
*ngIf="curPage == 13"
(getAllAnswer)="getAllAnswer($event)"
></app-page14>
<app-page15
[curPageData]="curPageData"
<app-page15
[curPageData]="curPageData"
*ngIf="curPage == 14"
(getAllAnswer)="getAllAnswer($event)"
></app-page15>
<app-page16
[curPageData]="curPageData"
<app-page16
[curPageData]="curPageData"
*ngIf="curPage == 15"
(getAllAnswer)="getAllAnswer($event)"
[provinceList] = "provinceList"
......@@ -79,8 +79,8 @@
<div>获取家庭分析报告</div>
</div>
<div class="content_footer" *ngIf="curPage != 0 && curPage!=16">
<!-- <div (click)="reducePage()" style="color: #8a8a8a;">&lt;</div> -->
<div
<div (click)="reducePage()" style="color: #8a8a8a;">&lt;</div>
<div
(click)="addPage()"
[ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
>下一步</div>
......
......@@ -10,29 +10,31 @@ export class Page3Component implements OnInit {
@Input() isShowChildAgeBtn: boolean
@Output() getAllAnswer = new EventEmitter<any>()
isShow: boolean
curQues: Object
curAllQues: Object
selectedNum: number
options: Array<any>
curQuesIndex: number
isShow: boolean;
curQues: Object;
curAllQues: Object;
selectedNum: number;
options: Array<any>;
curQuesIndex: number;
//当前问题长度
curQuesLen: number
curQuesLen: number;
//增加孩子点击次数
addChildCount: number
addChildCount: number;
curQuestionSelecte: string;
questions: Array<any>;
selectedObj:Object;
selectedObj: Object;
constructor() {
this.questions = [];
}
ngOnInit() {
this.curQues = {}
this.curAllQues = {}
this.curQuesLen = this.curPageData['questions'].length
this.curQues = {};
this.curAllQues = {};
this.curQuesLen = this.curPageData['questions'].length;
//初始化增加孩子按钮可以点2次
this.addChildCount = 2;
this.selectedOptions();
// console.log(this.curPageData)
}
......@@ -53,12 +55,21 @@ export class Page3Component implements OnInit {
this.curAllQues[questionId] = option
const questions = Object.keys(this.curAllQues).map(questionId => {
return {questionId, options: [this.curAllQues[questionId]]}
})
});
for (let i = 0; i < questions.length; i++) {
for (let j = 0; j < this.questions.length; j++) {
if (questions[i]['questionId'] != this.questions[j]['questionId']) {
questions.push(this.questions[j]);
break;
}
}
}
const ret = {
pageId: 3,
questions
}
this.getAllAnswer.emit(ret)
};
console.log(ret);
this.getAllAnswer.emit(ret);
}
changeStyle(options, optionId) {
......@@ -71,37 +82,36 @@ export class Page3Component implements OnInit {
}
// 保存用户选择的信息
// selectedOptions() {
// if (this.curPageData['questions'].length > 0) {
// for (let i = 0; i < this.curPageData['questions'].length; i++) {
// if (!this.curPageData['questions'][i]['name']) {
// return;
// }
// let option = {};
// let question = {
// questionId: '',
// options: []
// };
// question.questionId = this.curPageData['questions'][i].questionId;
// option = {
// customerInput: null,
// optionId: this.curPageData['questions'][i]['optionId'],
// optionName: this.curPageData['questions'][i]['name'],
// optionOrder: 2,
// selected: true
// };
// question.options.push(option);
// this.questions.push(question);
// }
// }
// const ret = {
// pageId: 3,
// questions: this.questions
// }
// console.log(ret);
// this.getAllAnswer.emit(ret);
// }
selectedOptions() {
if (this.curPageData['questions'].length > 0) {
for (let i = 0; i < this.curPageData['questions'].length; i++) {
if (!this.curPageData['questions'][i]['name']) {
return;
}
let option = {};
let question = {
questionId: '',
options: []
};
question.questionId = this.curPageData['questions'][i].questionId;
option = {
customerInput: null,
optionId: this.curPageData['questions'][i]['optionId'],
optionName: this.curPageData['questions'][i]['name'],
optionOrder: 2,
selected: true
};
question.options.push(option);
this.questions.push(question);
}
}
const ret = {
pageId: 3,
questions: this.questions
};
console.log(ret);
this.getAllAnswer.emit(ret);
}
addChild() {
// this.addChildCount--
......
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