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
d2f1cc40
Commit
d2f1cc40
authored
May 22, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多选记住上一步答案
parent
de9334f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
5 deletions
+45
-5
questionnaire/src/app/health/health.component.ts
+27
-2
questionnaire/src/app/loan/loan.component.ts
+18
-3
No files found.
questionnaire/src/app/health/health.component.ts
View file @
d2f1cc40
...
...
@@ -19,7 +19,8 @@ export class HealthComponent implements OnInit {
// 暂存健康状况
questions
:
Array
<
any
>
=
[];
nextBtn
:
boolean
=
false
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
...
...
@@ -43,6 +44,12 @@ export class HealthComponent implements OnInit {
}
ngOnInit
()
{
if
(
this
.
id
==
1
){
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
11
).
pop
();
}
else
{
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
12
).
pop
();
}
this
.
surveyInfo
();
}
...
...
@@ -51,10 +58,27 @@ export class HealthComponent implements OnInit {
if
(
res
[
'success'
])
{
if
(
this
.
id
==
1
)
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'10'
];
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
console
.
log
(
this
.
lastQuestions
)
console
.
log
(
this
.
curPageData
)
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
console
.
log
(
this
.
targetObj
)
}
// this.selectedHealth(this.targetObj);
});
}
}
}
}
else
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'11'
];
}
// console.log(this.curPageData)
}
})
}
...
...
@@ -63,6 +87,7 @@ export class HealthComponent implements OnInit {
selectedHealth
(
option
)
{
option
[
'selected'
]
=
!
option
[
'selected'
];
this
.
questions
=
[];
console
.
log
(
option
)
if
(
this
.
id
==
1
)
{
this
.
getOptions
(
67
,
option
);
}
else
if
(
this
.
id
==
2
)
{
...
...
questionnaire/src/app/loan/loan.component.ts
View file @
d2f1cc40
...
...
@@ -13,7 +13,8 @@ export class LoanComponent implements OnInit {
type
:
any
;
pageAnswers
:
any
;
nextBtn
:
boolean
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
...
...
@@ -33,8 +34,8 @@ export class LoanComponent implements OnInit {
ngOnInit
()
{
this
.
nextBtn
=
false
;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
8
).
pop
();
this
.
surveyInfo
();
}
surveyInfo
()
{
...
...
@@ -42,8 +43,22 @@ export class LoanComponent implements OnInit {
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'7'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
// console.log(this.curPageData);
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
}
this
.
selectedLoan
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
});
}
}
}
}
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
commonService
.
todos
)
})
}
...
...
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