Commit 807ed9c8 by Sweet Zhang

暂存

parent adc478ef
...@@ -80,8 +80,7 @@ ...@@ -80,8 +80,7 @@
</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' }"
>下一步</div> >下一步</div>
</div> </div>
......
...@@ -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)
" "
> >
......
...@@ -49,19 +49,19 @@ export class Page3Component implements OnInit { ...@@ -49,19 +49,19 @@ 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); console.log(ret);
// this.getAllAnswer.emit(ret) this.getAllAnswer.emit(ret)
// } }
changeStyle(options, optionId) { changeStyle(options, optionId) {
//当前选中项 //当前选中项
...@@ -105,8 +105,7 @@ export class Page3Component implements OnInit { ...@@ -105,8 +105,7 @@ export class Page3Component implements OnInit {
this.getAllAnswer.emit(ret); this.getAllAnswer.emit(ret);
} }
getAnswer(questionId, option) { /* getAnswer(questionId, option) {
debugger;
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++) {
let oldOption = {}; let oldOption = {};
...@@ -115,6 +114,9 @@ export class Page3Component implements OnInit { ...@@ -115,6 +114,9 @@ export class Page3Component implements OnInit {
options: [] options: []
}; };
question.questionId = this.curPageData['questions'][i].questionId; question.questionId = this.curPageData['questions'][i].questionId;
if (questionId == this.curPageData['questions'][i].questionId) {
oldOption = option;
} else {
oldOption = { oldOption = {
customerInput: null, customerInput: null,
optionId: this.curPageData['questions'][i]['optionId'], optionId: this.curPageData['questions'][i]['optionId'],
...@@ -122,22 +124,16 @@ export class Page3Component implements OnInit { ...@@ -122,22 +124,16 @@ export class Page3Component implements OnInit {
optionOrder: 2, optionOrder: 2,
selected: true selected: true
}; };
if (this.curPageData['questions'][i]['optionId']) { }
question.options.push(oldOption); question.options.push(oldOption);
this.questions.push(question); 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 { } else {
const questions = { let curQuestion = {
questionId: '', questionId: questionId,
options: [option] options: [option]
}; };
this.questions.push(questions); this.questions.push(curQuestion);
}
}
}
} }
const ret = { const ret = {
pageId: 3, pageId: 3,
...@@ -145,7 +141,7 @@ export class Page3Component implements OnInit { ...@@ -145,7 +141,7 @@ export class Page3Component implements OnInit {
} }
console.log(ret); console.log(ret);
this.getAllAnswer.emit(ret); this.getAllAnswer.emit(ret);
} }*/
addChild() { addChild() {
// this.addChildCount-- // this.addChildCount--
......
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