Commit 2d00082b by Sweet Zhang

修改后退时出现的问题

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