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
5a751580
Commit
5a751580
authored
May 21, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下一步的问题
parent
e2da9242
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
24 deletions
+60
-24
questionnaire/src/app/age/age.component.ts
+1
-1
questionnaire/src/app/children-health/children-health.component.ts
+17
-7
questionnaire/src/app/disease/disease.component.ts
+14
-6
questionnaire/src/app/health/health.component.ts
+16
-6
questionnaire/src/app/smoking/smoking.component.ts
+12
-4
No files found.
questionnaire/src/app/age/age.component.ts
View file @
5a751580
...
...
@@ -97,7 +97,7 @@ export class AgeComponent implements OnInit {
// console.log(this.curPageData);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
closeToast
();
console
.
log
(
this
.
pageAnswers
);
//
console.log(this.pageAnswers);
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
this
.
nextBtn
=
true
;
}
else
{
...
...
questionnaire/src/app/children-health/children-health.component.ts
View file @
5a751580
...
...
@@ -22,6 +22,7 @@ export class ChildrenHealthComponent implements OnInit {
childTotalCount
:
any
;
// 暂存多个孩子的答案
childTotalQuestions
:
Array
<
any
>
=
[];
nextBtn
:
boolean
=
false
;
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
...
...
@@ -35,7 +36,6 @@ export class ChildrenHealthComponent implements OnInit {
*/
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
id
=
this
.
route
.
snapshot
.
params
[
'childId'
];
this
.
childTotalCount
=
this
.
route
.
snapshot
.
queryParams
[
'childTotalCount'
];
this
.
pageAnswers
=
{
pageId
:
''
,
questions
:
[{
...
...
@@ -73,6 +73,17 @@ export class ChildrenHealthComponent implements OnInit {
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:
this
.
childTotalQuestions
,
};
// console.log(this.pageAnswers);
// console.log(this.curPageData)
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
;
}
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
}
...
...
@@ -107,16 +118,15 @@ export class ChildrenHealthComponent implements OnInit {
// 下一步
next
()
{
if
(
this
.
pageAnswers
.
questions
[
0
].
options
.
every
((
item
)
=>
{
return
item
.
selected
;
})
)
{
const
age
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
3
).
pop
();
this
.
childTotalCount
=
age
[
'questions'
].
filter
(
item
=>
item
.
questionId
==
4
).
length
;
if
(
this
.
nextBtn
)
{
this
.
id
=
this
.
route
.
snapshot
.
params
[
'childId'
];
// 查看有几个孩子,一个直接跳到疾病页,多个跳多个孩子页
if
(
this
.
id
<
this
.
childTotalCount
)
{
if
(
this
.
id
<
parseInt
(
this
.
childTotalCount
,
0
)
)
{
this
.
router
.
navigate
([
'/children_health'
,
parseInt
(
this
.
id
,
0
)
+
1
],
{
queryParams
:
{
type
:
this
.
type
,
childTotalCount
:
this
.
childTotalCount
type
:
this
.
type
}
});
this
.
surveyInfo
();
...
...
questionnaire/src/app/disease/disease.component.ts
View file @
5a751580
...
...
@@ -92,10 +92,14 @@ export class DiseaseComponent implements OnInit {
}
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
)
// console.log(this.pageAnswers)
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
this
.
nextBtn
=
false
;
}
}
...
...
@@ -126,10 +130,14 @@ export class DiseaseComponent implements OnInit {
options
:
this
.
questions
}],
};
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
this
.
nextBtn
=
false
;
}
// console.log(this.pageAnswers)
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
...
...
questionnaire/src/app/health/health.component.ts
View file @
5a751580
...
...
@@ -77,10 +77,12 @@ export class HealthComponent implements OnInit {
}],
};
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
if
(
this
.
pageAnswers
.
questions
[
0
].
options
.
every
((
item
)
=>
{
return
item
.
selected
;
}))
{
this
.
nextBtn
=
true
;
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
;
}
...
...
@@ -115,7 +117,11 @@ export class HealthComponent implements OnInit {
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
this
.
router
.
navigate
([
'/spouse_health'
],
{
queryParams
:
{
type
:
this
.
type
}});
}
else
if
(
this
.
type
==
3
)
{
this
.
router
.
navigate
([
'/children_health'
,
1
],
{
queryParams
:
{
type
:
this
.
type
}});
this
.
router
.
navigate
([
'/children_health'
,
1
],
{
queryParams
:
{
type
:
this
.
type
}
});
}
else
if
(
this
.
type
==
1
)
{
this
.
router
.
navigate
([
'/disease'
],
{
queryParams
:
{
type
:
this
.
type
}});
}
...
...
@@ -123,7 +129,11 @@ export class HealthComponent implements OnInit {
if
(
this
.
type
==
1
||
this
.
type
==
2
)
{
this
.
router
.
navigate
([
'/disease'
],
{
queryParams
:
{
type
:
this
.
type
}});
}
else
if
(
this
.
type
==
3
||
this
.
type
==
4
)
{
this
.
router
.
navigate
([
'/children_health'
,
1
],
{
queryParams
:
{
type
:
this
.
type
}});
this
.
router
.
navigate
([
'/children_health'
,
1
],
{
queryParams
:
{
type
:
this
.
type
}
});
}
else
{
this
.
router
.
navigate
([
'/disease'
],
{
queryParams
:
{
type
:
this
.
type
}});
}
...
...
questionnaire/src/app/smoking/smoking.component.ts
View file @
5a751580
...
...
@@ -92,8 +92,12 @@ export class SmokingComponent implements OnInit {
}
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
// console.log(this.pageAnswers);
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
;
}
...
...
@@ -126,8 +130,12 @@ export class SmokingComponent implements OnInit {
options
:
this
.
questions
}],
};
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
else
{
this
.
nextBtn
=
false
;
}
...
...
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