Commit 373a640a by Chao Sun

孩子年龄

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