Commit c2a98a9d by Chao Sun

多选问题

parent aa5efb33
...@@ -7,17 +7,19 @@ import { Options } from 'selenium-webdriver/chrome' ...@@ -7,17 +7,19 @@ import { Options } from 'selenium-webdriver/chrome'
styleUrls: ['./ask.component.css'] styleUrls: ['./ask.component.css']
}) })
export class AskComponent implements OnInit { export class AskComponent implements OnInit {
allQues: Array<any> allQues: Array<any>;
curPage: number curPage: number;
totalPage: number totalPage: number;
curQues: string curQues: string;
curPageData: Object curPageData: Object;
allAnswers: Array<any> allAnswers: Array<any>;
isShowChildAgeBtn: boolean isShowChildAgeBtn: boolean;
hasMate: boolean hasMate: boolean;
//获取省份 //获取省份
provinceList: Array<any> provinceList: Array<any>;
nextBtn:boolean; nextBtn:boolean;
// 暂存问题也信息
questionInfo:any;
constructor(private commonService: CommonService) {} constructor(private commonService: CommonService) {}
ngOnInit() { ngOnInit() {
...@@ -90,6 +92,8 @@ export class AskComponent implements OnInit { ...@@ -90,6 +92,8 @@ export class AskComponent implements OnInit {
if(this.nextBtn===false){ if(this.nextBtn===false){
return; return;
} }
console.log(this.questionInfo)
this.allAnswers[this.curPage] = this.questionInfo;
if (this.curPage < 16) { if (this.curPage < 16) {
//判断当前页是否有答案 //判断当前页是否有答案
if ( if (
...@@ -120,13 +124,23 @@ export class AskComponent implements OnInit { ...@@ -120,13 +124,23 @@ export class AskComponent implements OnInit {
} }
} }
getAllAnswer(e) { getAllAnswer(e) {
this.allAnswers[this.curPage] = e let result=false;
// console.log(this.allAnswers); this.questionInfo = e;
console.log(e)
const questions = e.questions;
if(questions.length>0){
for(let i=0;i<questions.length;i++){
let options = questions[i].options;
if(options.length>0){
result = true;
}
}
}
if (this.curPage < 16) { if (this.curPage < 16) {
//判断当前页是否有答案 //判断当前页是否有答案
if ( if (
this.curPage == 0 || this.curPage == 0 ||
this.allAnswers[this.curPage] || result ||
this.curPage == 5 || this.curPage == 5 ||
this.curPage == 9 this.curPage == 9
) { ) {
......
...@@ -107,8 +107,11 @@ export class Page11Component implements OnInit { ...@@ -107,8 +107,11 @@ export class Page11Component implements OnInit {
// } // }
// questions[0]['options'].forEach(option => { // questions[0]['options'].forEach(option => {
// if(option['selected']){ // if(option['selected']){
// // this.allOptions[questions] = option // console.log(questions)
// console.log(this.allOptions) // this.allOptions = questions[0]['options']
// // console.log(questions[0]['options'])
// // console.log(this.allOptions[question])
// } // }
// }); // });
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<div class="icon">+</div> <div class="icon">+</div>
<div data-toggle="modal">增加孩子年龄</div> <div data-toggle="modal">增加孩子年龄</div>
</div> </div>
<div>{{result}}</div>
<div class="toastWrapper toast" *ngIf="isShow"> <div class="toastWrapper toast" *ngIf="isShow">
<div class="toastContent"> <div class="toastContent">
<ul> <ul>
......
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