Commit 70e97be1 by Chao Sun

记住上一页

parent 5a751580
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div data-toggle="modal">增加孩子年龄</div> <div data-toggle="modal">增加孩子年龄</div>
</div> </div>
<div class="content_footer"> <div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div> <div style="color: #8a8a8a;" (click)="before()">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }" (click)="next()"> 下一步</div> <div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }" (click)="next()"> 下一步</div>
</div> </div>
<div class="toastWrapper toast" *ngIf="isShow" (click)="closeToast()"> <div class="toastWrapper toast" *ngIf="isShow" (click)="closeToast()">
......
...@@ -163,4 +163,7 @@ export class AgeComponent implements OnInit { ...@@ -163,4 +163,7 @@ export class AgeComponent implements OnInit {
} }
} }
before(){
history.go(-1);
}
} }
...@@ -13,6 +13,8 @@ export class FamilyComponent implements OnInit { ...@@ -13,6 +13,8 @@ export class FamilyComponent implements OnInit {
// 上一次的答案 // 上一次的答案
lastQuestions: Array<any>; lastQuestions: Array<any>;
nextBtn: boolean = false; nextBtn: boolean = false;
Obj:Object = {}
targetObj:Object = {}
constructor(private commonService: CommonService, private router: Router) { constructor(private commonService: CommonService, private router: Router) {
this.pageAnswers = { this.pageAnswers = {
...@@ -29,6 +31,27 @@ export class FamilyComponent implements OnInit { ...@@ -29,6 +31,27 @@ export class FamilyComponent implements OnInit {
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 2).pop(); this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 2).pop();
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
this.curPageData = res['data']['survey']['pages'].filter(item => item.pageId === 2).pop(); this.curPageData = res['data']['survey']['pages'].filter(item => item.pageId === 2).pop();
console.log(this.lastQuestions)
console.log(this.curPageData)
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) {
this.lastQuestions['questions'][i]['options'].forEach(option => {
if(Object.keys(option).indexOf('optionId')>-1){
this.targetObj = option
}
// this.curPageData['questions'][j]['options'].forEach(option=>{
// if(Object.keys(option).indexOf('optionId')>-1){
// this.Obj = option
// }
// })
// this.Obj['optionId'] = this.targetObj['optionId']
console.log(this.targetObj)
this.selectedFamily(this.targetObj);
});
}
}
}
// 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) {
...@@ -44,6 +67,7 @@ export class FamilyComponent implements OnInit { ...@@ -44,6 +67,7 @@ export class FamilyComponent implements OnInit {
// } // }
// console.log(this.curPageData) // console.log(this.curPageData)
}); });
} }
// 选择家庭结构 // 选择家庭结构
......
...@@ -34,6 +34,7 @@ export class LoanComponent implements OnInit { ...@@ -34,6 +34,7 @@ export class LoanComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.nextBtn = false; this.nextBtn = false;
this.surveyInfo(); this.surveyInfo();
} }
surveyInfo() { surveyInfo() {
......
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