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
869fa4ce
Commit
869fa4ce
authored
May 22, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
健康
parent
fa4d8075
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
42 deletions
+108
-42
questionnaire/src/app/children-health/children-health.component.html
+2
-2
questionnaire/src/app/children-health/children-health.component.ts
+36
-3
questionnaire/src/app/health/health.component.html
+1
-1
questionnaire/src/app/health/health.component.ts
+52
-22
questionnaire/src/app/loan/loan.component.ts
+17
-14
No files found.
questionnaire/src/app/children-health/children-health.component.html
View file @
869fa4ce
...
@@ -8,14 +8,14 @@
...
@@ -8,14 +8,14 @@
<li
<li
class=
"selected"
class=
"selected"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
(
click
)="
selectedHealth
(
options
)"
>
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
(
click
)="
selectedHealth
(
options
,
false
)"
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
</div>
</div>
<div
class=
"content_footer"
>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
(
click
)="
before
()"
>
<
</div>
<div
style=
"color: #8a8a8a;"
(
click
)="
before
()"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
</div>
</div>
</div>
questionnaire/src/app/children-health/children-health.component.ts
View file @
869fa4ce
...
@@ -23,6 +23,7 @@ export class ChildrenHealthComponent implements OnInit {
...
@@ -23,6 +23,7 @@ export class ChildrenHealthComponent implements OnInit {
// 暂存多个孩子的答案
// 暂存多个孩子的答案
childTotalQuestions
:
Array
<
any
>
=
[];
childTotalQuestions
:
Array
<
any
>
=
[];
nextBtn
:
boolean
=
false
;
nextBtn
:
boolean
=
false
;
lastQuestions
:
Array
<
any
>
;
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
...
@@ -51,9 +52,12 @@ export class ChildrenHealthComponent implements OnInit {
...
@@ -51,9 +52,12 @@ export class ChildrenHealthComponent implements OnInit {
}
}
// 选择健康情况(多选)
// 选择健康情况(多选)
selectedHealth
(
option
)
{
selectedHealth
(
option
,
lastFlag
)
{
// debugger;
if
(
lastFlag
===
false
)
{
option
[
'selected'
]
=
!
option
[
'selected'
];
}
this
.
id
=
this
.
route
.
snapshot
.
params
[
'childId'
];
this
.
id
=
this
.
route
.
snapshot
.
params
[
'childId'
];
option
[
'selected'
]
=
!
option
[
'selected'
];
this
.
questions
=
[];
this
.
questions
=
[];
this
.
getOptions
(
99
,
option
);
this
.
getOptions
(
99
,
option
);
const
questions
=
{
const
questions
=
{
...
@@ -106,7 +110,36 @@ export class ChildrenHealthComponent implements OnInit {
...
@@ -106,7 +110,36 @@ export class ChildrenHealthComponent implements OnInit {
surveyInfo
()
{
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'12'
]
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'12'
];
// debugger;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
13
).
pop
();
console
.
log
(
this
.
lastQuestions
)
if
(
this
.
lastQuestions
)
{
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)
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionSubId
==
this
.
curPageData
[
'questions'
][
j
].
questionSubId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
const
targetObj
=
option
;
this
.
curPageData
[
'questions'
][
j
][
'options'
].
forEach
(
option
=>
{
if
(
targetObj
[
'optionId'
]
==
option
[
'optionId'
])
{
this
.
curPageData
[
'questions'
][
j
][
'options'
][
this
.
curPageData
[
'questions'
][
j
][
'options'
].
indexOf
(
option
)]
=
targetObj
;
}
});
this
.
selectedHealth
(
targetObj
,
true
);
// console.log(this.targetObj);
}
});
}
}
}
}
}
console
.
log
(
this
.
curPageData
)
console
.
log
(
this
.
curPageData
)
}
}
})
})
...
...
questionnaire/src/app/health/health.component.html
View file @
869fa4ce
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<ul
class=
"jobContent"
>
<ul
class=
"jobContent"
>
<li
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
<li
*
ngFor=
"let options of this.curPageData?.questions[0]['options']"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
(
click
)="
selectedHealth
(
options
)"
>
(
click
)="
selectedHealth
(
options
,
false
)"
>
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
...
...
questionnaire/src/app/health/health.component.ts
View file @
869fa4ce
...
@@ -20,7 +20,7 @@ export class HealthComponent implements OnInit {
...
@@ -20,7 +20,7 @@ export class HealthComponent implements OnInit {
questions
:
Array
<
any
>
=
[];
questions
:
Array
<
any
>
=
[];
nextBtn
:
boolean
=
false
;
nextBtn
:
boolean
=
false
;
lastQuestions
:
Array
<
any
>
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -44,12 +44,12 @@ export class HealthComponent implements OnInit {
...
@@ -44,12 +44,12 @@ export class HealthComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
if
(
this
.
id
==
1
)
{
if
(
this
.
id
==
1
)
{
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
11
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
11
).
pop
();
}
else
{
}
else
{
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
12
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
12
).
pop
();
}
}
this
.
surveyInfo
();
this
.
surveyInfo
();
}
}
...
@@ -58,36 +58,65 @@ export class HealthComponent implements OnInit {
...
@@ -58,36 +58,65 @@ export class HealthComponent implements OnInit {
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
if
(
this
.
id
==
1
)
{
if
(
this
.
id
==
1
)
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'10'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'10'
];
if
(
this
.
lastQuestions
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
// console.log(this.lastQuestions)
console
.
log
(
this
.
lastQuestions
)
// console.log(this.curPageData)
console
.
log
(
this
.
curPageData
)
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
const
targetObj
=
option
;
this
.
targetObj
=
option
this
.
curPageData
[
'questions'
][
j
][
'options'
].
forEach
(
option
=>
{
console
.
log
(
this
.
targetObj
)
if
(
targetObj
[
'optionId'
]
==
option
[
'optionId'
])
{
}
this
.
curPageData
[
'questions'
][
j
][
'options'
][
this
.
curPageData
[
'questions'
][
j
][
'options'
].
indexOf
(
option
)]
=
targetObj
;
// this.selectedHealth(this.targetObj);
}
});
});
this
.
selectedHealth
(
targetObj
,
true
);
// console.log(this.targetObj);
}
});
}
}
}
}
}
}
}
}
else
{
}
else
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'11'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'11'
];
if
(
this
.
lastQuestions
)
{
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
)
{
const
targetObj
=
option
;
this
.
curPageData
[
'questions'
][
j
][
'options'
].
forEach
(
option
=>
{
if
(
targetObj
[
'optionId'
]
==
option
[
'optionId'
])
{
this
.
curPageData
[
'questions'
][
j
][
'options'
][
this
.
curPageData
[
'questions'
][
j
][
'options'
].
indexOf
(
option
)]
=
targetObj
;
}
});
this
.
selectedHealth
(
targetObj
,
true
);
// console.log(this.targetObj);
}
});
}
}
}
}
}
}
}
}
})
})
}
}
// 选择健康情况(多选)
// 选择健康情况(多选)
selectedHealth
(
option
)
{
selectedHealth
(
option
,
lastFlag
)
{
option
[
'selected'
]
=
!
option
[
'selected'
];
if
(
lastFlag
===
false
)
{
option
[
'selected'
]
=
!
option
[
'selected'
];
}
this
.
questions
=
[];
this
.
questions
=
[];
console
.
log
(
option
)
if
(
this
.
id
==
1
)
{
if
(
this
.
id
==
1
)
{
this
.
getOptions
(
67
,
option
);
this
.
getOptions
(
67
,
option
);
}
else
if
(
this
.
id
==
2
)
{
}
else
if
(
this
.
id
==
2
)
{
...
@@ -101,6 +130,7 @@ export class HealthComponent implements OnInit {
...
@@ -101,6 +130,7 @@ export class HealthComponent implements OnInit {
options
:
this
.
questions
options
:
this
.
questions
}],
}],
};
};
console
.
log
(
this
.
pageAnswers
)
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
curPageData
[
'questions'
].
length
==
this
.
pageAnswers
.
questions
.
length
)
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
if
(
this
.
pageAnswers
.
questions
.
every
(
item
=>
item
.
options
.
length
>
0
))
{
...
...
questionnaire/src/app/loan/loan.component.ts
View file @
869fa4ce
...
@@ -14,7 +14,8 @@ export class LoanComponent implements OnInit {
...
@@ -14,7 +14,8 @@ export class LoanComponent implements OnInit {
pageAnswers
:
any
;
pageAnswers
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
lastQuestions
:
Array
<
any
>
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -34,7 +35,7 @@ export class LoanComponent implements OnInit {
...
@@ -34,7 +35,7 @@ export class LoanComponent implements OnInit {
ngOnInit
()
{
ngOnInit
()
{
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
8
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
8
).
pop
();
this
.
surveyInfo
();
this
.
surveyInfo
();
}
}
...
@@ -43,22 +44,24 @@ export class LoanComponent implements OnInit {
...
@@ -43,22 +44,24 @@ export class LoanComponent implements OnInit {
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'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
if
(
this
.
lastQuestions
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
this
.
targetObj
=
option
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
}
this
.
targetObj
=
option
this
.
selectedLoan
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
}
this
.
selectedLoan
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
});
});
}
}
}
}
}
}
}
}
}
console
.
log
(
this
.
pageAnswers
)
//
console.log(this.pageAnswers)
console
.
log
(
this
.
commonService
.
todos
)
//
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