Commit e91e49df by Chao Sun

删除多个问题初始化

parent fb98e718
......@@ -46,10 +46,6 @@ export class AskComponent implements OnInit {
})
}
reducePage() {
if(this.questionInfo){
this.allAnswers[this.curPage] = this.questionInfo;
this.questionInfo = null
}
if (this.curPage > 0) {
const page2Answer = this.allAnswers[1]
if(page2Answer){
......@@ -88,24 +84,6 @@ export class AskComponent implements OnInit {
} else {
return
}
// if(this.curPage == 6 || this.curPage == 8){
// const page2Answer = this.allAnswers[1]
// const optionId = page2Answer.questions[0].options[0].optionId
// if(optionId==1 || optionId==3){
// if(this.questionInfo['questions'].length>0){
// this.nextBtn = true
// }
// }
// }
// if(this.curPageData['questions'].length == this.questionInfo['questions'].length){
// this.nextBtn = true
// }
console.log(this.questionInfo)
// if(){
// }
}
filterItems() {
return this.allAnswers.filter(item => {
......@@ -143,10 +121,10 @@ export class AskComponent implements OnInit {
pages: this.filterItems()
}
}
console.log(answerParam)
if (this.curPage == 16) {
this.commonService.saveCustomerAnwers(answerParam).then(res => {
// console.log(res)
})
}
}
......@@ -219,7 +197,6 @@ export class AskComponent implements OnInit {
this.nextBtn = false;
}
}
// console.log('thePateData------', this.curPage, thePateData)
}
filterPage2(optionId, thePateData) {
......@@ -271,7 +248,6 @@ export class AskComponent implements OnInit {
//1单身 3单亲
if (optionId == 1 || optionId == 3) {
this.curPage++
// console.log('page5', this.curPage, this.curPageData)
this.curPageData = this.allQues[this.curPage]
}
}
......
......@@ -36,6 +36,7 @@ export class Page3Component implements OnInit {
this.curQuesIndex = idx
// console.log(question)
this.curQuestionSelecte = question.name
}
closeToast() {
this.isShow = false
......@@ -43,9 +44,11 @@ export class Page3Component implements OnInit {
getAnswer(option) {
const questionId = this.curQues['questionId']
this.curAllQues[questionId] = option
console.log(this.curAllQues)
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: [this.curAllQues[questionId]] }
})
const ret = {
pageId: 3,
questions
......@@ -57,9 +60,9 @@ export class Page3Component implements OnInit {
//当前选中项
this.curPageData['questions'][this.curQuesIndex]['name'] =
options.optionName
}
addChild() {
// this.addChildCount--
// if (this.addChildCount >= 0) {
......
......@@ -45,6 +45,7 @@ export class Page5Component implements OnInit {
options.forEach(option => {
if (option['selected']) {
this.selectedObj = option;
console.log(this.selectedObj)
this.getAnswer(this.selectedObj)
}
})
......
......@@ -11,14 +11,17 @@ export class Page7Component implements OnInit {
@Output() getAllAnswer = new EventEmitter<any>()
curAllQues: Object
selectedObj: Object
selectedObj1:Object
constructor() {}
ngOnInit() {
this.curAllQues = {}
this.selectedObj = {}
this.selectedObj1 = {}
this.setOptionSelected()
}
getAnswer(question, options) {
console.log(question,options)
//获取当前页面问题id
const questionId = question['questionId']
if (!this.selectedObj[questionId]) {
......@@ -53,14 +56,6 @@ export class Page7Component implements OnInit {
if (option['selected']) {
// console.log(this.selectedObj)
this.selectedObj[question['questionId']] = option
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: [this.curAllQues[questionId]] }
})
const ret = {
pageId: 7,
questions
}
this.getAllAnswer.emit(ret)
}
})
})
......
......@@ -53,14 +53,6 @@ export class Page8Component implements OnInit {
question['options'].forEach(option => {
if (option['selected']) {
this.selectedObj[question['questionId']] = option
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: [this.curAllQues[questionId]] }
})
const ret = {
pageId: 8,
questions
}
this.getAllAnswer.emit(ret)
}
})
})
......
......@@ -50,14 +50,6 @@ export class Page9Component implements OnInit {
question['options'].forEach(option => {
if (option['selected']) {
this.selectedObj[question['questionId']] = option
const questions = Object.keys(this.curAllQues).map(questionId => {
return { questionId, options: [this.curAllQues[questionId]] }
})
const ret = {
pageId: 9,
questions
}
this.getAllAnswer.emit(ret)
}
})
})
......
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