Commit a71b911a by Chao Sun

去掉上一步

parent a4b55950
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<div>获取家庭分析报告</div> <div>获取家庭分析报告</div>
</div> </div>
<div class="content_footer" *ngIf="curPage != 0 && curPage!=16"> <div class="content_footer" *ngIf="curPage != 0 && curPage!=16">
<div (click)="reducePage()" style="color: #8a8a8a;">&lt;</div> <!-- <div (click)="reducePage()" style="color: #8a8a8a;">&lt;</div> -->
<div <div
(click)="addPage()" (click)="addPage()"
[ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }" [ngStyle]="{ color: nextBtn == false ? '#8a8a8a' : '#ec2d37' }"
......
...@@ -121,7 +121,6 @@ export class AskComponent implements OnInit { ...@@ -121,7 +121,6 @@ export class AskComponent implements OnInit {
pages: this.filterItems() pages: this.filterItems()
} }
} }
console.log(answerParam)
if (this.curPage == 16) { if (this.curPage == 16) {
this.commonService.saveCustomerAnwers(answerParam).then(res => { this.commonService.saveCustomerAnwers(answerParam).then(res => {
......
<div class="layout"> <div class="layout">
<div class="content"> <div class="content">
<div class="questionTitle">{{ this.curPageData['pageName'] }}</div> <div class="questionTitle">{{ this.curPageData['pageName'] }}</div>
<ul class="option_item"> <ul class="option_item" style="margin-top: 20%;">
<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)"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*ngFor="let options of curQues.options" *ngFor="let options of curQues.options"
(click)=" (click)="
closeToast(); closeToast();
getAnswer(curQues['questionId'],options); getAnswer(options);
changeStyle(options, options.optionId) changeStyle(options, options.optionId)
" "
> >
......
...@@ -22,7 +22,7 @@ export class Page3Component implements OnInit { ...@@ -22,7 +22,7 @@ export class Page3Component implements OnInit {
addChildCount: number addChildCount: number
curQuestionSelecte: string; curQuestionSelecte: string;
questions: Array<any>; questions: Array<any>;
selectedObj:Object;
constructor() { constructor() {
this.questions = []; this.questions = [];
} }
...@@ -34,14 +34,12 @@ export class Page3Component implements OnInit { ...@@ -34,14 +34,12 @@ export class Page3Component implements OnInit {
//初始化增加孩子按钮可以点2次 //初始化增加孩子按钮可以点2次
this.addChildCount = 2; this.addChildCount = 2;
// console.log(this.curPageData) // console.log(this.curPageData)
this.selectedOptions();
} }
showToast(question, idx) { showToast(question, idx) {
this.isShow = true this.isShow = true
this.curQues = question this.curQues = question
this.curQuesIndex = idx this.curQuesIndex = idx
// console.log(question)
this.curQuestionSelecte = question.name this.curQuestionSelecte = question.name
} }
...@@ -50,19 +48,18 @@ export class Page3Component implements OnInit { ...@@ -50,19 +48,18 @@ export class Page3Component implements OnInit {
this.isShow = false this.isShow = false
} }
// getAnswer(option) { getAnswer(option) {
// 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,
// questions questions
// } }
// console.log(ret); this.getAllAnswer.emit(ret)
// this.getAllAnswer.emit(ret) }
// }
changeStyle(options, optionId) { changeStyle(options, optionId) {
//当前选中项 //当前选中项
...@@ -74,80 +71,37 @@ export class Page3Component implements OnInit { ...@@ -74,80 +71,37 @@ export class Page3Component implements OnInit {
} }
// 保存用户选择的信息 // 保存用户选择的信息
selectedOptions() { // selectedOptions() {
if (this.curPageData['questions'].length > 0) { // if (this.curPageData['questions'].length > 0) {
for (let i = 0; i < this.curPageData['questions'].length; i++) { // for (let i = 0; i < this.curPageData['questions'].length; i++) {
if (!this.curPageData['questions'][i]['name']) { // if (!this.curPageData['questions'][i]['name']) {
return; // return;
} // }
let option = {}; // let option = {};
let question = { // let question = {
questionId: '', // questionId: '',
options: [] // options: []
}; // };
question.questionId = this.curPageData['questions'][i].questionId; // question.questionId = this.curPageData['questions'][i].questionId;
option = { // option = {
customerInput: null, // customerInput: null,
optionId: this.curPageData['questions'][i]['optionId'], // optionId: this.curPageData['questions'][i]['optionId'],
optionName: this.curPageData['questions'][i]['name'], // optionName: this.curPageData['questions'][i]['name'],
optionOrder: 2, // optionOrder: 2,
selected: true // selected: true
}; // };
question.options.push(option); // question.options.push(option);
this.questions.push(question); // this.questions.push(question);
} // }
} // }
const ret = {
pageId: 3,
questions: this.questions
}
console.log(ret);
this.getAllAnswer.emit(ret);
}
getAnswer(questionId, option) {
debugger;
if (this.curPageData['questions'].length > 0) {
for (let i = 0; i < this.curPageData['questions'].length; i++) {
let oldOption = {};
let question = {
questionId: '',
options: []
};
question.questionId = this.curPageData['questions'][i].questionId;
oldOption = {
customerInput: null,
optionId: this.curPageData['questions'][i]['optionId'],
optionName: this.curPageData['questions'][i]['name'],
optionOrder: 2,
selected: true
};
if (this.curPageData['questions'][i]['optionId']) {
question.options.push(oldOption);
this.questions.push(question);
}
for (let j = 0; j < this.questions.length; j++) {
if (this.questions[j].questionId == questionId) {
this.questions[j].options[0] = option;
} else {
const questions = {
questionId: '',
options: [option]
};
this.questions.push(questions);
}
}
}
}
const ret = {
pageId: 3,
questions: this.questions
}
console.log(ret);
this.getAllAnswer.emit(ret);
}
// const ret = {
// pageId: 3,
// questions: this.questions
// }
// console.log(ret);
// this.getAllAnswer.emit(ret);
// }
addChild() { addChild() {
// this.addChildCount-- // this.addChildCount--
......
...@@ -104,8 +104,9 @@ ul li,ol li{ ...@@ -104,8 +104,9 @@ ul li,ol li{
color: #8a8a8a; color: #8a8a8a;
} }
.content_footer div:nth-child(1){ .content_footer div:nth-child(1){
flex: 0 0 15%; font-size: 20px;
font-size: 30px; width: 40%;
margin: 0 auto;
} }
.content_footer div:nth-child(2){ .content_footer div:nth-child(2){
flex: 0 0 60%; flex: 0 0 60%;
......
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