Commit 44e6aacc by Chao Sun

下一步置灰

parent 3c675c72
......@@ -78,9 +78,12 @@
<div class="footer" *ngIf="curPage == 0" (click)="addPage()">
<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)="addPage()" class="next">下一步</div>
<div
(click)="addPage()"
[ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
>下一步</div>
</div>
</div>
</div>
......@@ -17,6 +17,7 @@ export class AskComponent implements OnInit {
hasMate: boolean
//获取省份
provinceList: Array<any>
nextBtn:boolean;
constructor(private commonService: CommonService) {}
ngOnInit() {
......@@ -43,7 +44,7 @@ export class AskComponent implements OnInit {
})
}
reducePage() {
console.log('start', this.curPage)
// console.log('start', this.curPage)
if (this.curPage > 0) {
const page2Answer = this.allAnswers[1]
const optionId = page2Answer.questions[0].options[0].optionId
......@@ -74,7 +75,7 @@ export class AskComponent implements OnInit {
return
}
}
this.curPage--
this.curPage--;
this.setCurPageData()
} else {
return
......@@ -86,7 +87,11 @@ export class AskComponent implements OnInit {
})
}
addPage() {
if(this.nextBtn===false){
return;
}
if (this.curPage < 16) {
//判断当前页是否有答案
if (
this.curPage == 0 ||
this.allAnswers[this.curPage] ||
......@@ -102,26 +107,52 @@ export class AskComponent implements OnInit {
}
const answerParam = {
survey: {
customerId: 20,
orderId: 9999996,
customerId: this.commonService.getQueryString('customerId'),
orderId: this.commonService.getQueryString('orderId'),
pages: this.filterItems()
}
}
console.log(answerParam)
if (this.curPage == 16) {
this.commonService.saveCustomerAnwers(answerParam).then(res => {
console.log(res)
// console.log(res)
})
}
console.log(this.curPage)
// console.log(this.nextBtn)
}
getAllAnswer(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() {
// 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;
}
}
const thePateData = this.allQues[this.curPage]
console.log('thePateData------', this.curPage, thePateData)
// console.log('thePateData------', this.curPage, thePateData)
this.curPageData = thePateData
const page2Answer = this.allAnswers[1]
if (this.curPage == 2) {
......@@ -211,7 +242,7 @@ export class AskComponent implements OnInit {
//1单身 3单亲
if (optionId == 1 || optionId == 3) {
this.curPage++
console.log('page5', this.curPage, this.curPageData)
// console.log('page5', this.curPage, this.curPageData)
this.curPageData = this.allQues[this.curPage]
}
}
......
......@@ -73,4 +73,14 @@ export class CommonService {
return res;
})
}
getQueryString(name) {
const gitUrlParam = window.location.search;
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = decodeURIComponent(gitUrlParam).substr(1).match(reg);
if (r != null) {
return r[2];
}
return null;
}
}
......@@ -15,7 +15,7 @@ export class Page11Component implements OnInit {
ngOnInit() {
// this.allOption = {}
this.allOptions = []
console.log(this.curPageData)
// console.log(this.curPageData)
}
getAnswer(options) {
options['selected'] = !options['selected']
......@@ -46,7 +46,7 @@ export class Page11Component implements OnInit {
}
}
console.log(this.allOptions)
// console.log(this.allOptions)
// 删掉未选中的疾病
// for (let i = 0; i < this.allOptions.length; i++){
// if (!this.allOptions[i]['selected']) {
......
......@@ -14,10 +14,10 @@ export class Page14Component implements OnInit {
constructor() { }
ngOnInit() {
console.log(this.curPageData)
// console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this.optionType = this.curPageData['questions'][0].optionType
console.log(this.optionType)
// console.log(this.optionType)
if(this.optionType==1){
this.selectedObj = {}
this.setOptionSelected()
......
......@@ -16,10 +16,10 @@ export class Page15Component implements OnInit {
constructor() { }
ngOnInit() {
console.log(this.curPageData)
// console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this.optionType = this.curPageData['questions'][0].optionType
console.log(this.optionType)
// console.log(this.optionType)
if(this.optionType==1){
this.selectedObj = {}
this.setOptionSelected()
......@@ -30,7 +30,7 @@ export class Page15Component implements OnInit {
}
getManyAnswer(options) {
console.log(options)
// console.log(options)
options['selected'] = !options['selected']
for (let i = 0; i < this.allOptions.length; i++) {
// 更改问题状态,防止重复往数组push
......@@ -104,7 +104,7 @@ export class Page15Component implements OnInit {
setOptionSelected() {
const options = this.curPageData['questions'][0].options
console.log(this.curPageData['questions'][0])
// console.log(this.curPageData['questions'][0])
if (!options) {
return
}
......
......@@ -26,7 +26,7 @@ export class Page16Component implements OnInit {
ngOnInit() {
this.selectedProvinceObj = {}
this.selectedCityObj = {}
console.log(this.curPageData)
// console.log(this.curPageData)
this.showAddress = false
this.setOptionSelected()
}
......@@ -45,7 +45,7 @@ export class Page16Component implements OnInit {
this.selectedProvinceObj = option
}
}
console.log(this.selectedProvinceObj)
// console.log(this.selectedProvinceObj)
this.provinceName = option.provinceName
this.provinceId = option.provinceId
this.getCityqry()
......@@ -62,7 +62,7 @@ export class Page16Component implements OnInit {
this.commonService.getCityqry(param).subscribe(res => {
if (res['success']) {
this.cityList = res['data'].cityList
console.log(this.cityList)
// console.log(this.cityList)
}
})
}
......@@ -101,7 +101,7 @@ export class Page16Component implements OnInit {
setOptionSelected() {
const options = this.provinceList
console.log(options)
// console.log(options)
if (!options) {
return
}
......
......@@ -10,6 +10,6 @@ export class Page17Component implements OnInit {
constructor() {}
ngOnInit() {
console.log(this.curPageData)
// console.log(this.curPageData)
}
}
......@@ -8,6 +8,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export class Page2Component implements OnInit {
@Input() curPageData: Array<any>
@Output() getAllAnswer = new EventEmitter<any>()
@Output() controlNext = new EventEmitter<any>()
selectedObj:Object;
constructor() {}
......@@ -35,7 +36,11 @@ 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)
}
setOptionSelected() {
......
......@@ -42,7 +42,7 @@ export class Page3Component implements OnInit {
const questionId = this.curQues['questionId']
this.curAllQues[questionId] = option
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: this.curAllQues[questionId] }
return { questionId, options: [this.curAllQues[questionId]] }
})
const ret = {
pageId: 3,
......@@ -135,6 +135,6 @@ export class Page3Component implements OnInit {
]
}
}
console.log(this.curPageData['questions'])
// console.log(this.curPageData['questions'])
}
}
......@@ -10,6 +10,6 @@ export class Page6Component implements OnInit {
constructor() {}
ngOnInit() {
console.log(this.curPageData)
// console.log(this.curPageData)
}
}
......@@ -44,14 +44,14 @@ export class Page7Component implements OnInit {
setOptionSelected() {
const questions = this.curPageData['questions']
console.log(questions)
// console.log(questions)
if (!questions) {
return
}
questions.map(question => {
question['options'].forEach(option => {
if (option['selected']) {
console.log(this.selectedObj)
// console.log(this.selectedObj)
this.selectedObj[question['questionId']] = option
}
})
......
......@@ -18,7 +18,7 @@ export class Page8Component implements OnInit {
this.curAllQues = {}
this.selectedObj = {}
this.setOptionSelected()
console.log(this.curPageData)
// console.log(this.curPageData)
}
getAnswer(question, options) {
const questionId = question['questionId']
......@@ -40,6 +40,8 @@ export class Page8Component implements OnInit {
pageId: 8,
questions
}
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this.getAllAnswer.emit(ret)
}
setOptionSelected() {
......
......@@ -20,7 +20,7 @@ export class Page9Component implements OnInit {
}
getAnswer(question, options) {
const questionId = question['questionId']
console.log('select', this.selectedObj, options)
// console.log('select', this.selectedObj, options)
if (!this.selectedObj[questionId]) {
this.selectedObj[questionId] = options
options['selected'] = true
......
......@@ -97,6 +97,9 @@ ul li,ol li{
line-height: 60px;
font-weight: bold;
}
.content_footer div.next{
color: #8a8a8a;
}
.content_footer div:nth-child(1){
flex: 0 0 15%;
font-size: 30px;
......
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