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
20edb27f
Commit
20edb27f
authored
May 21, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
疾病
parent
ffb5a675
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
284 additions
and
31 deletions
+284
-31
questionnaire/src/app/disease/disease.component.html
+5
-3
questionnaire/src/app/disease/disease.component.ts
+79
-3
questionnaire/src/app/income/income.component.ts
+26
-7
questionnaire/src/app/job/job.component.ts
+18
-4
questionnaire/src/app/loan/loan.component.html
+7
-3
questionnaire/src/app/loan/loan.component.ts
+59
-3
questionnaire/src/app/social-security/social-security.component.html
+7
-3
questionnaire/src/app/social-security/social-security.component.ts
+69
-2
questionnaire/src/app/transit2/transit2.component.html
+3
-1
questionnaire/src/app/transit2/transit2.component.ts
+11
-2
No files found.
questionnaire/src/app/disease/disease.component.html
View file @
20edb27f
...
@@ -6,8 +6,9 @@
...
@@ -6,8 +6,9 @@
</div>
</div>
<ul
class=
"jobContent"
>
<ul
class=
"jobContent"
>
<li
<li
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
*
ngFor=
"let options of this.options"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
selectedOptionId =
=
options
.
optionId
}"
(
click
)="
getAnswer
(
options
)"
>
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
...
@@ -15,7 +16,8 @@
...
@@ -15,7 +16,8 @@
</div>
</div>
<div
class=
"content_footer"
>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
</div>
</div>
</div>
questionnaire/src/app/disease/disease.component.ts
View file @
20edb27f
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"
;
@
Component
({
@
Component
({
selector
:
'app-disease'
,
selector
:
'app-disease'
,
...
@@ -8,19 +9,94 @@ import {CommonService} from '../common.service';
...
@@ -8,19 +9,94 @@ import {CommonService} from '../common.service';
})
})
export
class
DiseaseComponent
implements
OnInit
{
export
class
DiseaseComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
type
:
any
;
pageAnswers
:
any
;
nextBtn
:
boolean
;
options
:
Array
<
any
>
;
selectedOptionId
:
any
;
constructor
(
constructor
(
private
commonService
:
CommonService
private
commonService
:
CommonService
,
)
{
}
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
pageAnswers
=
{
pageId
:
''
,
questions
:
[{
questionId
:
''
,
questionName
:
''
,
options
:
[{
optionId
:
''
,
optionName
:
''
,
optionOrder
:
''
,
selected
:
''
}]
}],
};
}
ngOnInit
()
{
ngOnInit
()
{
this
.
nextBtn
=
false
;
this
.
surveyInfo
()
this
.
surveyInfo
()
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'13'
]
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'13'
]
console
.
log
(
this
.
curPageData
)
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
//过滤选项
if
(
this
.
type
==
1
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
106
||
option
.
optionId
==
107
})
}
if
(
this
.
type
==
2
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
108
||
option
.
optionId
==
109
||
option
.
optionId
==
111
})
}
if
(
this
.
type
==
3
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
108
||
option
.
optionId
==
110
||
option
.
optionId
==
111
})
}
if
(
this
.
type
==
4
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
108
||
option
.
optionId
==
109
||
option
.
optionId
==
110
||
option
.
optionId
==
111
})
}
}
}
})
})
}
}
getAnswer
(
option
){
// console.log(options)
this
.
selectedOptionId
=
option
.
optionId
;
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:[{
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionName'
],
options
:[
option
]
}]
}
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
)
console
.
log
(
this
.
pageAnswers
)
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
}
else
{
this
.
nextBtn
=
false
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/smoke'
],{
queryParams
:{
type
:
this
.
type
}})
}
}
}
}
questionnaire/src/app/income/income.component.ts
View file @
20edb27f
...
@@ -14,6 +14,7 @@ export class IncomeComponent implements OnInit {
...
@@ -14,6 +14,7 @@ export class IncomeComponent implements OnInit {
// 家庭结构
// 家庭结构
type
:
any
;
type
:
any
;
selectedOptionId
:
any
;
selectedOptionId
:
any
;
nextBtn
:
boolean
;
constructor
(
constructor
(
private
commonService
:
CommonService
,
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
...
@@ -35,13 +36,13 @@ export class IncomeComponent implements OnInit {
...
@@ -35,13 +36,13 @@ export class IncomeComponent implements OnInit {
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
()
this
.
surveyInfo
()
this
.
hasMate
=
true
;
//判断家庭决定是否显示配偶
//判断家庭决定是否显示配偶
if
(
this
.
type
==
2
||
this
.
type
==
4
){
if
(
this
.
type
==
2
||
this
.
type
==
4
){
this
.
hasMate
=
true
;
}
else
{
}
else
{
this
.
hasMate
=
false
;
}
}
this
.
nextBtn
=
false
;
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
...
@@ -49,7 +50,6 @@ export class IncomeComponent implements OnInit {
...
@@ -49,7 +50,6 @@ export class IncomeComponent implements OnInit {
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'
];
}
}
})
})
}
}
...
@@ -57,7 +57,6 @@ export class IncomeComponent implements OnInit {
...
@@ -57,7 +57,6 @@ export class IncomeComponent implements OnInit {
selectedIncome
(
question
,
option
){
selectedIncome
(
question
,
option
){
this
.
selectedOptionId
=
option
.
optionId
;
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
true
;
option
.
selected
=
true
;
const
questions
=
{
const
questions
=
{
questionId
:
question
.
questionId
,
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
questionName
:
question
.
questionName
,
...
@@ -71,9 +70,29 @@ export class IncomeComponent implements OnInit {
...
@@ -71,9 +70,29 @@ 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
(
question
)
console
.
log
(
questions
)
console
.
log
(
option
)
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
pageAnswers
)
//判断页面需要几个问题
if
(
this
.
type
==
2
||
this
.
type
==
4
){
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/loan'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
return
;
}
}
}
}
questionnaire/src/app/job/job.component.ts
View file @
20edb27f
...
@@ -12,6 +12,7 @@ export class JobComponent implements OnInit {
...
@@ -12,6 +12,7 @@ export class JobComponent implements OnInit {
selectedOptionId
:
any
;
selectedOptionId
:
any
;
type
:
any
;
type
:
any
;
id
:
any
;
id
:
any
;
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -41,12 +42,14 @@ export class JobComponent implements OnInit {
...
@@ -41,12 +42,14 @@ export class JobComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
nextBtn
=
false
;
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
if
(
this
.
id
==
1
){
if
(
this
.
id
==
1
){
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
)
}
}
...
@@ -68,20 +71,31 @@ export class JobComponent implements OnInit {
...
@@ -68,20 +71,31 @@ 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
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
}
// 下一步
// 下一步
next
()
{
next
()
{
//先判断下一步能不能点
//如果是二人世界或是多口之家跳转到配偶页
//如果是二人世界或是多口之家跳转到配偶页
//先判断当前页是您的页还是配偶页
//先判断当前页是您的页还是配偶页
if
(
this
.
id
==
1
){
if
(
this
.
nextBtn
==
true
){
if
(
this
.
type
==
2
||
this
.
type
==
4
){
if
(
this
.
id
==
1
){
this
.
router
.
navigate
([
'/spouse_job'
],{
queryParams
:{
type
:
this
.
type
}})
if
(
this
.
type
==
2
||
this
.
type
==
4
){
this
.
router
.
navigate
([
'/spouse_job'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
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
{
this
.
router
.
navigate
([
'/transit1'
],{
queryParams
:{
type
:
this
.
type
}})
return
;
}
}
}
}
}
}
questionnaire/src/app/loan/loan.component.html
View file @
20edb27f
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
<li
<li
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
>
(
click
)="
selectedLoan
(
this
.
curPageData
?.
questions
[
0
],
options
)"
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
...
@@ -19,14 +20,17 @@
...
@@ -19,14 +20,17 @@
<li
<li
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
>
(
click
)="
selectedLoan
(
this
.
curPageData
?.
questions
[
1
],
options
)"
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"content_footer"
>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
</div>
</div>
</div>
questionnaire/src/app/loan/loan.component.ts
View file @
20edb27f
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"
;
@
Component
({
@
Component
({
selector
:
'app-loan'
,
selector
:
'app-loan'
,
...
@@ -8,19 +9,74 @@ import {CommonService} from '../common.service';
...
@@ -8,19 +9,74 @@ import {CommonService} from '../common.service';
})
})
export
class
LoanComponent
implements
OnInit
{
export
class
LoanComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
hasMate
:
boolean
;
//家庭结构
constructor
(
private
commonService
:
CommonService
)
{
}
type
:
any
;
pageAnswers
:
any
;
selectedOptionId
:
any
;
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
pageAnswers
=
{
pageId
:
''
,
questions
:
[],
};
}
ngOnInit
()
{
ngOnInit
()
{
this
.
nextBtn
=
false
;
this
.
surveyInfo
()
this
.
surveyInfo
()
this
.
hasMate
=
true
;
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'7'
]
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'7'
]
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
console
.
log
(
this
.
curPageData
)
console
.
log
(
this
.
curPageData
)
}
}
})
})
}
}
selectedLoan
(
question
,
option
){
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
true
;
const
questions
=
{
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
options
:
[
option
]
};
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
this
.
pageAnswers
.
questions
.
splice
(
index
,
1
);
}
}
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
console
.
log
(
questions
)
console
.
log
(
this
.
pageAnswers
)
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/social'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
return
}
}
}
}
questionnaire/src/app/social-security/social-security.component.html
View file @
20edb27f
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
<li
<li
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
>
(
click
)=
selectedSocial
(
this
.
curPageData
?.
questions
[
0
],
options
)
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
...
@@ -19,14 +20,17 @@
...
@@ -19,14 +20,17 @@
<li
<li
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
>
(
click
)=
selectedSocial
(
this
.
curPageData
?.
questions
[
1
],
options
)
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"content_footer"
>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
</div>
</div>
</div>
questionnaire/src/app/social-security/social-security.component.ts
View file @
20edb27f
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"
;
@
Component
({
@
Component
({
selector
:
'app-social-security'
,
selector
:
'app-social-security'
,
...
@@ -9,11 +10,37 @@ import {CommonService} from '../common.service';
...
@@ -9,11 +10,37 @@ import {CommonService} from '../common.service';
export
class
SocialSecurityComponent
implements
OnInit
{
export
class
SocialSecurityComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
hasMate
:
boolean
;
hasMate
:
boolean
;
constructor
(
private
commonService
:
CommonService
)
{
}
//家庭结构
type
:
any
;
nextBtn
:
boolean
;
pageAnswers
:
any
;
selectedOptionId
:
any
;
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
/**
* 1:单身贵族
* 2:二人世界
* 3:独立带娃
* 4:多口之家
* @type {any}
*/
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
pageAnswers
=
{
pageId
:
''
,
questions
:
[],
};
}
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
()
this
.
surveyInfo
()
this
.
hasMate
=
true
;
//判断家庭决定是否显示配偶
if
(
this
.
type
==
2
||
this
.
type
==
4
){
this
.
hasMate
=
true
;
}
else
{
this
.
hasMate
=
false
;
}
this
.
nextBtn
=
false
;
}
}
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
...
@@ -23,4 +50,44 @@ export class SocialSecurityComponent implements OnInit {
...
@@ -23,4 +50,44 @@ export class SocialSecurityComponent implements OnInit {
}
}
})
})
}
}
selectedSocial
(
question
,
option
){
this
.
selectedOptionId
=
option
.
optionId
;
option
.
selected
=
true
;
const
questions
=
{
questionId
:
question
.
questionId
,
questionName
:
question
.
questionName
,
options
:
[
option
]
};
for
(
let
i
=
0
;
i
<
this
.
pageAnswers
.
questions
.
length
;
i
++
)
{
if
(
this
.
pageAnswers
.
questions
[
i
].
questionId
==
question
.
questionId
)
{
const
index
=
this
.
pageAnswers
.
questions
.
indexOf
(
this
.
pageAnswers
.
questions
[
i
]);
this
.
pageAnswers
.
questions
.
splice
(
index
,
1
);
}
}
this
.
pageAnswers
.
questions
.
push
(
questions
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
//判断页面需要几个问题
if
(
this
.
type
==
2
||
this
.
type
==
4
){
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
[
'questions'
].
length
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/transit2'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
return
;
}
}
}
}
questionnaire/src/app/transit2/transit2.component.html
View file @
20edb27f
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
</div>
</div>
<div
class=
"content_footer"
>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
</div>
questionnaire/src/app/transit2/transit2.component.ts
View file @
20edb27f
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
@
Component
({
@
Component
({
selector
:
'app-transit2'
,
selector
:
'app-transit2'
,
...
@@ -6,10 +7,18 @@ import { Component, OnInit } from '@angular/core';
...
@@ -6,10 +7,18 @@ import { Component, OnInit } from '@angular/core';
styleUrls
:
[
'./transit2.component.css'
]
styleUrls
:
[
'./transit2.component.css'
]
})
})
export
class
Transit2Component
implements
OnInit
{
export
class
Transit2Component
implements
OnInit
{
//家庭结构
constructor
()
{
}
type
:
any
;
constructor
(
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
}
ngOnInit
()
{
ngOnInit
()
{
}
}
next
(){
this
.
router
.
navigate
([
'/health'
],{
queryParams
:{
type
:
this
.
type
}})
}
}
}
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