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
afd125a8
Commit
afd125a8
authored
May 21, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
疾病吸烟居住
parent
b43aad5c
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
247 additions
and
18 deletions
+247
-18
questionnaire/src/app/disease/disease.component.html
+3
-3
questionnaire/src/app/disease/disease.component.ts
+54
-4
questionnaire/src/app/live/live.component.html
+2
-1
questionnaire/src/app/live/live.component.ts
+49
-2
questionnaire/src/app/smoking/smoking.component.html
+4
-2
questionnaire/src/app/smoking/smoking.component.ts
+131
-4
questionnaire/src/app/transit3/transit3.component.html
+1
-1
questionnaire/src/app/transit3/transit3.component.ts
+3
-1
No files found.
questionnaire/src/app/disease/disease.component.html
View file @
afd125a8
...
...
@@ -7,8 +7,8 @@
<ul
class=
"jobContent"
>
<li
*
ngFor=
"let options of this.options"
[
ngClass
]="{
selected:
selectedOptionId =
=
options
.
optionId
}"
(
click
)="
getAnswer
(
options
)"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
(
click
)="
checkFun
(
options
)"
>
{{ options.optionName }}
</li>
...
...
@@ -17,7 +17,7 @@
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
(
click
)="
next
()"
>
下一步
</div>
</div>
</div>
</div>
questionnaire/src/app/disease/disease.component.ts
View file @
afd125a8
...
...
@@ -14,6 +14,7 @@ export class DiseaseComponent implements OnInit {
nextBtn
:
boolean
;
options
:
Array
<
any
>
;
selectedOptionId
:
any
;
questions
:
Array
<
any
>
=
[];
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
...
...
@@ -74,9 +75,14 @@ export class DiseaseComponent implements OnInit {
})
}
getAnswer
(
option
){
// console.log(options)
this
.
selectedOptionId
=
option
.
optionId
;
getOneAnswer
(
option
){
for
(
let
i
=
0
;
i
<
this
.
options
.
length
;
i
++
){
if
(
option
[
'optionId'
]
==
this
.
options
[
i
][
'optionId'
]){
this
.
options
[
i
][
'selected'
]
=
true
;
}
else
{
this
.
options
[
i
][
'selected'
]
=
false
;
}
}
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:[{
...
...
@@ -93,10 +99,54 @@ export class DiseaseComponent implements OnInit {
this
.
nextBtn
=
false
}
}
getManyAnswer
(
option
){
option
[
'selected'
]
=
!
option
[
'selected'
];
this
.
questions
=
[];
for
(
let
i
=
0
;
i
<
this
.
curPageData
[
'questions'
][
0
][
'options'
].
length
;
i
++
)
{
if
(
option
.
optionId
==
111
&&
option
[
'selected'
])
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
false
;
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'optionId'
]
==
111
)
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
true
;
}
}
else
{
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'optionId'
]
==
111
)
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
false
;
}
}
// 拿到所有selected为true的选项
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
])
{
this
.
questions
.
push
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
]);
}
}
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:
[{
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionName'
],
options
:
this
.
questions
}],
};
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
}
else
{
this
.
nextBtn
=
false
}
console
.
log
(
this
.
pageAnswers
)
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
}
//根据type区分单选多选
checkFun
(
option
){
if
(
this
.
type
==
1
){
this
.
getOneAnswer
(
option
)
}
else
{
this
.
getManyAnswer
(
option
)
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/smoke'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
return
}
}
}
questionnaire/src/app/live/live.component.html
View file @
afd125a8
...
...
@@ -19,7 +19,8 @@
</div>
<div
class=
"content_footer"
>
<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
class=
"toastWrapper toast"
*
ngIf=
"isShow"
(
click
)="
closeToast
();"
>
...
...
questionnaire/src/app/live/live.component.ts
View file @
afd125a8
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../common.service'
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
@
Component
({
selector
:
'app-live'
,
...
...
@@ -19,12 +20,28 @@ export class LiveComponent implements OnInit {
address
:
Object
//页面地址
strAddress
:
string
pageAnswers
:
any
;
type
:
any
;
nextBtn
:
boolean
;
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
()
{
this
.
surveyInfo
()
this
.
nextBtn
=
false
;
this
.
showAddress
=
false
;
}
surveyInfo
()
{
...
...
@@ -50,6 +67,13 @@ export class LiveComponent implements OnInit {
// console.log(this.selectedProvinceObj)
this
.
provinceName
=
option
.
provinceName
this
.
provinceId
=
option
.
provinceId
for
(
let
i
=
0
;
i
<
this
.
provinceList
.
length
;
i
++
){
if
(
option
[
'provinceId'
]
==
this
.
provinceList
[
i
][
'provinceId'
]){
this
.
provinceList
[
i
][
'selected'
]
=
true
;
}
else
{
this
.
provinceList
[
i
][
'selected'
]
=
false
;
}
}
this
.
getCityqry
()
}
closeToast
()
{
...
...
@@ -75,5 +99,28 @@ export class LiveComponent implements OnInit {
this
.
address
=
{
customerInput
:
this
.
provinceName
+
','
+
e
.
cityName
}
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:
[{
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionName'
],
options
:
[
this
.
address
]
}],
};
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
)
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
}
else
{
this
.
nextBtn
=
false
}
console
.
log
(
this
.
pageAnswers
)
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/transit3'
])
}
else
{
return
;
}
}
}
questionnaire/src/app/smoking/smoking.component.html
View file @
afd125a8
...
...
@@ -6,8 +6,9 @@
</div>
<ul
class=
"jobContent"
>
<li
*
ngFor=
"let options of this.
curPageData?.questions[0]['options']
"
*
ngFor=
"let options of this.
options
"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
(
click
)="
checkFun
(
options
)"
>
{{ options.optionName }}
</li>
...
...
@@ -15,7 +16,8 @@
</div>
<div
class=
"content_footer"
>
<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>
questionnaire/src/app/smoking/smoking.component.ts
View file @
afd125a8
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../common.service'
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
@
Component
({
selector
:
'app-smoking'
,
...
...
@@ -8,20 +9,146 @@ import {CommonService} from '../common.service';
})
export
class
SmokingComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
constructor
(
private
commonService
:
CommonService
type
:
any
;
nextBtn
:
boolean
;
pageAnswers
:
any
;
options
:
Array
<
any
>
;
questions
:
Array
<
any
>
=
[];
)
{
}
constructor
(
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
()
{
this
.
nextBtn
=
false
;
this
.
surveyInfo
()
}
surveyInfo
()
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'14'
]
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
==
112
||
option
.
optionId
==
113
})
}
if
(
this
.
type
==
2
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
114
||
option
.
optionId
==
115
||
option
.
optionId
==
117
})
}
if
(
this
.
type
==
3
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
114
||
option
.
optionId
==
116
||
option
.
optionId
==
117
})
}
if
(
this
.
type
==
4
){
this
.
options
=
this
.
curPageData
[
'questions'
][
'0'
][
'options'
]
this
.
options
=
this
.
options
.
filter
(
option
=>
{
return
option
.
optionId
==
114
||
option
.
optionId
==
115
||
option
.
optionId
==
116
||
option
.
optionId
==
117
})
}
}
})
}
getOneAnswer
(
option
){
for
(
let
i
=
0
;
i
<
this
.
options
.
length
;
i
++
){
if
(
option
[
'optionId'
]
==
this
.
options
[
i
][
'optionId'
]){
this
.
options
[
i
][
'selected'
]
=
true
;
}
else
{
this
.
options
[
i
][
'selected'
]
=
false
;
}
}
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
}
}
getManyAnswer
(
option
){
option
[
'selected'
]
=
!
option
[
'selected'
];
this
.
questions
=
[];
for
(
let
i
=
0
;
i
<
this
.
curPageData
[
'questions'
][
0
][
'options'
].
length
;
i
++
)
{
if
(
option
.
optionId
==
117
&&
option
[
'selected'
])
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
false
;
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'optionId'
]
==
117
)
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
true
;
}
}
else
{
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'optionId'
]
==
117
)
{
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
]
=
false
;
}
}
// 拿到所有selected为true的选项
if
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
][
'selected'
])
{
this
.
questions
.
push
(
this
.
curPageData
[
'questions'
][
0
][
'options'
][
i
]);
}
}
this
.
pageAnswers
=
{
pageId
:
this
.
curPageData
[
'pageId'
],
questions
:
[{
questionId
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionId'
],
questionName
:
this
.
curPageData
[
'questions'
][
'0'
][
'questionName'
],
options
:
this
.
questions
}],
};
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
){
this
.
nextBtn
=
true
}
else
{
this
.
nextBtn
=
false
}
console
.
log
(
this
.
pageAnswers
)
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
}
checkFun
(
option
){
if
(
this
.
type
==
1
){
this
.
getOneAnswer
(
option
)
}
else
{
this
.
getManyAnswer
(
option
)
}
}
next
(){
if
(
this
.
nextBtn
==
true
){
this
.
router
.
navigate
([
'/live'
],{
queryParams
:{
type
:
this
.
type
}})
}
else
{
return
;
}
}
}
questionnaire/src/app/transit3/transit3.component.html
View file @
afd125a8
...
...
@@ -3,6 +3,6 @@
<img
src=
"assets/images/bg_17.png"
/>
</div>
<div
class=
"footer"
style=
"margin-top: 10%;"
(
click
)="
getHref
()"
>
<div>
我知道了
</div>
<div
(
click
)="
getHref
()"
>
我知道了
</div>
</div>
</div>
questionnaire/src/app/transit3/transit3.component.ts
View file @
afd125a8
...
...
@@ -11,5 +11,7 @@ export class Transit3Component implements OnInit {
ngOnInit
()
{
}
getHref
(){
window
.
location
.
href
=
'https://'
+
window
.
location
.
host
+
'/member'
}
}
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