Commit 373a640a by Chao Sun

孩子年龄

parent fa4d8075
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<ul class="ageContent"> <ul class="ageContent">
<li *ngFor="let optionsList of this.curPageData?.questions; index as i"> <li *ngFor="let optionsList of this.curPageData?.questions; index as i">
<div>{{ optionsList.questionName }}</div> <div>{{ optionsList.questionName }}</div>
<b (click)="showToast(optionsList, i)" style="width:35%;text-align: center;float: right"> <b (click)="showToast(optionsList)" style="width:35%;text-align: center;float: right">
<span style="width:20%;text-align: center;">{{ optionsList.optionName}}</span> <span style="width:20%;text-align: center;">{{ optionsList.optionName}}</span>
<span style="width:10%;text-align: center;float: right">&gt;</span> <span style="width:10%;text-align: center;float: right">&gt;</span>
</b> </b>
......
...@@ -13,7 +13,7 @@ export class AgeComponent implements OnInit { ...@@ -13,7 +13,7 @@ export class AgeComponent implements OnInit {
curPageData: Array<any>; curPageData: Array<any>;
isShow: boolean; isShow: boolean;
curQues: any; curQues: any;
curQuesIndex: number;
pageAnswers: any; pageAnswers: any;
// 可添加的孩子总个数 // 可添加的孩子总个数
totalChildLimitCount: number; totalChildLimitCount: number;
...@@ -22,7 +22,7 @@ export class AgeComponent implements OnInit { ...@@ -22,7 +22,7 @@ export class AgeComponent implements OnInit {
// 上一次的答案 // 上一次的答案
lastQuestions: Array<any>; lastQuestions: Array<any>;
nextBtn: boolean = false; nextBtn: boolean = false;
targetObj: any = {};
constructor(private commonService: CommonService, private router: Router, private route: ActivatedRoute) { constructor(private commonService: CommonService, private router: Router, private route: ActivatedRoute) {
/** /**
* 1:单身贵族 * 1:单身贵族
...@@ -41,7 +41,8 @@ export class AgeComponent implements OnInit { ...@@ -41,7 +41,8 @@ export class AgeComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
console.log(this.commonService.todosCopy) this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 3).pop();
console.log(this.lastQuestions)
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
this.curPageData = res['data']['survey']['pages'].filter(item => item.pageId === 3).pop(); this.curPageData = res['data']['survey']['pages'].filter(item => item.pageId === 3).pop();
this.pageAnswers.pageId = this.curPageData['pageId']; this.pageAnswers.pageId = this.curPageData['pageId'];
...@@ -54,6 +55,25 @@ export class AgeComponent implements OnInit { ...@@ -54,6 +55,25 @@ export class AgeComponent implements OnInit {
} else { } else {
this.handleData([]); this.handleData([]);
} }
if (this.lastQuestions) {
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;
}
// console.log(this.targetObj)
this.showToast(this.curPageData['questions'][j])
this.selectedAge(this.targetObj);
});
}
}
}
}else{
return
}
// console.log(this.curPageData) // console.log(this.curPageData)
}); });
} }
...@@ -106,10 +126,9 @@ export class AgeComponent implements OnInit { ...@@ -106,10 +126,9 @@ export class AgeComponent implements OnInit {
} }
} }
showToast(question, idx) { showToast(question) {
this.isShow = true; this.isShow = true;
this.curQues = question; this.curQues = question;
this.curQuesIndex = idx;
for (let i = 0; i < question['options'].length; i++) { for (let i = 0; i < question['options'].length; i++) {
if (question.optionName == question['options'][i].optionName) { if (question.optionName == question['options'][i].optionName) {
question['options'][i]['selected'] = true question['options'][i]['selected'] = true
......
...@@ -34,7 +34,6 @@ export class FamilyComponent implements OnInit { ...@@ -34,7 +34,6 @@ export class FamilyComponent implements OnInit {
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();
if (this.lastQuestions) { if (this.lastQuestions) {
this.lastSelectedOptionId = this.lastQuestions['questions']['0']['options']['0'].optionId;
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) {
......
...@@ -13,7 +13,8 @@ export class IncomeComponent implements OnInit { ...@@ -13,7 +13,8 @@ export class IncomeComponent implements OnInit {
// 家庭结构 // 家庭结构
type: any; type: any;
nextBtn: boolean; nextBtn: boolean;
lastQuestions: Array<any>;
targetObj:Object = {}
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
...@@ -32,8 +33,9 @@ export class IncomeComponent implements OnInit { ...@@ -32,8 +33,9 @@ export class IncomeComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.surveyInfo();
this.nextBtn = false; this.nextBtn = false;
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 7).pop();
this.surveyInfo();
} }
surveyInfo() { surveyInfo() {
...@@ -42,6 +44,22 @@ export class IncomeComponent implements OnInit { ...@@ -42,6 +44,22 @@ export class IncomeComponent implements OnInit {
this.curPageData = res['data']['survey'].pages['6']; this.curPageData = res['data']['survey'].pages['6'];
// console.log(this.curPageData) // console.log(this.curPageData)
this.pageAnswers.pageId = this.curPageData['pageId']; this.pageAnswers.pageId = this.curPageData['pageId'];
if(this.lastQuestions){
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.selectedIncome(this.curPageData['questions'][j],this.targetObj);
});
}
}
}
}else{
return;
}
} }
}) })
} }
......
...@@ -13,7 +13,8 @@ export class JobComponent implements OnInit { ...@@ -13,7 +13,8 @@ export class JobComponent implements OnInit {
type: any; type: any;
id: any; id: any;
nextBtn: boolean; nextBtn: boolean;
lastQuestions: Array<any>;
targetObj:Object = {}
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
...@@ -31,7 +32,6 @@ export class JobComponent implements OnInit { ...@@ -31,7 +32,6 @@ export class JobComponent implements OnInit {
* */ * */
this.type = this.route.snapshot.queryParams['type']; this.type = this.route.snapshot.queryParams['type'];
this.id = this.route.snapshot['data']['0']['id']; this.id = this.route.snapshot['data']['0']['id'];
console.log(this.id)
this.pageAnswers = { this.pageAnswers = {
pageId: '', pageId: '',
questions: [{ questions: [{
...@@ -48,9 +48,45 @@ export class JobComponent implements OnInit { ...@@ -48,9 +48,45 @@ export class JobComponent implements OnInit {
if (res['success']) { if (res['success']) {
if (this.id == 1) { if (this.id == 1) {
this.curPageData = res['data'].survey.pages['3']; this.curPageData = res['data'].survey.pages['3'];
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 4).pop();
console.log(this.lastQuestions)
if(this.lastQuestions){
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.selectedJob(this.targetObj);
});
}
}
}
}else{
return
}
} else { } else {
this.curPageData = res['data'].survey.pages['4']; this.curPageData = res['data'].survey.pages['4'];
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 5).pop();
if(this.lastQuestions){
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.selectedJob(this.targetObj);
});
}
}
}
}else{
return
}
} }
console.log(this.curPageData) console.log(this.curPageData)
} }
......
...@@ -43,18 +43,22 @@ export class LoanComponent implements OnInit { ...@@ -43,18 +43,22 @@ export class LoanComponent implements OnInit {
if (res['success']) { if (res['success']) {
this.curPageData = res['data']['survey'].pages['7']; this.curPageData = res['data']['survey'].pages['7'];
this.pageAnswers.pageId = this.curPageData['pageId']; this.pageAnswers.pageId = this.curPageData['pageId'];
for (let i = 0; i < this.lastQuestions['questions'].length; i++) { if(this.lastQuestions){
for (let j = 0; j < this.curPageData['questions'].length; j++) { for (let i = 0; i < this.lastQuestions['questions'].length; i++) {
if (this.lastQuestions['questions'][i].questionId == this.curPageData['questions'][j].questionId) { for (let j = 0; j < this.curPageData['questions'].length; j++) {
this.lastQuestions['questions'][i]['options'].forEach(option => { if (this.lastQuestions['questions'][i].questionId == this.curPageData['questions'][j].questionId) {
if(Object.keys(option).indexOf('optionId')>-1){ this.lastQuestions['questions'][i]['options'].forEach(option => {
this.targetObj = option if(Object.keys(option).indexOf('optionId')>-1){
} this.targetObj = option
this.selectedLoan(this.curPageData['questions'][j],this.targetObj); }
this.selectedLoan(this.curPageData['questions'][j],this.targetObj);
});
});
}
} }
} }
}else{
return;
} }
} }
console.log(this.pageAnswers) console.log(this.pageAnswers)
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
{{ options.optionName }} {{ options.optionName }}
</li> </li>
</ul> </ul>
<div class="questionTitle" *ngIf="hasMate"> <div class="questionTitle" *ngIf="this.type == 2 || this.type == 4">
{{ this.curPageData?.questions[1]['questionName'] }} {{ this.curPageData?.questions[1]['questionName'] }}
</div> </div>
<ul class="jobContent" *ngIf="hasMate"> <ul class="jobContent" *ngIf="this.type == 2 || this.type == 4">
<li <li
[ngClass]="{ selected: options['selected'] == true }" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData?.questions[1]['options']" *ngFor="let options of this.curPageData?.questions[1]['options']"
......
...@@ -9,12 +9,12 @@ import {ActivatedRoute, Router} from "@angular/router"; ...@@ -9,12 +9,12 @@ import {ActivatedRoute, Router} from "@angular/router";
}) })
export class SocialSecurityComponent implements OnInit { export class SocialSecurityComponent implements OnInit {
curPageData: Array<any>; curPageData: Array<any>;
hasMate: boolean;
// 家庭结构 // 家庭结构
type: any; type: any;
nextBtn: boolean; nextBtn: boolean;
pageAnswers: any; pageAnswers: any;
lastQuestions: Array<any>;
targetObj:Object = {}
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
...@@ -33,14 +33,9 @@ export class SocialSecurityComponent implements OnInit { ...@@ -33,14 +33,9 @@ export class SocialSecurityComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.surveyInfo();
// 判断家庭决定是否显示配偶
if (this.type == 2 || this.type == 4) {
this.hasMate = true;
} else {
this.hasMate = false;
}
this.nextBtn = false; this.nextBtn = false;
this.lastQuestions = this.commonService.todosCopy.filter(item => item.pageId == 9).pop();
this.surveyInfo();
} }
surveyInfo() { surveyInfo() {
...@@ -48,7 +43,22 @@ export class SocialSecurityComponent implements OnInit { ...@@ -48,7 +43,22 @@ export class SocialSecurityComponent implements OnInit {
if (res['success']) { if (res['success']) {
this.curPageData = res['data']['survey'].pages['8']; this.curPageData = res['data']['survey'].pages['8'];
this.pageAnswers.pageId = this.curPageData['pageId']; this.pageAnswers.pageId = this.curPageData['pageId'];
// console.log(this.curPageData) if(this.lastQuestions){
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.selectedSocial(this.curPageData['questions'][j],this.targetObj);
});
}
}
}
}else{
return;
}
} }
}) })
} }
......
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