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
3c675c72
Commit
3c675c72
authored
May 14, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
citySave
parent
6e850088
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
91 deletions
+119
-91
questionnair/src/app/ask/ask.component.ts
+49
-20
questionnair/src/app/page16/page16.component.html
+10
-9
questionnair/src/app/page16/page16.component.ts
+28
-29
questionnair/src/app/page4/page4.component.ts
+13
-13
questionnair/src/app/page5/page5.component.ts
+13
-13
questionnair/src/app/page7/page7.component.ts
+2
-3
questionnair/src/app/page8/page8.component.ts
+3
-3
questionnair/src/app/page9/page9.component.ts
+1
-1
No files found.
questionnair/src/app/ask/ask.component.ts
View file @
3c675c72
...
...
@@ -43,7 +43,37 @@ export class AskComponent implements OnInit {
})
}
reducePage
()
{
console
.
log
(
'start'
,
this
.
curPage
)
if
(
this
.
curPage
>
0
)
{
const
page2Answer
=
this
.
allAnswers
[
1
]
const
optionId
=
page2Answer
.
questions
[
0
].
options
[
0
].
optionId
if
(
this
.
curPage
==
5
||
this
.
curPage
==
6
)
{
if
(
optionId
==
1
||
optionId
==
3
)
{
this
.
curPage
=
this
.
curPage
-
2
this
.
setCurPageData
()
return
}
}
if
(
this
.
curPage
==
13
)
{
if
(
optionId
==
1
)
{
this
.
curPage
=
this
.
curPage
-
3
this
.
setCurPageData
()
return
}
if
(
optionId
==
2
)
{
this
.
curPage
=
this
.
curPage
-
2
this
.
setCurPageData
()
return
}
}
if
(
this
.
curPage
==
12
)
{
if
(
optionId
==
3
)
{
this
.
curPage
=
this
.
curPage
-
2
this
.
setCurPageData
()
return
}
}
this
.
curPage
--
this
.
setCurPageData
()
}
else
{
...
...
@@ -51,8 +81,8 @@ export class AskComponent implements OnInit {
}
}
filterItems
()
{
return
this
.
allAnswers
.
filter
(
item
=>
{
return
item
!=
null
return
this
.
allAnswers
.
filter
(
item
=>
{
return
item
!=
null
})
}
addPage
()
{
...
...
@@ -71,14 +101,14 @@ export class AskComponent implements OnInit {
return
}
const
answerParam
=
{
"survey"
:
{
"customerId"
:
20
,
"orderId"
:
9999996
,
"pages"
:
this
.
filterItems
()
survey
:
{
customerId
:
20
,
orderId
:
9999996
,
pages
:
this
.
filterItems
()
}
}
console
.
log
(
answerParam
)
if
(
this
.
curPage
==
16
)
{
if
(
this
.
curPage
==
16
)
{
this
.
commonService
.
saveCustomerAnwers
(
answerParam
).
then
(
res
=>
{
console
.
log
(
res
)
})
...
...
@@ -124,8 +154,8 @@ export class AskComponent implements OnInit {
this
.
allQues
[
this
.
curPage
]
)
}
if
(
this
.
curPage
==
14
)
{
this
.
filterPage15
(
if
(
this
.
curPage
==
14
)
{
this
.
filterPage15
(
page2Answer
.
questions
[
0
].
options
[
0
].
optionId
,
this
.
allQues
[
this
.
curPage
]
)
...
...
@@ -212,7 +242,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
1
,
optionType
:
1
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
option
.
optionId
==
106
||
option
.
optionId
==
107
})
...
...
@@ -226,7 +256,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
108
||
...
...
@@ -244,7 +274,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
108
||
...
...
@@ -262,7 +292,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
108
||
...
...
@@ -278,8 +308,8 @@ export class AskComponent implements OnInit {
}
//判断是否吸烟option内容
filterPage15
(
optionId
,
thePateData
)
{
//如果单身或者单亲选择相中没有配偶选项
filterPage15
(
optionId
,
thePateData
)
{
//如果单身或者单亲选择相中没有配偶选项
//传一个optionType告诉子页面是单选还是多选1表示单选2表示多选
if
(
optionId
==
1
)
{
this
.
curPageData
=
{
...
...
@@ -287,7 +317,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
1
,
optionType
:
1
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
option
.
optionId
==
112
||
option
.
optionId
==
113
})
...
...
@@ -301,7 +331,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
114
||
...
...
@@ -319,7 +349,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
114
||
...
...
@@ -337,7 +367,7 @@ export class AskComponent implements OnInit {
questions
:
[
{
...
thePateData
.
questions
[
0
],
optionType
:
2
,
optionType
:
2
,
options
:
thePateData
.
questions
[
0
][
'options'
].
filter
(
option
=>
{
return
(
option
.
optionId
==
114
||
...
...
@@ -351,5 +381,4 @@ export class AskComponent implements OnInit {
}
}
}
}
questionnair/src/app/page16/page16.component.html
View file @
3c675c72
...
...
@@ -5,15 +5,16 @@
{{ this.curPageData['questions'][0]['questionName'] }}
</div>
<ul
class=
"cityContent"
>
<li
<li
*
ngFor=
"let provinces of this.provinceList"
[
ngClass
]="{
selected:
provinces
['
selected
']
==
true
}"
(
click
)="
showToast
();
selectProvince
(
provinces
)"
>
(
click
)="
showToast
();
selectProvince
(
provinces
)"
>
{{ provinces.provinceAbbr }}
</li>
</ul>
<div
class=
"address"
*
ngIf=
"this.showAddress"
>
{{
this.strAddress
}}
{{
this.strAddress
}}
</div>
</div>
</div>
...
...
@@ -21,14 +22,14 @@
<div
class=
"toastContent city"
>
<div
class=
"live"
>
所在地区
</div>
<div
class=
"province"
>
<span>
{{
this.provinceName
}}
</span>
<span>
{{
this.provinceName
}}
</span>
</div>
<ul
class=
"city"
>
<li
*
ngFor=
"let city of this.cityList"
(
click
)="
closeToast
();
selectCity
(
city
);
getAnswer
(
city
)"
>
{{
city.cityName
}}
<li
*
ngFor=
"let city of this.cityList"
(
click
)="
closeToast
();
selectCity
(
city
);
getAnswer
(
city
)"
>
{{
city.cityName
}}
</li>
</ul>
</div>
...
...
questionnair/src/app/page16/page16.component.ts
View file @
3c675c72
...
...
@@ -14,34 +14,34 @@ export class Page16Component implements OnInit {
isShow
:
boolean
cityList
:
Array
<
any
>
provinceId
:
number
provinceName
:
string
;
provinceName
:
string
//具体地址显示
showAddress
:
boolean
;
address
:
Object
;
selectedProvinceObj
:
Object
;
selectedCityObj
:
Object
;
strAddress
:
string
;
showAddress
:
boolean
address
:
Object
selectedProvinceObj
:
Object
selectedCityObj
:
Object
strAddress
:
string
constructor
(
private
commonService
:
CommonService
)
{}
ngOnInit
()
{
this
.
selectedProvinceObj
=
{}
this
.
selectedCityObj
=
{}
console
.
log
(
this
.
curPageData
)
this
.
showAddress
=
false
;
this
.
showAddress
=
false
this
.
setOptionSelected
()
}
showToast
()
{
this
.
isShow
=
true
}
selectProvince
(
option
){
if
(
!
this
.
selectedProvinceObj
[
'selected'
])
{
selectProvince
(
option
)
{
if
(
!
this
.
selectedProvinceObj
[
'selected'
])
{
this
.
selectedProvinceObj
=
option
option
[
'selected'
]
=
true
;
}
else
{
if
(
this
.
selectedProvinceObj
[
'provinceId'
]
!=
option
.
provinceId
)
{
this
.
selectedProvinceObj
[
'selected'
]
=
false
;
option
[
'selected'
]
=
true
;
option
[
'selected'
]
=
true
}
else
{
if
(
this
.
selectedProvinceObj
[
'provinceId'
]
!=
option
.
provinceId
)
{
this
.
selectedProvinceObj
[
'selected'
]
=
false
option
[
'selected'
]
=
true
this
.
selectedProvinceObj
=
option
}
}
...
...
@@ -67,22 +67,22 @@ export class Page16Component implements OnInit {
})
}
selectCity
(
e
){
this
.
showAddress
=
true
;
selectCity
(
e
)
{
this
.
showAddress
=
true
this
.
strAddress
=
this
.
provinceName
+
e
.
cityName
this
.
address
=
{
'customerInput'
:
this
.
provinceName
+
','
+
e
.
cityName
customerInput
:
this
.
provinceName
+
','
+
e
.
cityName
}
}
getAnswer
(
option
)
{
if
(
!
this
.
selectedCityObj
[
'selected'
])
{
if
(
!
this
.
selectedCityObj
[
'selected'
])
{
this
.
selectedCityObj
=
option
option
[
'selected'
]
=
true
;
}
else
{
if
(
this
.
selectedCityObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedCityObj
[
'selected'
]
=
false
;
option
[
'selected'
]
=
true
;
option
[
'selected'
]
=
true
}
else
{
if
(
this
.
selectedCityObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedCityObj
[
'selected'
]
=
false
option
[
'selected'
]
=
true
this
.
selectedCityObj
=
option
}
}
...
...
@@ -105,11 +105,10 @@ export class Page16Component implements OnInit {
if
(
!
options
)
{
return
}
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedProvinceObj
=
option
}
})
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedProvinceObj
=
option
}
})
}
}
questionnair/src/app/page4/page4.component.ts
View file @
3c675c72
...
...
@@ -8,7 +8,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export
class
Page4Component
implements
OnInit
{
@
Input
()
curPageData
:
Array
<
any
>
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
selectedObj
:
Object
;
selectedObj
:
Object
constructor
()
{}
ngOnInit
()
{
...
...
@@ -16,13 +16,13 @@ export class Page4Component implements OnInit {
this
.
setOptionSelected
()
}
getAnswer
(
option
)
{
if
(
!
this
.
selectedObj
[
'selected'
])
{
if
(
!
this
.
selectedObj
[
'selected'
])
{
this
.
selectedObj
=
option
option
[
'selected'
]
=
true
;
}
else
{
if
(
this
.
selectedObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedObj
[
'selected'
]
=
false
;
option
[
'selected'
]
=
true
;
option
[
'selected'
]
=
true
}
else
{
if
(
this
.
selectedObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedObj
[
'selected'
]
=
false
option
[
'selected'
]
=
true
this
.
selectedObj
=
option
}
}
...
...
@@ -31,7 +31,7 @@ export class Page4Component implements OnInit {
questions
:
[
{
questionId
:
this
.
curPageData
[
'questions'
][
0
].
questionId
,
option
:
[
option
]
option
s
:
[
option
]
}
]
}
...
...
@@ -43,10 +43,10 @@ export class Page4Component implements OnInit {
if
(
!
options
)
{
return
}
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
=
option
}
})
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
=
option
}
})
}
}
questionnair/src/app/page5/page5.component.ts
View file @
3c675c72
...
...
@@ -8,7 +8,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export
class
Page5Component
implements
OnInit
{
@
Input
()
curPageData
:
Array
<
any
>
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
selectedObj
:
Object
;
selectedObj
:
Object
constructor
()
{}
ngOnInit
()
{
...
...
@@ -16,13 +16,13 @@ export class Page5Component implements OnInit {
this
.
setOptionSelected
()
}
getAnswer
(
option
)
{
if
(
!
this
.
selectedObj
[
'selected'
])
{
if
(
!
this
.
selectedObj
[
'selected'
])
{
this
.
selectedObj
=
option
option
[
'selected'
]
=
true
;
}
else
{
if
(
this
.
selectedObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedObj
[
'selected'
]
=
false
;
option
[
'selected'
]
=
true
;
option
[
'selected'
]
=
true
}
else
{
if
(
this
.
selectedObj
[
'optionId'
]
!=
option
.
optionId
)
{
this
.
selectedObj
[
'selected'
]
=
false
option
[
'selected'
]
=
true
this
.
selectedObj
=
option
}
}
...
...
@@ -31,7 +31,7 @@ export class Page5Component implements OnInit {
questions
:
[
{
questionId
:
this
.
curPageData
[
'questions'
][
0
].
questionId
,
option
:
[
option
]
option
s
:
[
option
]
}
]
}
...
...
@@ -42,10 +42,10 @@ export class Page5Component implements OnInit {
if
(
!
options
)
{
return
}
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
=
option
}
})
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
=
option
}
})
}
}
questionnair/src/app/page7/page7.component.ts
View file @
3c675c72
...
...
@@ -22,7 +22,7 @@ export class Page7Component implements OnInit {
//获取当前页面问题id
const
questionId
=
question
[
'questionId'
]
if
(
!
this
.
selectedObj
[
questionId
])
{
this
.
selectedObj
[
questionId
]
=
options
this
.
selectedObj
[
questionId
]
=
options
options
[
'selected'
]
=
true
}
else
{
if
(
this
.
selectedObj
[
questionId
].
optionId
!=
options
.
optionId
)
{
...
...
@@ -33,7 +33,7 @@ export class Page7Component implements OnInit {
}
this
.
curAllQues
[
questionId
]
=
options
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
this
.
curAllQues
[
questionId
]
}
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]
]
}
})
const
ret
=
{
pageId
:
7
,
...
...
@@ -57,5 +57,4 @@ export class Page7Component implements OnInit {
})
})
}
}
questionnair/src/app/page8/page8.component.ts
View file @
3c675c72
...
...
@@ -9,8 +9,8 @@ export class Page8Component implements OnInit {
@
Input
()
curPageData
:
Array
<
any
>
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
curAllQues
:
Object
selectedNum
:
number
;
selectedTwo
:
number
;
selectedNum
:
number
selectedTwo
:
number
selectedObj
:
Object
constructor
()
{}
...
...
@@ -34,7 +34,7 @@ export class Page8Component implements OnInit {
}
this
.
curAllQues
[
questionId
]
=
options
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
this
.
curAllQues
[
questionId
]
}
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]
]
}
})
const
ret
=
{
pageId
:
8
,
...
...
questionnair/src/app/page9/page9.component.ts
View file @
3c675c72
...
...
@@ -33,7 +33,7 @@ export class Page9Component implements OnInit {
}
this
.
curAllQues
[
questionId
]
=
options
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
this
.
curAllQues
[
questionId
]
}
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]
]
}
})
const
ret
=
{
pageId
:
9
,
...
...
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