Commit 20edb27f by Chao Sun

疾病

parent ffb5a675
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
</div> </div>
<ul class="jobContent"> <ul class="jobContent">
<li <li
*ngFor="let options of this.curPageData?.questions[0]['options']" *ngFor="let options of this.options"
[ngClass]="{ selected: options['selected'] == true }" [ngClass]="{ selected: selectedOptionId == options.optionId }"
(click)="getAnswer(options)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
...@@ -15,7 +16,8 @@ ...@@ -15,7 +16,8 @@
</div> </div>
<div class="content_footer"> <div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div> <div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div> <div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
(click)="next()"> 下一步 </div>
</div> </div>
</div> </div>
</div> </div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service'; import {CommonService} from '../common.service';
import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-disease', selector: 'app-disease',
...@@ -8,19 +9,94 @@ import {CommonService} from '../common.service'; ...@@ -8,19 +9,94 @@ import {CommonService} from '../common.service';
}) })
export class DiseaseComponent implements OnInit { export class DiseaseComponent implements OnInit {
curPageData:Array<any>; curPageData:Array<any>;
type:any;
pageAnswers:any;
nextBtn:boolean;
options:Array<any>;
selectedOptionId:any;
constructor( constructor(
private commonService: CommonService private commonService: CommonService,
) { } private router: Router,
private route: ActivatedRoute
) {
this.type = this.route.snapshot.queryParams['type'];
this.pageAnswers = {
pageId: '',
questions: [{
questionId: '',
questionName: '',
options: [{optionId: '', optionName: '', optionOrder: '', selected: ''}]
}],
};
}
ngOnInit() { ngOnInit() {
this.nextBtn = false;
this.surveyInfo() this.surveyInfo()
} }
surveyInfo() { surveyInfo() {
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
if (res['success']) { if (res['success']) {
this.curPageData = res['data']['survey'].pages['13'] this.curPageData = res['data']['survey'].pages['13']
console.log(this.curPageData) /**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
//过滤选项
if(this.type == 1){
this.options = this.curPageData['questions']['0']['options']
this.options = this.options.filter(option=>{
return option.optionId == 106 || option.optionId == 107
})
}
if(this.type == 2){
this.options = this.curPageData['questions']['0']['options']
this.options = this.options.filter(option=>{
return option.optionId == 108 || option.optionId == 109 || option.optionId == 111
})
}
if(this.type == 3){
this.options = this.curPageData['questions']['0']['options']
this.options = this.options.filter(option=>{
return option.optionId == 108 || option.optionId == 110 || option.optionId == 111
})
}
if(this.type == 4){
this.options = this.curPageData['questions']['0']['options']
this.options = this.options.filter(option=>{
return option.optionId == 108 || option.optionId == 109 || option.optionId == 110 || option.optionId == 111
})
}
} }
}) })
} }
getAnswer(option){
// console.log(options)
this.selectedOptionId = option.optionId;
this.pageAnswers = {
pageId : this.curPageData['pageId'],
questions:[{
questionId: this.curPageData['questions']['0']['questionId'],
questionName: this.curPageData['questions']['0']['questionName'],
options:[option]
}]
}
this.commonService.addAnswer(this.pageAnswers)
console.log(this.pageAnswers)
if(this.pageAnswers['questions'].length>0){
this.nextBtn = true
}else{
this.nextBtn = false
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/smoke'],{queryParams:{type:this.type}})
}
}
} }
...@@ -14,6 +14,7 @@ export class IncomeComponent implements OnInit { ...@@ -14,6 +14,7 @@ export class IncomeComponent implements OnInit {
// 家庭结构 // 家庭结构
type: any; type: any;
selectedOptionId: any; selectedOptionId: any;
nextBtn:boolean;
constructor( constructor(
private commonService: CommonService, private commonService: CommonService,
private router: Router, private router: Router,
...@@ -35,13 +36,13 @@ export class IncomeComponent implements OnInit { ...@@ -35,13 +36,13 @@ export class IncomeComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.surveyInfo() this.surveyInfo()
this.hasMate = true;
//判断家庭决定是否显示配偶 //判断家庭决定是否显示配偶
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() { surveyInfo() {
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
...@@ -49,7 +50,6 @@ export class IncomeComponent implements OnInit { ...@@ -49,7 +50,6 @@ 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'];
} }
}) })
} }
...@@ -57,7 +57,6 @@ export class IncomeComponent implements OnInit { ...@@ -57,7 +57,6 @@ export class IncomeComponent implements OnInit {
selectedIncome(question,option){ selectedIncome(question,option){
this.selectedOptionId = option.optionId; this.selectedOptionId = option.optionId;
option.selected = true; option.selected = true;
const questions = { const questions = {
questionId: question.questionId, questionId: question.questionId,
questionName: question.questionName, questionName: question.questionName,
...@@ -71,9 +70,29 @@ export class IncomeComponent implements OnInit { ...@@ -71,9 +70,29 @@ export class IncomeComponent implements OnInit {
} }
this.pageAnswers.questions.push(questions); this.pageAnswers.questions.push(questions);
this.commonService.addAnswer(this.pageAnswers); this.commonService.addAnswer(this.pageAnswers);
console.log(question) console.log(questions)
console.log(option)
console.log(this.pageAnswers) console.log(this.pageAnswers)
//判断页面需要几个问题
if(this.type==2 || this.type == 4){
if(this.curPageData['questions'].length == this.pageAnswers['questions'].length){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}else{
if(this.pageAnswers['questions'].length>0){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}
} }
next(){
if(this.nextBtn == true){
this.router.navigate(['/loan'],{queryParams:{type:this.type}})
}else{
return;
}
}
} }
...@@ -12,6 +12,7 @@ export class JobComponent implements OnInit { ...@@ -12,6 +12,7 @@ export class JobComponent implements OnInit {
selectedOptionId: any; selectedOptionId: any;
type: any; type: any;
id:any; id:any;
nextBtn:boolean;
constructor(private commonService: CommonService, constructor(private commonService: CommonService,
private router: Router, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
...@@ -41,12 +42,14 @@ export class JobComponent implements OnInit { ...@@ -41,12 +42,14 @@ export class JobComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.nextBtn = false;
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
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'];
}else{ }else{
this.curPageData = res['data'].survey.pages['4']; this.curPageData = res['data'].survey.pages['4'];
} }
console.log(this.curPageData) console.log(this.curPageData)
} }
...@@ -68,20 +71,31 @@ export class JobComponent implements OnInit { ...@@ -68,20 +71,31 @@ export class JobComponent implements OnInit {
this.commonService.addAnswer(this.pageAnswers); this.commonService.addAnswer(this.pageAnswers);
console.log(this.pageAnswers) console.log(this.pageAnswers)
console.log(this.commonService.todos) console.log(this.commonService.todos)
if(this.pageAnswers['questions'].length>0){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
} }
// 下一步 // 下一步
next() { next() {
//先判断下一步能不能点
//如果是二人世界或是多口之家跳转到配偶页 //如果是二人世界或是多口之家跳转到配偶页
//先判断当前页是您的页还是配偶页 //先判断当前页是您的页还是配偶页
if(this.id == 1){ if(this.nextBtn ==true){
if(this.type ==2 || this.type==4){ if(this.id == 1){
this.router.navigate(['/spouse_job'],{queryParams:{type:this.type}}) 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{ }else{
this.router.navigate(['/transit1'],{queryParams:{type:this.type}}) this.router.navigate(['/transit1'],{queryParams:{type:this.type}})
} }
}else{ }else{
this.router.navigate(['/transit1'],{queryParams:{type:this.type}}) return;
} }
} }
} }
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<li <li
[ngClass]="{ selected: options['selected'] == true }" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData?.questions[0]['options']" *ngFor="let options of this.curPageData?.questions[0]['options']"
> (click)="selectedLoan(this.curPageData?.questions[0],options)"
>
{{ options.optionName }} {{ options.optionName }}
</li> </li>
</ul> </ul>
...@@ -19,14 +20,17 @@ ...@@ -19,14 +20,17 @@
<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']"
> (click)="selectedLoan(this.curPageData?.questions[1],options)"
>
{{ options.optionName }} {{ options.optionName }}
</li> </li>
</ul> </ul>
</div> </div>
<div class="content_footer"> <div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div> <div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div> <div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
(click)="next()"
> 下一步 </div>
</div> </div>
</div> </div>
</div> </div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service'; import {CommonService} from '../common.service';
import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-loan', selector: 'app-loan',
...@@ -8,19 +9,74 @@ import {CommonService} from '../common.service'; ...@@ -8,19 +9,74 @@ import {CommonService} from '../common.service';
}) })
export class LoanComponent implements OnInit { export class LoanComponent implements OnInit {
curPageData:Array<any>; curPageData:Array<any>;
hasMate:boolean; //家庭结构
constructor(private commonService: CommonService) { } type:any;
pageAnswers: any;
selectedOptionId: any;
nextBtn:boolean;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute
) {
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
this.type = this.route.snapshot.queryParams['type'];
this.pageAnswers = {
pageId: '',
questions: [],
};
}
ngOnInit() { ngOnInit() {
this.nextBtn = false;
this.surveyInfo() this.surveyInfo()
this.hasMate = true;
} }
surveyInfo() { surveyInfo() {
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
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'];
console.log(this.curPageData) console.log(this.curPageData)
} }
}) })
} }
selectedLoan(question,option){
this.selectedOptionId = option.optionId;
option.selected = true;
const questions = {
questionId: question.questionId,
questionName: question.questionName,
options: [option]
};
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]);
this.pageAnswers.questions.splice(index, 1);
}
}
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){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/social'],{queryParams:{type:this.type}})
}else{
return
}
}
} }
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
<li <li
[ngClass]="{ selected: options['selected'] == true }" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData?.questions[0]['options']" *ngFor="let options of this.curPageData?.questions[0]['options']"
> (click)=selectedSocial(this.curPageData?.questions[0],options)
>
{{ options.optionName }} {{ options.optionName }}
</li> </li>
</ul> </ul>
...@@ -19,14 +20,17 @@ ...@@ -19,14 +20,17 @@
<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']"
> (click)=selectedSocial(this.curPageData?.questions[1],options)
>
{{ options.optionName }} {{ options.optionName }}
</li> </li>
</ul> </ul>
</div> </div>
<div class="content_footer"> <div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div> <div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div> <div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
(click)="next()"
> 下一步 </div>
</div> </div>
</div> </div>
</div> </div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service'; import {CommonService} from '../common.service';
import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-social-security', selector: 'app-social-security',
...@@ -9,11 +10,37 @@ import {CommonService} from '../common.service'; ...@@ -9,11 +10,37 @@ import {CommonService} from '../common.service';
export class SocialSecurityComponent implements OnInit { export class SocialSecurityComponent implements OnInit {
curPageData:Array<any>; curPageData:Array<any>;
hasMate:boolean; hasMate:boolean;
constructor(private commonService: CommonService) { } //家庭结构
type:any;
nextBtn:boolean;
pageAnswers: any;
selectedOptionId: any;
constructor(private commonService: CommonService,
private router: Router,
private route: ActivatedRoute) {
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
this.type = this.route.snapshot.queryParams['type'];
this.pageAnswers = {
pageId: '',
questions: [],
};
}
ngOnInit() { ngOnInit() {
this.surveyInfo() this.surveyInfo()
this.hasMate = true; //判断家庭决定是否显示配偶
if(this.type==2 || this.type == 4){
this.hasMate = true;
}else{
this.hasMate = false;
}
this.nextBtn = false;
} }
surveyInfo() { surveyInfo() {
this.commonService.surveyInfo().then(res => { this.commonService.surveyInfo().then(res => {
...@@ -23,4 +50,44 @@ export class SocialSecurityComponent implements OnInit { ...@@ -23,4 +50,44 @@ export class SocialSecurityComponent implements OnInit {
} }
}) })
} }
selectedSocial(question,option){
this.selectedOptionId = option.optionId;
option.selected = true;
const questions = {
questionId: question.questionId,
questionName: question.questionName,
options: [option]
};
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]);
this.pageAnswers.questions.splice(index, 1);
}
}
this.pageAnswers.questions.push(questions);
this.commonService.addAnswer(this.pageAnswers);
//判断页面需要几个问题
if(this.type==2 || this.type == 4){
if(this.curPageData['questions'].length == this.pageAnswers['questions'].length){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}else{
if(this.pageAnswers['questions'].length>0){
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}
}
next(){
if(this.nextBtn == true){
this.router.navigate(['/transit2'],{queryParams:{type:this.type}})
}else{
return;
}
}
} }
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
</div> </div>
<div class="content_footer"> <div class="content_footer">
<div style="color: #8a8a8a;">&lt;</div> <div style="color: #8a8a8a;">&lt;</div>
<div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"> 下一步 </div> <div [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
(click)="next()"
> 下一步 </div>
</div> </div>
</div> </div>
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-transit2', selector: 'app-transit2',
...@@ -6,10 +7,18 @@ import { Component, OnInit } from '@angular/core'; ...@@ -6,10 +7,18 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./transit2.component.css'] styleUrls: ['./transit2.component.css']
}) })
export class Transit2Component implements OnInit { export class Transit2Component implements OnInit {
//家庭结构
constructor() { } type:any;
constructor(
private router: Router,
private route: ActivatedRoute) {
this.type = this.route.snapshot.queryParams['type'];
}
ngOnInit() { ngOnInit() {
} }
next(){
this.router.navigate(['/health'],{queryParams:{type:this.type}})
}
} }
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