Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
allCampaign
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
allCampaign
Commits
f4410e73
Commit
f4410e73
authored
May 21, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://139.224.139.2:9091/Sweet/allCampaign
parents
afd125a8
6a733dcd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
156 additions
and
112 deletions
+156
-112
questionnaire/src/app/children-health/children-health.component.ts
+17
-5
questionnaire/src/app/income/income.component.html
+4
-4
questionnaire/src/app/income/income.component.ts
+34
-28
questionnaire/src/app/job/job.component.ts
+24
-23
questionnaire/src/app/loan/loan.component.ts
+32
-23
questionnaire/src/app/social-security/social-security.component.ts
+45
-29
No files found.
questionnaire/src/app/children-health/children-health.component.ts
View file @
f4410e73
...
@@ -20,6 +20,8 @@ export class ChildrenHealthComponent implements OnInit {
...
@@ -20,6 +20,8 @@ export class ChildrenHealthComponent implements OnInit {
questions
:
Array
<
any
>
=
[];
questions
:
Array
<
any
>
=
[];
// 总共有几个孩子
// 总共有几个孩子
childTotalCount
:
any
;
childTotalCount
:
any
;
// 暂存多个孩子的答案
childTotalQuestions
:
Array
<
any
>
=
[];
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
...
@@ -50,16 +52,26 @@ export class ChildrenHealthComponent implements OnInit {
...
@@ -50,16 +52,26 @@ export class ChildrenHealthComponent implements OnInit {
// 选择健康情况(多选)
// 选择健康情况(多选)
selectedHealth
(
option
)
{
selectedHealth
(
option
)
{
this
.
id
=
this
.
route
.
snapshot
.
params
[
'childId'
];
option
[
'selected'
]
=
!
option
[
'selected'
];
option
[
'selected'
]
=
!
option
[
'selected'
];
this
.
questions
=
[];
this
.
questions
=
[];
this
.
getOptions
(
99
,
option
);
this
.
getOptions
(
99
,
option
);
const
questions
=
{
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
'孩子'
+
this
.
id
+
'的健康状态'
,
childId
:
this
.
id
,
options
:
this
.
questions
};
for
(
let
i
=
0
;
i
<
this
.
childTotalQuestions
.
length
;
i
++
)
{
if
(
this
.
childTotalQuestions
[
i
].
childId
==
questions
.
childId
)
{
this
.
childTotalQuestions
.
splice
(
this
.
childTotalQuestions
.
indexOf
(
this
.
childTotalQuestions
[
i
]),
1
);
break
;
}
}
this
.
childTotalQuestions
.
push
(
questions
);
this
.
pageAnswers
=
{
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:
[{
questions
:
this
.
childTotalQuestions
,
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionName'
],
options
:
this
.
questions
}],
};
};
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
}
}
...
...
questionnaire/src/app/income/income.component.html
View file @
f4410e73
...
@@ -7,19 +7,19 @@
...
@@ -7,19 +7,19 @@
</div>
</div>
<ul
class=
"income"
>
<ul
class=
"income"
>
<li
<li
[
ngClass
]="{
selected:
selectedOptionId =
=
options
.
optionId
}"
[
ngClass
]="{
selected:
options
['
selected
']
}"
*
ngFor=
"let options of this.curPageData?.questions[0].options"
*
ngFor=
"let options of this.curPageData?.questions[0].options"
(
click
)="
selectedIncome
(
this
.
curPageData
?.
questions
[
0
],
options
)"
(
click
)="
selectedIncome
(
this
.
curPageData
?.
questions
[
0
],
options
)"
>
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
<div
class=
"questionTitle"
*
ngIf=
"
hasMate
"
>
<div
class=
"questionTitle"
*
ngIf=
"
this.type == 2 || this.type == 4
"
>
{{ this.curPageData?.questions[1]['questionName']}}
{{ this.curPageData?.questions[1]['questionName']}}
</div>
</div>
<ul
class=
"income"
*
ngIf=
"
hasMate
"
>
<ul
class=
"income"
*
ngIf=
"
this.type == 2 || this.type == 4
"
>
<li
<li
[
ngClass
]="{
selected:
selectedOptionId =
=
options
.
optionId
}"
[
ngClass
]="{
selected:
options
['
selected
']}"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
(
click
)="
selectedIncome
(
this
.
curPageData
?.
questions
[
1
],
options
)"
(
click
)="
selectedIncome
(
this
.
curPageData
?.
questions
[
1
],
options
)"
>
>
...
...
questionnaire/src/app/income/income.component.ts
View file @
f4410e73
...
@@ -8,13 +8,11 @@ import {ActivatedRoute, Router} from "@angular/router";
...
@@ -8,13 +8,11 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls
:
[
'./income.component.css'
]
styleUrls
:
[
'./income.component.css'
]
})
})
export
class
IncomeComponent
implements
OnInit
{
export
class
IncomeComponent
implements
OnInit
{
hasMate
:
boolean
;
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
pageAnswers
:
any
;
pageAnswers
:
any
;
// 家庭结构
// 家庭结构
type
:
any
;
type
:
any
;
selectedOptionId
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
...
@@ -34,34 +32,43 @@ export class IncomeComponent implements OnInit {
...
@@ -34,34 +32,43 @@ export class IncomeComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
()
this
.
surveyInfo
();
//判断家庭决定是否显示配偶
if
(
this
.
type
==
2
||
this
.
type
==
4
){
this
.
hasMate
=
true
;
}
else
{
this
.
hasMate
=
false
;
}
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'6'
]
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'6'
]
;
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
}
}
})
})
}
}
selectedIncome
(
question
,
option
)
{
selectedIncome
(
question
,
option
)
{
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
!
option
.
selected
;
option
.
selected
=
true
;
const
questions
=
{
const
questions
=
{
questionId
:
question
.
questionId
,
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
questionName
:
question
.
questionName
,
options
:
[
option
]
options
:
[]
};
};
// 将选择的状态改为true,其他的改为false;
if
(
question
[
'options'
].
length
>
0
)
{
for
(
let
j
=
0
;
j
<
question
[
'options'
].
length
;
j
++
)
{
if
(
question
[
'options'
][
j
].
optionId
==
option
.
optionId
)
{
question
[
'options'
][
j
].
selected
=
true
;
}
else
{
question
[
'options'
][
j
].
selected
=
false
;
}
// 拿到所有selected为true的选项
if
(
question
[
'options'
][
j
][
'selected'
])
{
questions
.
options
.
push
(
question
[
'options'
][
j
]);
}
}
}
// console.log(questions)
// 同一个问题更改答案
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
...
@@ -70,28 +77,27 @@ export class IncomeComponent implements OnInit {
...
@@ -70,28 +77,27 @@ export class IncomeComponent implements OnInit {
}
}
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
console
.
log
(
questions
)
// console.log(this.pageAnswers)
console
.
log
(
this
.
pageAnswers
)
// 判断页面需要几个问题
//判断页面需要几个问题
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
if
(
this
.
type
==
2
||
this
.
type
==
4
){
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
)
{
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
){
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
else
{
}
else
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
}
}
}
next
(){
next
()
{
if
(
this
.
nextBtn
==
true
)
{
if
(
this
.
nextBtn
==
true
)
{
this
.
router
.
navigate
([
'/loan'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/loan'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
else
{
}
else
{
return
;
return
;
}
}
}
}
...
...
questionnaire/src/app/job/job.component.ts
View file @
f4410e73
...
@@ -11,12 +11,13 @@ export class JobComponent implements OnInit {
...
@@ -11,12 +11,13 @@ export class JobComponent implements OnInit {
pageAnswers
:
any
;
pageAnswers
:
any
;
selectedOptionId
:
any
;
selectedOptionId
:
any
;
type
:
any
;
type
:
any
;
id
:
any
;
id
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
constructor
(
private
commonService
:
CommonService
,
private
route
:
ActivatedRoute
)
{
private
router
:
Router
,
/**
private
route
:
ActivatedRoute
)
{
/**
* 1:单身贵族
* 1:单身贵族
* 2:二人世界
* 2:二人世界
* 3:独立带娃
* 3:独立带娃
...
@@ -49,7 +50,7 @@ export class JobComponent implements OnInit {
...
@@ -49,7 +50,7 @@ export class JobComponent implements OnInit {
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'3'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'3'
];
}
else
{
}
else
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'4'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'4'
];
}
}
console
.
log
(
this
.
curPageData
)
console
.
log
(
this
.
curPageData
)
}
}
...
@@ -71,32 +72,32 @@ export class JobComponent implements OnInit {
...
@@ -71,32 +72,32 @@ export class JobComponent implements OnInit {
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
commonService
.
todos
)
console
.
log
(
this
.
commonService
.
todos
)
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
}
// 下一步
// 下一步
next
()
{
next
()
{
//先判断下一步能不能点
//
先判断下一步能不能点
//如果是二人世界或是多口之家跳转到配偶页
//
如果是二人世界或是多口之家跳转到配偶页
//先判断当前页是您的页还是配偶页
//
先判断当前页是您的页还是配偶页
if
(
this
.
nextBtn
==
true
)
{
if
(
this
.
nextBtn
==
true
)
{
if
(
this
.
id
==
1
)
{
if
(
this
.
id
==
1
)
{
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
this
.
router
.
navigate
([
'/spouse_job'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/spouse_job'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
else
{
}
else
{
this
.
router
.
navigate
([
'/transit1'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/transit1'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
}
}
else
{
}
else
{
this
.
router
.
navigate
([
'/transit1'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/transit1'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
}
}
else
{
}
else
{
return
;
return
;
}
}
}
}
}
}
questionnaire/src/app/loan/loan.component.ts
View file @
f4410e73
...
@@ -8,17 +8,16 @@ import {ActivatedRoute, Router} from "@angular/router";
...
@@ -8,17 +8,16 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls
:
[
'./loan.component.css'
]
styleUrls
:
[
'./loan.component.css'
]
})
})
export
class
LoanComponent
implements
OnInit
{
export
class
LoanComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
//家庭结构
//
家庭结构
type
:
any
;
type
:
any
;
pageAnswers
:
any
;
pageAnswers
:
any
;
selectedOptionId
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
private
route
:
ActivatedRoute
)
{
)
{
/**
/**
* 1:单身贵族
* 1:单身贵族
* 2:二人世界
* 2:二人世界
* 3:独立带娃
* 3:独立带娃
...
@@ -47,15 +46,26 @@ export class LoanComponent implements OnInit {
...
@@ -47,15 +46,26 @@ export class LoanComponent implements OnInit {
})
})
}
}
selectedLoan
(
question
,
option
){
selectedLoan
(
question
,
option
)
{
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
!
option
.
selected
;
option
.
selected
=
true
;
const
questions
=
{
const
questions
=
{
questionId
:
question
.
questionId
,
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
questionName
:
question
.
questionName
,
options
:
[
option
]
options
:
[]
};
};
if
(
question
[
'options'
].
length
>
0
)
{
for
(
let
j
=
0
;
j
<
question
[
'options'
].
length
;
j
++
)
{
if
(
question
[
'options'
][
j
].
optionId
==
option
.
optionId
)
{
question
[
'options'
][
j
].
selected
=
true
;
}
else
{
question
[
'options'
][
j
].
selected
=
false
;
}
// 拿到所有selected为true的选项
if
(
question
[
'options'
][
j
][
'selected'
])
{
questions
.
options
.
push
(
question
[
'options'
][
j
]);
}
}
}
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
...
@@ -64,20 +74,19 @@ export class LoanComponent implements OnInit {
...
@@ -64,20 +74,19 @@ export class LoanComponent implements OnInit {
}
}
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
console
.
log
(
questions
)
// console.log(this.pageAnswers)
console
.
log
(
this
.
pageAnswers
)
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
)
{
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
){
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
}
next
(){
next
()
{
if
(
this
.
nextBtn
==
true
)
{
if
(
this
.
nextBtn
==
true
)
{
this
.
router
.
navigate
([
'/social'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/social'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
else
{
}
else
{
return
return
;
}
}
}
}
}
}
questionnaire/src/app/social-security/social-security.component.ts
View file @
f4410e73
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../common.service'
;
import
{
CommonService
}
from
'../common.service'
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
...
@@ -8,17 +8,17 @@ import {ActivatedRoute, Router} from "@angular/router";
...
@@ -8,17 +8,17 @@ import {ActivatedRoute, Router} from "@angular/router";
styleUrls
:
[
'./social-security.component.css'
]
styleUrls
:
[
'./social-security.component.css'
]
})
})
export
class
SocialSecurityComponent
implements
OnInit
{
export
class
SocialSecurityComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
hasMate
:
boolean
;
hasMate
:
boolean
;
//家庭结构
//
家庭结构
type
:
any
;
type
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
pageAnswers
:
any
;
pageAnswers
:
any
;
selectedOptionId
:
any
;
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
/**
/**
* 1:单身贵族
* 1:单身贵族
* 2:二人世界
* 2:二人世界
* 3:独立带娃
* 3:独立带娃
...
@@ -34,31 +34,46 @@ export class SocialSecurityComponent implements OnInit {
...
@@ -34,31 +34,46 @@ export class SocialSecurityComponent implements OnInit {
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
()
this
.
surveyInfo
()
//判断家庭决定是否显示配偶
//
判断家庭决定是否显示配偶
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
this
.
hasMate
=
true
;
this
.
hasMate
=
true
;
}
else
{
}
else
{
this
.
hasMate
=
false
;
this
.
hasMate
=
false
;
}
}
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'8'
]
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'8'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
console
.
log
(
this
.
curPageData
)
console
.
log
(
this
.
curPageData
)
}
}
})
})
}
}
selectedSocial
(
question
,
option
){
selectedSocial
(
question
,
option
)
{
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
!
option
.
selected
;
option
.
selected
=
true
;
const
questions
=
{
const
questions
=
{
questionId
:
question
.
questionId
,
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
questionName
:
question
.
questionName
,
options
:
[
option
]
options
:
[]
};
};
console
.
log
(
questions
)
if
(
question
[
'options'
].
length
>
0
)
{
for
(
let
j
=
0
;
j
<
question
[
'options'
].
length
;
j
++
)
{
if
(
question
[
'options'
][
j
].
optionId
==
option
.
optionId
)
{
question
[
'options'
][
j
].
selected
=
true
;
}
else
{
question
[
'options'
][
j
].
selected
=
false
;
}
// 拿到所有selected为true的选项
if
(
question
[
'options'
][
j
][
'selected'
])
{
questions
.
options
.
push
(
question
[
'options'
][
j
]);
}
}
}
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
...
@@ -66,27 +81,28 @@ export class SocialSecurityComponent implements OnInit {
...
@@ -66,27 +81,28 @@ export class SocialSecurityComponent implements OnInit {
}
}
}
}
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
pageAnswers
.
questions
.
push
(
questions
);
// console.log(this.pageAnswers)
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
//判断页面需要几个问题
//
判断页面需要几个问题
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
)
{
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
)
{
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
else
{
}
else
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
}
}
}
next
(){
next
()
{
if
(
this
.
nextBtn
==
true
)
{
if
(
this
.
nextBtn
==
true
)
{
this
.
router
.
navigate
([
'/transit2'
],
{
queryParams
:{
type
:
this
.
type
}})
this
.
router
.
navigate
([
'/transit2'
],
{
queryParams
:
{
type
:
this
.
type
}})
}
else
{
}
else
{
return
;
return
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment