Commit 6a733dcd by Sweet Zhang

收入贷款社保

parent b43aad5c
......@@ -20,6 +20,8 @@ export class ChildrenHealthComponent implements OnInit {
questions: Array<any> = [];
// 总共有几个孩子
childTotalCount: any;
// 暂存多个孩子的答案
childTotalQuestions: Array<any> = [];
constructor(private commonService: CommonService,
private router: Router,
......@@ -50,16 +52,26 @@ export class ChildrenHealthComponent implements OnInit {
// 选择健康情况(多选)
selectedHealth(option) {
this.id = this.route.snapshot.params['childId'];
option['selected'] = !option['selected'];
this.questions = [];
this.getOptions(99, option);
const questions = {
questionId: this.curPageData['questions']['0']['questionId'],
questionName: '孩子' + this.id + '的健康状态',
childId: this.id,
options: this.questions
};
for (let i = 0; i < this.childTotalQuestions.length; i++) {
if (this.childTotalQuestions[i].childId == questions.childId) {
this.childTotalQuestions.splice(this.childTotalQuestions.indexOf(this.childTotalQuestions[i]), 1);
break;
}
}
this.childTotalQuestions.push(questions);
this.pageAnswers = {
pageId: this.curPageData['pageId'],
questions: [{
questionId: this.curPageData['questions']['0']['questionId'],
questionName: this.curPageData['questions']['0']['questionName'],
options: this.questions
}],
questions: this.childTotalQuestions,
};
this.commonService.addAnswer(this.pageAnswers);
}
......
......@@ -7,19 +7,19 @@
</div>
<ul class="income">
<li
[ngClass]="{ selected: selectedOptionId == options.optionId }"
[ngClass]="{ selected: options['selected'] }"
*ngFor="let options of this.curPageData?.questions[0].options"
(click)="selectedIncome(this.curPageData?.questions[0],options)"
>
{{ 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="income" *ngIf="hasMate">
<ul class="income" *ngIf="this.type == 2 || this.type == 4">
<li
[ngClass]="{ selected: selectedOptionId == options.optionId}"
[ngClass]="{ selected: options['selected']}"
*ngFor="let options of this.curPageData?.questions[1]['options']"
(click)="selectedIncome(this.curPageData?.questions[1],options)"
>
......
......@@ -8,13 +8,11 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./income.component.css']
})
export class IncomeComponent implements OnInit {
hasMate: boolean;
curPageData: Array<any>;
pageAnswers: any;
// 家庭结构
type: any;
selectedOptionId: any;
nextBtn:boolean;
nextBtn: boolean;
constructor(private commonService: CommonService,
private router: Router,
......@@ -34,34 +32,43 @@ export class IncomeComponent implements OnInit {
}
ngOnInit() {
this.surveyInfo()
//判断家庭决定是否显示配偶
if(this.type==2 || this.type == 4){
this.hasMate = true;
}else{
this.hasMate = false;
}
this.surveyInfo();
this.nextBtn = false;
}
surveyInfo() {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['6']
console.log(this.curPageData)
this.curPageData = res['data']['survey'].pages['6'];
// console.log(this.curPageData)
this.pageAnswers.pageId = this.curPageData['pageId'];
}
})
}
selectedIncome(question, option) {
this.selectedOptionId = option.optionId;
option.selected = true;
option.selected = !option.selected;
const questions = {
questionId: question.questionId,
questionName: question.questionName,
options: [option]
options: []
};
// 将选择的状态改为true,其他的改为false;
if (question['options'].length > 0) {
for (let j = 0; j < question['options'].length; j++) {
if (question['options'][j].optionId == option.optionId) {
question['options'][j].selected = true;
} else {
question['options'][j].selected = false;
}
// 拿到所有selected为true的选项
if (question['options'][j]['selected']) {
questions.options.push(question['options'][j]);
}
}
}
// console.log(questions)
// 同一个问题更改答案
for (let i = 0; i < this.pageAnswers.questions.length; i++) {
if (this.pageAnswers.questions[i].questionId == question.questionId) {
const index = this.pageAnswers.questions.indexOf(this.pageAnswers.questions[i]);
......@@ -70,28 +77,27 @@ export class IncomeComponent implements OnInit {
}
this.pageAnswers.questions.push(questions);
this.commonService.addAnswer(this.pageAnswers);
console.log(questions)
console.log(this.pageAnswers)
//判断页面需要几个问题
if(this.type==2 || this.type == 4){
if(this.curPageData['questions'].length == this.pageAnswers['questions'].length){
// console.log(this.pageAnswers)
// 判断页面需要几个问题
if (this.type == 2 || this.type == 4) {
if (this.curPageData['questions'].length == this.pageAnswers['questions'].length) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}else{
if(this.pageAnswers['questions'].length>0){
} else {
if (this.pageAnswers['questions'].length > 0) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/loan'],{queryParams:{type:this.type}})
}else{
next() {
if (this.nextBtn == true) {
this.router.navigate(['/loan'], {queryParams: {type: this.type}})
} else {
return;
}
}
......
......@@ -11,12 +11,13 @@ export class JobComponent implements OnInit {
pageAnswers: any;
selectedOptionId: any;
type: any;
id:any;
nextBtn:boolean;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute) {
/**
id: any;
nextBtn: boolean;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute) {
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
......@@ -49,7 +50,7 @@ export class JobComponent implements OnInit {
this.curPageData = res['data'].survey.pages['3'];
} else {
this.curPageData = res['data'].survey.pages['4'];
}
console.log(this.curPageData)
}
......@@ -71,32 +72,32 @@ export class JobComponent implements OnInit {
this.commonService.addAnswer(this.pageAnswers);
console.log(this.pageAnswers)
console.log(this.commonService.todos)
if(this.pageAnswers['questions'].length>0){
if (this.pageAnswers['questions'].length > 0) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}
// 下一步
next() {
//先判断下一步能不能点
//如果是二人世界或是多口之家跳转到配偶页
//先判断当前页是您的页还是配偶页
if(this.nextBtn ==true){
if(this.id == 1){
if(this.type ==2 || this.type==4){
this.router.navigate(['/spouse_job'],{queryParams:{type:this.type}})
}else{
this.router.navigate(['/transit1'],{queryParams:{type:this.type}})
// 先判断下一步能不能点
// 如果是二人世界或是多口之家跳转到配偶页
// 先判断当前页是您的页还是配偶页
if (this.nextBtn == true) {
if (this.id == 1) {
if (this.type == 2 || this.type == 4) {
this.router.navigate(['/spouse_job'], {queryParams: {type: this.type}})
} else {
this.router.navigate(['/transit1'], {queryParams: {type: this.type}})
}
}else{
this.router.navigate(['/transit1'],{queryParams:{type:this.type}})
} else {
this.router.navigate(['/transit1'], {queryParams: {type: this.type}})
}
}else{
} else {
return;
}
}
}
......@@ -8,17 +8,16 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./loan.component.css']
})
export class LoanComponent implements OnInit {
curPageData:Array<any>;
//家庭结构
type:any;
curPageData: Array<any>;
// 家庭结构
type: any;
pageAnswers: any;
selectedOptionId: any;
nextBtn:boolean;
nextBtn: boolean;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute
) {
/**
private router: Router,
private route: ActivatedRoute) {
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
......@@ -47,15 +46,26 @@ export class LoanComponent implements OnInit {
})
}
selectedLoan(question,option){
this.selectedOptionId = option.optionId;
option.selected = true;
selectedLoan(question, option) {
option.selected = !option.selected;
const questions = {
questionId: question.questionId,
questionName: question.questionName,
options: [option]
options: []
};
if (question['options'].length > 0) {
for (let j = 0; j < question['options'].length; j++) {
if (question['options'][j].optionId == option.optionId) {
question['options'][j].selected = true;
} else {
question['options'][j].selected = false;
}
// 拿到所有selected为true的选项
if (question['options'][j]['selected']) {
questions.options.push(question['options'][j]);
}
}
}
for (let i = 0; i < this.pageAnswers.questions.length; i++) {
if (this.pageAnswers.questions[i].questionId == question.questionId) {
const index = this.pageAnswers.questions.indexOf(this.pageAnswers.questions[i]);
......@@ -64,20 +74,19 @@ export class LoanComponent implements OnInit {
}
this.pageAnswers.questions.push(questions);
this.commonService.addAnswer(this.pageAnswers);
console.log(questions)
console.log(this.pageAnswers)
if(this.curPageData['questions'].length == this.pageAnswers['questions'].length){
// console.log(this.pageAnswers)
if (this.curPageData['questions'].length == this.pageAnswers['questions'].length) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/social'],{queryParams:{type:this.type}})
}else{
return
next() {
if (this.nextBtn == true) {
this.router.navigate(['/social'], {queryParams: {type: this.type}})
} else {
return;
}
}
}
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {CommonService} from '../common.service';
import {ActivatedRoute, Router} from "@angular/router";
......@@ -8,17 +8,17 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls: ['./social-security.component.css']
})
export class SocialSecurityComponent implements OnInit {
curPageData:Array<any>;
hasMate:boolean;
//家庭结构
type:any;
nextBtn:boolean;
curPageData: Array<any>;
hasMate: boolean;
// 家庭结构
type: any;
nextBtn: boolean;
pageAnswers: any;
selectedOptionId: any;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute) {
/**
private router: Router,
private route: ActivatedRoute) {
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
......@@ -34,31 +34,46 @@ export class SocialSecurityComponent implements OnInit {
ngOnInit() {
this.surveyInfo()
//判断家庭决定是否显示配偶
if(this.type==2 || this.type == 4){
// 判断家庭决定是否显示配偶
if (this.type == 2 || this.type == 4) {
this.hasMate = true;
}else{
} else {
this.hasMate = false;
}
this.nextBtn = false;
}
surveyInfo() {
this.commonService.surveyInfo().then(res => {
if (res['success']) {
this.curPageData = res['data']['survey'].pages['8']
this.curPageData = res['data']['survey'].pages['8'];
this.pageAnswers.pageId = this.curPageData['pageId'];
console.log(this.curPageData)
}
})
}
selectedSocial(question,option){
this.selectedOptionId = option.optionId;
option.selected = true;
selectedSocial(question, option) {
option.selected = !option.selected;
const questions = {
questionId: question.questionId,
questionName: question.questionName,
options: [option]
options: []
};
console.log(questions)
if (question['options'].length > 0) {
for (let j = 0; j < question['options'].length; j++) {
if (question['options'][j].optionId == option.optionId) {
question['options'][j].selected = true;
} else {
question['options'][j].selected = false;
}
// 拿到所有selected为true的选项
if (question['options'][j]['selected']) {
questions.options.push(question['options'][j]);
}
}
}
for (let i = 0; i < this.pageAnswers.questions.length; i++) {
if (this.pageAnswers.questions[i].questionId == question.questionId) {
const index = this.pageAnswers.questions.indexOf(this.pageAnswers.questions[i]);
......@@ -66,27 +81,28 @@ export class SocialSecurityComponent implements OnInit {
}
}
this.pageAnswers.questions.push(questions);
// console.log(this.pageAnswers)
this.commonService.addAnswer(this.pageAnswers);
//判断页面需要几个问题
if(this.type==2 || this.type == 4){
if(this.curPageData['questions'].length == this.pageAnswers['questions'].length){
// 判断页面需要几个问题
if (this.type == 2 || this.type == 4) {
if (this.curPageData['questions'].length == this.pageAnswers['questions'].length) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}else{
if(this.pageAnswers['questions'].length>0){
} else {
if (this.pageAnswers['questions'].length > 0) {
this.nextBtn = true;
}else{
} else {
this.nextBtn = false;
}
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/transit2'],{queryParams:{type:this.type}})
}else{
next() {
if (this.nextBtn == true) {
this.router.navigate(['/transit2'], {queryParams: {type: this.type}})
} 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