Commit 389ae329 by Sweet Zhang

Merge branch 'master' of 139.224.139.2:Sweet/allCampaign

parents d1ebd87f aa5efb33
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<title>獴哥保险工作室</title> <title>獴哥保险诊所</title>
<link rel="stylesheet" href="./css/style.css" /> <link rel="stylesheet" href="./css/style.css" />
</head> </head>
<body> <body>
......
$(function () { $(function () {
// var api = 'https://' + window.location.host; // var api = 'https://' + window.location.host;
var api = 'https://m.zuihuibi.cn'; var api = 'https://mdev.zuihuibi.cn';
var gitUrlParam = window.location.search; var gitUrlParam = window.location.search;
const param = { const param = {
phone: '', phone: '',
...@@ -348,7 +348,7 @@ $(function () { ...@@ -348,7 +348,7 @@ $(function () {
const shareData = { const shareData = {
title: '1对1家庭风险管理服务', title: '1对1家庭风险管理服务',
link: window.location.href, link: window.location.href,
desc: '产品太多、条款复杂、买哪个好,理不理赔? 獴哥保险工作室来帮您解决,提供1对1风险分析和保险方案定制。', desc: '产品太多、条款复杂、买哪个好,理不理赔? 獴哥保险诊所来帮您解决,提供1对1风险分析和保险方案定制。',
imgUrl: 'https://ajb-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/images/menggo_head.png' imgUrl: 'https://ajb-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/images/menggo_head.png'
}; };
wx.ready(function () { wx.ready(function () {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0"> <meta http-equiv="Expires" content="0">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<title>獴哥保险工作室</title> <title>獴哥保险诊所</title>
<link rel="stylesheet" href="./css/style.css" /> <link rel="stylesheet" href="./css/style.css" />
</head> </head>
<body> <body>
......
$(function () { $(function () {
// var api = 'https://' + window.location.host; // var api = 'https://' + window.location.host;
var api = 'https://m.zuihuibi.cn'; var api = 'https://mdev.zuihuibi.cn';
var gitUrlParam = window.location.search; var gitUrlParam = window.location.search;
const param = { const param = {
phone: '', phone: '',
...@@ -347,7 +347,7 @@ $(function () { ...@@ -347,7 +347,7 @@ $(function () {
const shareData = { const shareData = {
title: '1对1家庭风险管理服务', title: '1对1家庭风险管理服务',
link: window.location.href, link: window.location.href,
desc: '产品太多、条款复杂、买哪个好,理不理赔? 獴哥保险工作室来帮您解决,提供1对1风险分析和保险方案定制。', desc: '产品太多、条款复杂、买哪个好,理不理赔? 獴哥保险诊所来帮您解决,提供1对1风险分析和保险方案定制。',
imgUrl: 'https://ajb-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/images/menggo_head.png' imgUrl: 'https://ajb-images.oss-cn-shanghai-finance-1-pub.aliyuncs.com/images/menggo_head.png'
}; };
wx.ready(function () { wx.ready(function () {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"outputPath": "dist/questionnair", "outputPath": "dist/questionnaire",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
"src/styles.css" "src/styles.css"
], ],
"scripts": [], "scripts": [],
"es5BrowserSupport": true "es5BrowserSupport": true,
"baseHref": "/questionnaire/",
"deployUrl": "/questionnaire/"
}, },
"configurations": { "configurations": {
"production": { "production": {
......
...@@ -24,6 +24,7 @@ import { Page15Component } from './page15/page15.component' ...@@ -24,6 +24,7 @@ import { Page15Component } from './page15/page15.component'
import { Page16Component } from './page16/page16.component' import { Page16Component } from './page16/page16.component'
import { Page17Component } from './page17/page17.component' import { Page17Component } from './page17/page17.component'
import {HashLocationStrategy, LocationStrategy} from '@angular/common';
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
...@@ -47,7 +48,7 @@ import { Page17Component } from './page17/page17.component' ...@@ -47,7 +48,7 @@ import { Page17Component } from './page17/page17.component'
Page17Component Page17Component
], ],
imports: [BrowserModule, AppRoutingModule, HttpClientModule], imports: [BrowserModule, AppRoutingModule, HttpClientModule],
providers: [CommonService, LocalStorage], providers: [CommonService, LocalStorage,{provide: LocationStrategy, useClass: HashLocationStrategy}],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule {} export class AppModule {}
...@@ -63,15 +63,27 @@ ...@@ -63,15 +63,27 @@
*ngIf="curPage == 13" *ngIf="curPage == 13"
(getAllAnswer)="getAllAnswer($event)" (getAllAnswer)="getAllAnswer($event)"
></app-page14> ></app-page14>
<app-page15 [curPageData]="curPageData" *ngIf="curPage == 14"></app-page15> <app-page15
<app-page16 [curPageData]="curPageData" *ngIf="curPage == 15"></app-page16> [curPageData]="curPageData"
*ngIf="curPage == 14"
(getAllAnswer)="getAllAnswer($event)"
></app-page15>
<app-page16
[curPageData]="curPageData"
*ngIf="curPage == 15"
(getAllAnswer)="getAllAnswer($event)"
[provinceList] = "provinceList"
></app-page16>
<app-page17 [curPageData]="curPageData" *ngIf="curPage == 16"></app-page17> <app-page17 [curPageData]="curPageData" *ngIf="curPage == 16"></app-page17>
<div class="footer" *ngIf="curPage == 0" (click)="addPage()"> <div class="footer" *ngIf="curPage == 0" (click)="addPage()">
<div>获取家庭分析报告</div> <div>获取家庭分析报告</div>
</div> </div>
<div class="content_footer" *ngIf="curPage != 0"> <div class="content_footer" *ngIf="curPage != 0 && curPage!=16">
<div (click)="reducePage()">&lt;</div> <div (click)="reducePage()">&lt;</div>
<div (click)="addPage()" class="next">下一步</div> <div
(click)="addPage()"
[ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
>下一步</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -15,6 +15,9 @@ export class AskComponent implements OnInit { ...@@ -15,6 +15,9 @@ export class AskComponent implements OnInit {
allAnswers: Array<any> allAnswers: Array<any>
isShowChildAgeBtn: boolean isShowChildAgeBtn: boolean
hasMate: boolean hasMate: boolean
//获取省份
provinceList: Array<any>
nextBtn:boolean;
constructor(private commonService: CommonService) {} constructor(private commonService: CommonService) {}
ngOnInit() { ngOnInit() {
...@@ -34,18 +37,61 @@ export class AskComponent implements OnInit { ...@@ -34,18 +37,61 @@ export class AskComponent implements OnInit {
this.curPageData = this.allQues[this.curPage] this.curPageData = this.allQues[this.curPage]
} }
}) })
this.commonService.provinceqry({ insurerId: 11 }).subscribe(res => {
if (res['success']) {
this.provinceList = res['data'].provinceList
}
})
} }
reducePage() { reducePage() {
// console.log('start', this.curPage)
if (this.curPage > 0) { if (this.curPage > 0) {
this.curPage-- const page2Answer = this.allAnswers[1]
const optionId = page2Answer.questions[0].options[0].optionId
if (this.curPage == 5 || this.curPage == 6) {
if (optionId == 1 || optionId == 3) {
this.curPage = this.curPage - 2
this.setCurPageData()
return
}
}
if (this.curPage == 13) {
if (optionId == 1) {
this.curPage = this.curPage - 3
this.setCurPageData()
return
}
if (optionId == 2) {
this.curPage = this.curPage - 2
this.setCurPageData()
return
}
}
if (this.curPage == 12) {
if (optionId == 3) {
this.curPage = this.curPage - 2
this.setCurPageData()
return
}
}
this.curPage--;
this.setCurPageData() this.setCurPageData()
} else { } else {
return return
} }
} }
filterItems() {
return this.allAnswers.filter(item => {
return item != null
})
}
addPage() { addPage() {
if(this.nextBtn===false){
return;
}
if (this.curPage < 16) { if (this.curPage < 16) {
//判断当前页是否有答案
if ( if (
this.curPage == 0 || this.curPage == 0 ||
this.allAnswers[this.curPage] || this.allAnswers[this.curPage] ||
...@@ -59,15 +105,42 @@ export class AskComponent implements OnInit { ...@@ -59,15 +105,42 @@ export class AskComponent implements OnInit {
this.curPage = 0 this.curPage = 0
return return
} }
console.log(this.curPage)
const answerParam = {
survey: {
customerId: this.commonService.getQueryString('customerId'),
orderId: this.commonService.getQueryString('orderId'),
pages: this.filterItems()
}
}
if (this.curPage == 16) {
this.commonService.saveCustomerAnwers(answerParam).then(res => {
// console.log(res)
})
}
} }
getAllAnswer(e) { getAllAnswer(e) {
this.allAnswers[this.curPage] = e this.allAnswers[this.curPage] = e
console.log(this.allAnswers) // console.log(this.allAnswers);
if (this.curPage < 16) {
//判断当前页是否有答案
if (
this.curPage == 0 ||
this.allAnswers[this.curPage] ||
this.curPage == 5 ||
this.curPage == 9
) {
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}
} }
setCurPageData() { setCurPageData() {
// console.log(this.allAnswers)
const thePateData = this.allQues[this.curPage] const thePateData = this.allQues[this.curPage]
console.log('thePateData------', this.curPage, thePateData)
this.curPageData = thePateData this.curPageData = thePateData
const page2Answer = this.allAnswers[1] const page2Answer = this.allAnswers[1]
if (this.curPage == 2) { if (this.curPage == 2) {
...@@ -76,6 +149,7 @@ export class AskComponent implements OnInit { ...@@ -76,6 +149,7 @@ export class AskComponent implements OnInit {
thePateData thePateData
) )
} }
//第4页
if (this.curPage == 4) { if (this.curPage == 4) {
this.filterPage5( this.filterPage5(
page2Answer.questions[0].options[0].optionId, page2Answer.questions[0].options[0].optionId,
...@@ -94,14 +168,32 @@ export class AskComponent implements OnInit { ...@@ -94,14 +168,32 @@ export class AskComponent implements OnInit {
thePateData thePateData
) )
} }
console.log('page start', this.curPage)
if (this.curPage == 13) { if (this.curPage == 13) {
console.log('page end', this.curPage)
this.filterPage14( this.filterPage14(
page2Answer.questions[0].options[0].optionId, page2Answer.questions[0].options[0].optionId,
this.allQues[this.curPage] this.allQues[this.curPage]
) )
} }
if (this.curPage == 14) {
this.filterPage15(
page2Answer.questions[0].options[0].optionId,
this.allQues[this.curPage]
)
}
if (this.curPage < 16) {
//判断当前页是否有答案
if (
this.curPage == 0 ||
this.allAnswers[this.curPage] ||
this.curPage == 5 ||
this.curPage == 9
) {
this.nextBtn = true;
}else{
this.nextBtn = false;
}
}
// console.log('thePateData------', this.curPage, thePateData)
} }
filterPage2(optionId, thePateData) { filterPage2(optionId, thePateData) {
...@@ -153,7 +245,7 @@ export class AskComponent implements OnInit { ...@@ -153,7 +245,7 @@ export class AskComponent implements OnInit {
//1单身 3单亲 //1单身 3单亲
if (optionId == 1 || optionId == 3) { if (optionId == 1 || optionId == 3) {
this.curPage++ this.curPage++
console.log('page5', this.curPage, this.curPageData) // console.log('page5', this.curPage, this.curPageData)
this.curPageData = this.allQues[this.curPage] this.curPageData = this.allQues[this.curPage]
} }
} }
...@@ -174,15 +266,17 @@ export class AskComponent implements OnInit { ...@@ -174,15 +266,17 @@ export class AskComponent implements OnInit {
} }
} }
//page14判断option内容 //page14判断是否住院option内容
filterPage14(optionId, thePateData) { filterPage14(optionId, thePateData) {
//如果单身或者单亲选择相中没有配偶选项 //如果单身或者单亲选择相中没有配偶选项
//传一个optionType告诉子页面是单选还是多选1表示单选2表示多选
if (optionId == 1) { if (optionId == 1) {
this.curPageData = { this.curPageData = {
...thePateData, ...thePateData,
questions: [ questions: [
{ {
...thePateData.questions[0], ...thePateData.questions[0],
optionType: 1,
options: thePateData.questions[0]['options'].filter(option => { options: thePateData.questions[0]['options'].filter(option => {
return option.optionId == 106 || option.optionId == 107 return option.optionId == 106 || option.optionId == 107
}) })
...@@ -196,6 +290,7 @@ export class AskComponent implements OnInit { ...@@ -196,6 +290,7 @@ export class AskComponent implements OnInit {
questions: [ questions: [
{ {
...thePateData.questions[0], ...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => { options: thePateData.questions[0]['options'].filter(option => {
return ( return (
option.optionId == 108 || option.optionId == 108 ||
...@@ -213,6 +308,7 @@ export class AskComponent implements OnInit { ...@@ -213,6 +308,7 @@ export class AskComponent implements OnInit {
questions: [ questions: [
{ {
...thePateData.questions[0], ...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => { options: thePateData.questions[0]['options'].filter(option => {
return ( return (
option.optionId == 108 || option.optionId == 108 ||
...@@ -230,6 +326,7 @@ export class AskComponent implements OnInit { ...@@ -230,6 +326,7 @@ export class AskComponent implements OnInit {
questions: [ questions: [
{ {
...thePateData.questions[0], ...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => { options: thePateData.questions[0]['options'].filter(option => {
return ( return (
option.optionId == 108 || option.optionId == 108 ||
...@@ -243,4 +340,79 @@ export class AskComponent implements OnInit { ...@@ -243,4 +340,79 @@ export class AskComponent implements OnInit {
} }
} }
} }
//判断是否吸烟option内容
filterPage15(optionId, thePateData) {
//如果单身或者单亲选择相中没有配偶选项
//传一个optionType告诉子页面是单选还是多选1表示单选2表示多选
if (optionId == 1) {
this.curPageData = {
...thePateData,
questions: [
{
...thePateData.questions[0],
optionType: 1,
options: thePateData.questions[0]['options'].filter(option => {
return option.optionId == 112 || option.optionId == 113
})
}
]
}
}
if (optionId == 2) {
this.curPageData = {
...thePateData,
questions: [
{
...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => {
return (
option.optionId == 114 ||
option.optionId == 115 ||
option.optionId == 117
)
})
}
]
}
}
if (optionId == 3) {
this.curPageData = {
...thePateData,
questions: [
{
...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => {
return (
option.optionId == 114 ||
option.optionId == 116 ||
option.optionId == 117
)
})
}
]
}
}
if (optionId == 4) {
this.curPageData = {
...thePateData,
questions: [
{
...thePateData.questions[0],
optionType: 2,
options: thePateData.questions[0]['options'].filter(option => {
return (
option.optionId == 114 ||
option.optionId == 115 ||
option.optionId == 116 ||
option.optionId == 117
)
})
}
]
}
}
}
} }
...@@ -31,6 +31,15 @@ export class CommonService { ...@@ -31,6 +31,15 @@ export class CommonService {
}); });
} }
async saveCustomerAnwers(objParam){
const url = this.USER_API_URL + '/survey/saveCustomerAnwers';
const res = await this.obtainToken();
this.httpOptions.headers = this.httpOptions.headers.set('X-Authorization', res['data']['token']);
return this.http
.post(url, JSON.stringify(objParam),this.httpOptions).toPromise().then(response => {
return response;
});
}
// async getAllInfo(){ // async getAllInfo(){
// const res = await this.surveyInfo() // const res = await this.surveyInfo()
// if(res['success']){ // if(res['success']){
...@@ -64,4 +73,17 @@ export class CommonService { ...@@ -64,4 +73,17 @@ export class CommonService {
return res; return res;
}) })
} }
getQueryString(name) {
const after = window.location.hash.split('?')[1];
if (after) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = after.match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
} else {
return null;
}
}
}
} }
...@@ -15,30 +15,49 @@ export class Page11Component implements OnInit { ...@@ -15,30 +15,49 @@ export class Page11Component implements OnInit {
ngOnInit() { ngOnInit() {
// this.allOption = {} // this.allOption = {}
this.allOptions = [] this.allOptions = []
console.log(this.curPageData) // console.log(this.curPageData)
this.getAlloptions()
} }
getAnswer(options) { getAnswer(options) {
console.log(options)
options['selected'] = !options['selected'] options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
if (options['optionId'] == this.allOptions[i]['optionId']) { if (options['optionId'] == this.allOptions[i]['optionId']) {
let index = this.allOptions.indexOf(this.allOptions[i]) let index = this.allOptions.indexOf(this.allOptions[i])
if (index > -1) { if (index > -1) {
this.allOptions.splice(index, 1) this.allOptions.splice(index, 1)
} }
} }
} }
this.allOptions.push(options) this.allOptions.push(options)
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
if (!this.allOptions[i]['selected']) { let index;
let index = this.allOptions.indexOf(this.allOptions[i]) // 当选中无疾病时
if (index > -1) { if(options['optionId']==67 && options['selected']==true){
this.allOptions.splice(index, 1) index = this.allOptions.indexOf(options);
} this.allOptions[i]['selected'] = false;
} if(index > -1){
this.allOptions[index]['selected'] = true;
}
}else{
// 选中其他疾病时,无疾病状态改为false
if(this.allOptions[i]['optionId']==67){
this.allOptions[i]['selected'] = false;
}
}
} }
console.log(this.allOptions) // console.log(this.allOptions)
// 删掉未选中的疾病
// for (let i = 0; i < this.allOptions.length; i++){
// if (!this.allOptions[i]['selected']) {
// let index = this.allOptions.indexOf(this.allOptions[i])
// if (index > -1) {
// this.allOptions.splice(index, 1)
// }
// }
// }
// if (!this.allOption[options['optionId']]) { // if (!this.allOption[options['optionId']]) {
// this.allOption[options['optionId']] = {} // this.allOption[options['optionId']] = {}
// } // }
...@@ -56,15 +75,41 @@ export class Page11Component implements OnInit { ...@@ -56,15 +75,41 @@ export class Page11Component implements OnInit {
// options: this.allOption[questionId] // options: this.allOption[questionId]
// } // }
// }) // })
// const result = this.allOptions.filter(item=>{
// item.selected==true
// })
// console.log(result)
const ret = { const ret = {
// ...this.curPageData,
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
options: this.allOptions options: this.filterItems()
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
filterItems() {
return this.allOptions.filter(item=> {
return item['selected']==true;
})
}
getAlloptions(){
// const questions = this.curPageData['questions']
// if(!questions){
// return
// }
// questions[0]['options'].forEach(option => {
// if(option['selected']){
// // this.allOptions[questions] = option
// console.log(this.allOptions)
// }
// });
}
} }
...@@ -13,37 +13,52 @@ export class Page12Component implements OnInit { ...@@ -13,37 +13,52 @@ export class Page12Component implements OnInit {
ngOnInit() { ngOnInit() {
this.allOptions = [] this.allOptions = []
console.log(this.curPageData)
} }
getAnswer(options) { getAnswer(options) {
options['selected'] = !options['selected'] options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
if (options['optionId'] == this.allOptions[i]['optionId']) { if (options['optionId'] == this.allOptions[i]['optionId']) {
let index = this.allOptions.indexOf(this.allOptions[i]) let index = this.allOptions.indexOf(this.allOptions[i])
if (index > -1) { if (index > -1) {
this.allOptions.splice(index, 1) this.allOptions.splice(index, 1)
} }
} }
} }
this.allOptions.push(options) this.allOptions.push(options)
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
if (!this.allOptions[i]['selected']) { let index;
let index = this.allOptions.indexOf(this.allOptions[i]) // 当选中无疾病时
if (index > -1) { if(options['optionId']==83 && options['selected']==true){
this.allOptions.splice(index, 1) index = this.allOptions.indexOf(options);
} this.allOptions[i]['selected'] = false;
} if(index > -1){
this.allOptions[index]['selected'] = true;
}
}else{
// 选中其他疾病时,无疾病状态改为false
if(this.allOptions[i]['optionId']==83){
this.allOptions[i]['selected'] = false;
}
}
} }
console.log(this.allOptions)
const ret = { const ret = {
// ...this.curPageData,
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
options: this.allOptions options: this.filterItems()
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
filterItems() {
return this.allOptions.filter(item=> {
return item['selected']==true;
})
}
} }
...@@ -12,37 +12,51 @@ export class Page13Component implements OnInit { ...@@ -12,37 +12,51 @@ export class Page13Component implements OnInit {
ngOnInit() { ngOnInit() {
this.allOptions = [] this.allOptions = []
console.log(this.curPageData)
} }
getAnswer(options) { getAnswer(options) {
options['selected'] = !options['selected'] options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
if (options['optionId'] == this.allOptions[i]['optionId']) { if (options['optionId'] == this.allOptions[i]['optionId']) {
let index = this.allOptions.indexOf(this.allOptions[i]) let index = this.allOptions.indexOf(this.allOptions[i])
if (index > -1) { if (index > -1) {
this.allOptions.splice(index, 1) this.allOptions.splice(index, 1)
} }
} }
} }
this.allOptions.push(options) this.allOptions.push(options)
for (let i = 0; i < this.allOptions.length; i++) { for (let i = 0; i < this.allOptions.length; i++) {
if (!this.allOptions[i]['selected']) { let index;
let index = this.allOptions.indexOf(this.allOptions[i]) // 当选中无疾病时
if (index > -1) { if(options['optionId']==99 && options['selected']==true){
this.allOptions.splice(index, 1) index = this.allOptions.indexOf(options);
} this.allOptions[i]['selected'] = false;
} if(index > -1){
this.allOptions[index]['selected'] = true;
}
}else{
// 选中其他疾病时,无疾病状态改为false
if(this.allOptions[i]['optionId']==99){
this.allOptions[i]['selected'] = false;
}
}
} }
console.log(this.allOptions)
const ret = { const ret = {
// ...this.curPageData,
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
options: this.allOptions options: this.filterItems()
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
filterItems() {
return this.allOptions.filter(item=> {
return item['selected']==true;
})
}
} }
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
</div> </div>
<ul class="jobContent"> <ul class="jobContent">
<li <li
class="selected"
*ngFor="let options of this.curPageData['questions'][0]['options']" *ngFor="let options of this.curPageData['questions'][0]['options']"
(click)="getAnswer(options)" [ngClass]="{ selected: options['selected'] == true }"
(click)="checkFun(options)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -8,22 +8,118 @@ import { Component, OnInit ,Input, Output, EventEmitter} from '@angular/core'; ...@@ -8,22 +8,118 @@ import { Component, OnInit ,Input, Output, EventEmitter} from '@angular/core';
export class Page14Component implements OnInit { export class Page14Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
selectedObj:Object;
allOptions: Array<any>
optionType:number
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
console.log(this.curPageData) // console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this.optionType = this.curPageData['questions'][0].optionType
// console.log(this.optionType)
if(this.optionType==1){
this.selectedObj = {}
this.setOptionSelected()
}
if(this.optionType==2){
this.allOptions = []
}
} }
getAnswer(option) { getManyAnswer(options) {
options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
if (options['optionId'] == this.allOptions[i]['optionId']) {
let index = this.allOptions.indexOf(this.allOptions[i])
if (index > -1) {
this.allOptions.splice(index, 1)
}
}
}
this.allOptions.push(options)
for (let i = 0; i < this.allOptions.length; i++) {
let index;
// 当选中无疾病时
if(options['optionId']==111 && options['selected']==true){
index = this.allOptions.indexOf(options);
this.allOptions[i]['selected'] = false;
if(index > -1){
this.allOptions[index]['selected'] = true;
}
}else{
// 选中其他疾病时,无疾病状态改为false
if(this.allOptions[i]['optionId']==111){
this.allOptions[i]['selected'] = false;
}
}
}
const ret = { const ret = {
// ...this.curPageData,
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
option: [option] options: this.filterItems()
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
filterItems() {
return this.allOptions.filter(item=> {
return item['selected']==true;
})
}
//单选调用的方法
getAnswer(options) {
if(!this.selectedObj['selected']){
this.selectedObj = options
options['selected'] = true;
}else{
if(this.selectedObj['optionId']!=options.optionId){
this.selectedObj['selected'] = false;
options['selected'] = true;
this.selectedObj = options
}
}
const ret = {
pageId: this.curPageData['pageId'],
questions: [
{
questionId: this.curPageData['questions'][0].questionId,
options: [options]
}
]
}
this.getAllAnswer.emit(ret)
}
setOptionSelected() {
const options = this.curPageData['questions'][0].options
if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option
}
})
}
//判断用哪个方法
checkFun(options){
if(this.optionType==1){
this.getAnswer(options)
}
if(this.optionType==2){
this.getManyAnswer(options)
}
}
} }
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<div class="layout"> <div class="layout">
<div class="content"> <div class="content">
<div class="questionTitle smokeTitle"> <div class="questionTitle smokeTitle">
{{ this.curPageData['questions'][0]['questionName'] }} {{ this.curPageData['pageName'] }}
</div> </div>
<ul class="jobContent"> <ul class="jobContent">
<li <li
class="selected"
*ngFor="let options of this.curPageData['questions'][0]['options']" *ngFor="let options of this.curPageData['questions'][0]['options']"
(click)="getAnswer(options)" [ngClass]="{ selected: options['selected'] == true }"
(click)="checkFun(options)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -10,22 +10,119 @@ export class Page15Component implements OnInit { ...@@ -10,22 +10,119 @@ export class Page15Component implements OnInit {
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
curQues: Object curQues: Object
curAllQues: Object curAllQues: Object
optionType:number
selectedObj:Object;
allOptions: Array<any>
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
console.log(this.curPageData) // console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this.optionType = this.curPageData['questions'][0].optionType
// console.log(this.optionType)
if(this.optionType==1){
this.selectedObj = {}
this.setOptionSelected()
}
if(this.optionType==2){
this.allOptions = []
}
}
getManyAnswer(options) {
// console.log(options)
options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
if (options['optionId'] == this.allOptions[i]['optionId']) {
let index = this.allOptions.indexOf(this.allOptions[i])
if (index > -1) {
this.allOptions.splice(index, 1)
}
}
}
this.allOptions.push(options)
for (let i = 0; i < this.allOptions.length; i++) {
let index;
// 当选中无疾病时
if(options['optionId']==117 && options['selected']==true){
index = this.allOptions.indexOf(options);
this.allOptions[i]['selected'] = false;
if(index > -1){
this.allOptions[index]['selected'] = true;
}
}else{
// 选中其他疾病时,无疾病状态改为false
if(this.allOptions[i]['optionId']==117){
this.allOptions[i]['selected'] = false;
}
}
}
const ret = {
// ...this.curPageData,
pageId: this.curPageData['pageId'],
questions: [
{
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId,
options: this.filterItems()
}
]
}
this.getAllAnswer.emit(ret)
} }
getAnswer(option){ filterItems() {
const questionId = this.curQues['questionId'] return this.allOptions.filter(item=> {
this.curAllQues[questionId] = option return item['selected']==true;
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] }
}) })
}
//单选调用的方法
getAnswer(options) {
if(!this.selectedObj['selected']){
this.selectedObj = options
options['selected'] = true;
}else{
if(this.selectedObj['optionId']!=options.optionId){
this.selectedObj['selected'] = false;
options['selected'] = true;
this.selectedObj = options
}
}
const ret = { const ret = {
pageId: 15, pageId: this.curPageData['pageId'],
questions questions: [
{
questionId: this.curPageData['questions'][0].questionId,
options: [options]
}
]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
setOptionSelected() {
const options = this.curPageData['questions'][0].options
// console.log(this.curPageData['questions'][0])
if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option
}
})
}
//判断用哪个方法
checkFun(options){
if(this.optionType==1){
this.getAnswer(options)
}
if(this.optionType==2){
this.getManyAnswer(options)
}
}
} }
...@@ -5,25 +5,34 @@ ...@@ -5,25 +5,34 @@
{{ this.curPageData['questions'][0]['questionName'] }} {{ this.curPageData['questions'][0]['questionName'] }}
</div> </div>
<ul class="cityContent"> <ul class="cityContent">
<li *ngFor="let provinces of this.provinceList" (click)="showToast()"> <li
*ngFor="let provinces of this.provinceList"
[ngClass]="{ selected: provinces['selected'] == true }"
(click)="showToast(); selectProvince(provinces)"
>
{{ provinces.provinceAbbr }} {{ provinces.provinceAbbr }}
</li> </li>
</ul> </ul>
<div class="address" *ngIf="this.showAddress">
{{ this.strAddress }}
</div>
</div> </div>
</div> </div>
<div class="toastWrapper toast" *ngIf="isShow"> <div class="toastWrapper toast" *ngIf="isShow" (click)="closeToast();">
<div class="toastContent">
<div class="live">所在地区</div> </div>
<ul class="city"> <div class="toastContent city" *ngIf="isShow">
<li class="selected" (click)="closeToast()">舟山市</li> <div class="live">所在地区</div>
<li>台州市</li> <div class="province">
<li>宁波市</li> <span>{{ this.provinceName }}</span>
<li>杭州市</li>
<li>温州市</li>
<li>嘉兴市</li>
<li>湖州市</li>
<li>绍兴市</li>
</ul>
</div> </div>
<ul class="city">
<li
*ngFor="let city of this.cityList"
(click)="closeToast(); selectCity(city); getAnswer(city)"
>
{{ city.cityName }}
</li>
</ul>
</div> </div>
</div> </div>
import { Component, OnInit, Input } from '@angular/core' import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
import { CommonService } from '../common.service' import { CommonService } from '../common.service'
@Component({ @Component({
...@@ -8,41 +8,106 @@ import { CommonService } from '../common.service' ...@@ -8,41 +8,106 @@ import { CommonService } from '../common.service'
}) })
export class Page16Component implements OnInit { export class Page16Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
//获取省份
@Input() provinceList: Array<any>
@Output() getAllAnswer = new EventEmitter<any>()
isShow: boolean isShow: boolean
provinceList: Array<any>
cityList: Array<any> cityList: Array<any>
provinceId: number provinceId: number
provinceName: string
//具体地址显示
showAddress: boolean
address: Object
selectedProvinceObj: Object
selectedCityObj: Object
strAddress: string
constructor(private commonService: CommonService) {} constructor(private commonService: CommonService) {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) this.selectedProvinceObj = {}
this.provinceqry() this.selectedCityObj = {}
// console.log(this.curPageData)
this.showAddress = false
this.setOptionSelected()
} }
showToast() { showToast() {
this.isShow = true this.isShow = true
} }
selectProvince(option) {
if (!this.selectedProvinceObj['selected']) {
this.selectedProvinceObj = option
option['selected'] = true
} else {
if (this.selectedProvinceObj['provinceId'] != option.provinceId) {
this.selectedProvinceObj['selected'] = false
option['selected'] = true
this.selectedProvinceObj = option
}
}
// console.log(this.selectedProvinceObj)
this.provinceName = option.provinceName
this.provinceId = option.provinceId
this.getCityqry()
}
closeToast() { closeToast() {
this.isShow = false this.isShow = false
} }
provinceqry() { getCityqry() {
this.commonService.provinceqry({ insurerId: 14 }).subscribe(res => { const param = {
insurerId: 11,
provinceId: this.provinceId
}
this.commonService.getCityqry(param).subscribe(res => {
if (res['success']) { if (res['success']) {
this.provinceList = res['data'].provinceList this.cityList = res['data'].cityList
console.log(this.provinceList) // console.log(this.cityList)
} }
}) })
} }
getCityqry() { selectCity(e) {
const param = { this.showAddress = true
insurerId: 14, this.strAddress = this.provinceName + e.cityName
provinceId: this.provinceId this.address = {
customerInput: this.provinceName + ',' + e.cityName
} }
this.commonService.provinceqry(param).subscribe(res => { }
if (res['success']) {
console.log(res) getAnswer(option) {
if (!this.selectedCityObj['selected']) {
this.selectedCityObj = option
option['selected'] = true
} else {
if (this.selectedCityObj['optionId'] != option.optionId) {
this.selectedCityObj['selected'] = false
option['selected'] = true
this.selectedCityObj = option
}
}
const ret = {
pageId: this.curPageData['pageId'],
questions: [
{
...this.curPageData['questions'][0],
questionId: this.curPageData['questions'][0].questionId,
options: [this.address]
}
]
}
this.getAllAnswer.emit(ret)
}
setOptionSelected() {
const options = this.provinceList
// console.log(options)
if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedProvinceObj = option
} }
}) })
} }
......
...@@ -2,4 +2,7 @@ ...@@ -2,4 +2,7 @@
<div class="title"> <div class="title">
<img src="assets/images/bg_17.png" /> <img src="assets/images/bg_17.png" />
</div> </div>
<div class="footer" style="margin-top: 20%;" (click)="getHref()">
<div>我知道了</div>
</div>
</div> </div>
...@@ -10,6 +10,9 @@ export class Page17Component implements OnInit { ...@@ -10,6 +10,9 @@ export class Page17Component implements OnInit {
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) // console.log(this.curPageData)
}
getHref(){
window.location.href = 'https://' + window.location.host+ '/member'
} }
} }
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
<div class="questionTitle">{{ this.curPageData['pageName'] }}</div> <div class="questionTitle">{{ this.curPageData['pageName'] }}</div>
<ul class="option_item"> <ul class="option_item">
<li <li
*ngFor="let options of this.curPageData['questions'][0].options" *ngFor="let options of this.curPageData['questions'][0]['options']"
(click)="getAnswer(options)" (click)="getAnswer(options)"
> >
<img <img
[ngClass]="{'selected':this.selectedNum === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
(click)="changeStyle(options.optionId)"
src="assets/images/icon{{ options.optionId }}.png" src="assets/images/icon{{ options.optionId }}.png"
alt="{{ options.optionName }}" alt="{{ options.optionName }}"
/> />
......
...@@ -8,13 +8,25 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core' ...@@ -8,13 +8,25 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export class Page2Component implements OnInit { export class Page2Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
selectedNum:number; @Output() controlNext = new EventEmitter<any>()
selectedObj:Object;
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) this.selectedObj = {}
this.setOptionSelected()
} }
getAnswer(option) { getAnswer(option) {
if(!this.selectedObj['selected']){
this.selectedObj = option
option['selected'] = true;
}else{
if(this.selectedObj['optionId']!=option.optionId){
this.selectedObj['selected'] = false;
option['selected'] = true;
this.selectedObj = option
}
}
const ret = { const ret = {
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
...@@ -24,11 +36,22 @@ export class Page2Component implements OnInit { ...@@ -24,11 +36,22 @@ export class Page2Component implements OnInit {
} }
] ]
} }
this.getAllAnswer.emit(ret) // console.log(this.curPageData['questions']);
// console.log(ret.questions)
this.getAllAnswer.emit(ret);
this.controlNext.emit();
// console.log(ret)
} }
changeStyle(optionId){ setOptionSelected() {
//当前选中项 const options = this.curPageData['questions'][0].options
this.selectedNum = optionId if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option
}
})
} }
} }
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
<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)"> <b (click)="showToast(optionsList, i)" style="width:35%;text-align: center;float: right">
<span>{{ optionsList.name }}</span <span style="width:20%;text-align: center;">{{ optionsList.name }}</span
>&gt; >
<span style="width:10%;text-align: center;float: right">&gt;</span>
</b> </b>
</li> </li>
</ul> </ul>
......
...@@ -42,7 +42,7 @@ export class Page3Component implements OnInit { ...@@ -42,7 +42,7 @@ export class Page3Component implements OnInit {
const questionId = this.curQues['questionId'] const questionId = this.curQues['questionId']
this.curAllQues[questionId] = option this.curAllQues[questionId] = option
const questions = Object.keys(this.curAllQues).map(questionId => { const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] } return { questionId, options: [this.curAllQues[questionId]] }
}) })
const ret = { const ret = {
pageId: 3, pageId: 3,
...@@ -135,6 +135,6 @@ export class Page3Component implements OnInit { ...@@ -135,6 +135,6 @@ export class Page3Component implements OnInit {
] ]
} }
} }
console.log(this.curPageData['questions']) // console.log(this.curPageData['questions'])
} }
} }
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<div class="questionTitle">{{ this.curPageData['pageName'] }}</div> <div class="questionTitle">{{ this.curPageData['pageName'] }}</div>
<ul class="jobContent"> <ul class="jobContent">
<li <li
[ngClass]="{'selected':this.selectedNum === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][0].options" *ngFor="let options of this.curPageData['questions'][0].options"
(click)="getAnswer(options);changeStyle(options.optionId)" (click)="getAnswer(options)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -8,26 +8,45 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core' ...@@ -8,26 +8,45 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export class Page4Component implements OnInit { export class Page4Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
selectedNum:number; selectedObj: Object
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) this.selectedObj = {}
this.setOptionSelected()
} }
getAnswer(option) { getAnswer(option) {
if (!this.selectedObj['selected']) {
this.selectedObj = option
option['selected'] = true
} else {
if (this.selectedObj['optionId'] != option.optionId) {
this.selectedObj['selected'] = false
option['selected'] = true
this.selectedObj = option
}
}
const ret = { const ret = {
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
option: [option] options: [option]
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
changeStyle(optionId){
//当前选中项 setOptionSelected() {
this.selectedNum = optionId const options = this.curPageData['questions'][0].options
if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option
}
})
} }
} }
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
</div> </div>
<ul class="jobContent"> <ul class="jobContent">
<li <li
[ngClass]="{'selected':this.selectedNum === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][0]['options']" *ngFor="let options of this.curPageData['questions'][0]['options']"
(click)="getAnswer(options);changeStyle(options.optionId)" (click)="getAnswer(options)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -8,26 +8,44 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core' ...@@ -8,26 +8,44 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export class Page5Component implements OnInit { export class Page5Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
selectedNum:number; selectedObj: Object
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) this.selectedObj = {}
this.setOptionSelected()
} }
getAnswer(option) { getAnswer(option) {
if (!this.selectedObj['selected']) {
this.selectedObj = option
option['selected'] = true
} else {
if (this.selectedObj['optionId'] != option.optionId) {
this.selectedObj['selected'] = false
option['selected'] = true
this.selectedObj = option
}
}
const ret = { const ret = {
pageId: this.curPageData['pageId'], pageId: this.curPageData['pageId'],
questions: [ questions: [
{ {
questionId: this.curPageData['questions'][0].questionId, questionId: this.curPageData['questions'][0].questionId,
option: [option] options: [option]
} }
] ]
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
changeStyle(optionId){ setOptionSelected() {
//当前选中项 const options = this.curPageData['questions'][0].options
this.selectedNum = optionId if (!options) {
return
}
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option
}
})
} }
} }
...@@ -10,6 +10,6 @@ export class Page6Component implements OnInit { ...@@ -10,6 +10,6 @@ export class Page6Component implements OnInit {
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
console.log(this.curPageData) // console.log(this.curPageData)
} }
} }
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
</div> </div>
<ul class="income"> <ul class="income">
<li <li
[ngClass]="{'selected':this.selectedNum === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][0].options" *ngFor="let options of this.curPageData['questions'][0].options"
(click)="getAnswer(this.curPageData['questions'][0], options); (click)="getAnswer(this.curPageData['questions'][0], options)"
changeStyle(options.optionId)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
...@@ -19,10 +18,9 @@ ...@@ -19,10 +18,9 @@
</div> </div>
<ul class="income" *ngIf="hasMate"> <ul class="income" *ngIf="hasMate">
<li <li
[ngClass]="{'selected':this.selectedTwo === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][1]['options']" *ngFor="let options of this.curPageData['questions'][1]['options']"
(click)="getAnswer(this.curPageData['questions'][1], options); (click)="getAnswer(this.curPageData['questions'][1], options)"
changeStyle2(options.optionId)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -10,22 +10,30 @@ export class Page7Component implements OnInit { ...@@ -10,22 +10,30 @@ export class Page7Component implements OnInit {
@Input() hasMate: boolean @Input() hasMate: boolean
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
curAllQues: Object curAllQues: Object
selectedNum:number; selectedObj: Object
//第二个问题的选择
selectedTwo:number;
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
this.curAllQues = {} this.curAllQues = {}
console.log(this.curPageData) this.selectedObj = {}
console.log(this.hasMate) this.setOptionSelected()
} }
getAnswer(question, options) { getAnswer(question, options) {
console.log('page7', question, options) //获取当前页面问题id
const questionId = question['questionId'] const questionId = question['questionId']
if (!this.selectedObj[questionId]) {
this.selectedObj[questionId] = options
options['selected'] = true
} else {
if (this.selectedObj[questionId].optionId != options.optionId) {
this.selectedObj[questionId]['selected'] = false
options['selected'] = true
this.selectedObj[questionId] = options
}
}
this.curAllQues[questionId] = options this.curAllQues[questionId] = options
const questions = Object.keys(this.curAllQues).map(questionId => { const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] } return { questionId, options: [this.curAllQues[questionId]] }
}) })
const ret = { const ret = {
pageId: 7, pageId: 7,
...@@ -33,10 +41,20 @@ export class Page7Component implements OnInit { ...@@ -33,10 +41,20 @@ export class Page7Component implements OnInit {
} }
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
changeStyle(optionId){
this.selectedNum = optionId setOptionSelected() {
} const questions = this.curPageData['questions']
changeStyle2(optionId){ // console.log(questions)
this.selectedTwo = optionId if (!questions) {
return
}
questions.map(question => {
question['options'].forEach(option => {
if (option['selected']) {
// console.log(this.selectedObj)
this.selectedObj[question['questionId']] = option
}
})
})
} }
} }
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
</div> </div>
<ul class="income"> <ul class="income">
<li <li
[ngClass]="{'selected':this.selectedNum === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][0]['options']" *ngFor="let options of this.curPageData['questions'][0]['options']"
(click)="getAnswer(this.curPageData['questions'][0], options); (click)="getAnswer(this.curPageData['questions'][0], options)"
changeStyle(options.optionId)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
...@@ -19,10 +18,9 @@ ...@@ -19,10 +18,9 @@
</div> </div>
<ul class="income"> <ul class="income">
<li <li
[ngClass]="{'selected':this.selectedTwo === options.optionId}" [ngClass]="{ selected: options['selected'] == true }"
*ngFor="let options of this.curPageData['questions'][1]['options']" *ngFor="let options of this.curPageData['questions'][1]['options']"
(click)="getAnswer(this.curPageData['questions'][1], options); (click)="getAnswer(this.curPageData['questions'][1], options)"
changeStyle2(options.optionId)"
> >
{{ options.optionName }} {{ options.optionName }}
</li> </li>
......
...@@ -9,32 +9,52 @@ export class Page8Component implements OnInit { ...@@ -9,32 +9,52 @@ export class Page8Component implements OnInit {
@Input() curPageData: Array<any> @Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>() @Output() getAllAnswer = new EventEmitter<any>()
curAllQues: Object curAllQues: Object
selectedNum:number; selectedNum: number
selectedTwo:number; selectedTwo: number
selectedObj: Object
constructor() {} constructor() {}
ngOnInit() { ngOnInit() {
this.curAllQues = {} this.curAllQues = {}
console.log(this.curPageData) this.selectedObj = {}
this.setOptionSelected()
// console.log(this.curPageData)
} }
getAnswer(question, options) { getAnswer(question, options) {
console.log('page8', question, options)
const questionId = question['questionId'] const questionId = question['questionId']
if (!this.selectedObj[questionId]) {
this.selectedObj[questionId] = options
options['selected'] = true
} else {
if (this.selectedObj[questionId].optionId != options.optionId) {
this.selectedObj[questionId]['selected'] = false
options['selected'] = true
this.selectedObj[questionId] = options
}
}
this.curAllQues[questionId] = options this.curAllQues[questionId] = options
const questions = Object.keys(this.curAllQues).map(questionId => { const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] } return { questionId, options: [this.curAllQues[questionId]] }
}) })
const ret = { const ret = {
pageId: 8, pageId: 8,
questions questions
} }
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
} }
setOptionSelected() {
changeStyle(optionId){ const questions = this.curPageData['questions']
this.selectedNum = optionId if (!questions) {
} return
changeStyle2(optionId){ }
this.selectedTwo = optionId questions.map(question => {
question['options'].forEach(option => {
if (option['selected']) {
this.selectedObj[question['questionId']] = option
}
})
})
} }
} }
...@@ -20,7 +20,7 @@ export class Page9Component implements OnInit { ...@@ -20,7 +20,7 @@ export class Page9Component implements OnInit {
} }
getAnswer(question, options) { getAnswer(question, options) {
const questionId = question['questionId'] const questionId = question['questionId']
console.log('select', this.selectedObj, options) // console.log('select', this.selectedObj, options)
if (!this.selectedObj[questionId]) { if (!this.selectedObj[questionId]) {
this.selectedObj[questionId] = options this.selectedObj[questionId] = options
options['selected'] = true options['selected'] = true
...@@ -33,7 +33,7 @@ export class Page9Component implements OnInit { ...@@ -33,7 +33,7 @@ export class Page9Component implements OnInit {
} }
this.curAllQues[questionId] = options this.curAllQues[questionId] = options
const questions = Object.keys(this.curAllQues).map(questionId => { const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] } return { questionId, options: [this.curAllQues[questionId]] }
}) })
const ret = { const ret = {
pageId: 9, pageId: 9,
......
...@@ -97,6 +97,9 @@ ul li,ol li{ ...@@ -97,6 +97,9 @@ ul li,ol li{
line-height: 60px; line-height: 60px;
font-weight: bold; font-weight: bold;
} }
.content_footer div.next{
color: #8a8a8a;
}
.content_footer div:nth-child(1){ .content_footer div:nth-child(1){
flex: 0 0 15%; flex: 0 0 15%;
font-size: 30px; font-size: 30px;
...@@ -185,6 +188,9 @@ ul li,ol li{ ...@@ -185,6 +188,9 @@ ul li,ol li{
background-color: #fff; background-color: #fff;
z-index: 20; z-index: 20;
} }
.toastContent.city{
margin: 0;
}
.toastContent .live{ .toastContent .live{
display: flex; display: flex;
height: 40px; height: 40px;
...@@ -194,9 +200,21 @@ ul li,ol li{ ...@@ -194,9 +200,21 @@ ul li,ol li{
border-bottom: 1px rgb(220, 220, 220) solid; border-bottom: 1px rgb(220, 220, 220) solid;
font-size: 16px; font-size: 16px;
} }
.toastContent ul{ .toastContent .province{
display: flex; display: flex;
flex-wrap: wrap; height: 40px;
line-height:40px;
}
.toastContent .province span{
width: 45%;
font-size:16px;
text-align: center;
}
/* .toastContent .province span.selected{
border-bottom:2px solid #ff0000;
} */
.toastContent ul{
width: 100%;
margin: 5% 0%; margin: 5% 0%;
} }
.toastContent ul li{ .toastContent ul li{
...@@ -215,6 +233,8 @@ ul li,ol li{ ...@@ -215,6 +233,8 @@ ul li,ol li{
} }
.toastContent ul.city { .toastContent ul.city {
margin: 0; margin: 0;
overflow: auto;
max-height: 240px;
} }
.toastContent ul.city li{ .toastContent ul.city li{
width: 100%; width: 100%;
...@@ -224,4 +244,9 @@ ul li,ol li{ ...@@ -224,4 +244,9 @@ ul li,ol li{
margin: 0; margin: 0;
height:35px; height:35px;
line-height:35px; line-height:35px;
}
.address{
width: 80%;
margin:15% auto;
text-align: center;
} }
\ No newline at end of file
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