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
44e6aacc
Commit
44e6aacc
authored
May 15, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下一步置灰
parent
3c675c72
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
87 additions
and
33 deletions
+87
-33
questionnair/src/app/ask/ask.component.html
+5
-2
questionnair/src/app/ask/ask.component.ts
+41
-10
questionnair/src/app/common.service.ts
+10
-0
questionnair/src/app/page11/page11.component.ts
+2
-2
questionnair/src/app/page14/page14.component.ts
+2
-2
questionnair/src/app/page15/page15.component.ts
+4
-4
questionnair/src/app/page16/page16.component.ts
+4
-4
questionnair/src/app/page17/page17.component.ts
+1
-1
questionnair/src/app/page2/page2.component.ts
+6
-1
questionnair/src/app/page3/page3.component.ts
+2
-2
questionnair/src/app/page6/page6.component.ts
+1
-1
questionnair/src/app/page7/page7.component.ts
+2
-2
questionnair/src/app/page8/page8.component.ts
+3
-1
questionnair/src/app/page9/page9.component.ts
+1
-1
questionnair/src/styles.css
+3
-0
No files found.
questionnair/src/app/ask/ask.component.html
View file @
44e6aacc
...
...
@@ -78,9 +78,12 @@
<div
class=
"footer"
*
ngIf=
"curPage == 0"
(
click
)="
addPage
()"
>
<div>
获取家庭分析报告
</div>
</div>
<div
class=
"content_footer"
*
ngIf=
"curPage != 0"
>
<div
class=
"content_footer"
*
ngIf=
"curPage != 0
&& curPage!=16
"
>
<div
(
click
)="
reducePage
()"
>
<
</div>
<div
(
click
)="
addPage
()"
class=
"next"
>
下一步
</div>
<div
(
click
)="
addPage
()"
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
>
下一步
</div>
</div>
</div>
</div>
questionnair/src/app/ask/ask.component.ts
View file @
44e6aacc
...
...
@@ -17,6 +17,7 @@ export class AskComponent implements OnInit {
hasMate
:
boolean
//获取省份
provinceList
:
Array
<
any
>
nextBtn
:
boolean
;
constructor
(
private
commonService
:
CommonService
)
{}
ngOnInit
()
{
...
...
@@ -43,7 +44,7 @@ export class AskComponent implements OnInit {
})
}
reducePage
()
{
console
.
log
(
'start'
,
this
.
curPage
)
//
console.log('start', this.curPage)
if
(
this
.
curPage
>
0
)
{
const
page2Answer
=
this
.
allAnswers
[
1
]
const
optionId
=
page2Answer
.
questions
[
0
].
options
[
0
].
optionId
...
...
@@ -74,7 +75,7 @@ export class AskComponent implements OnInit {
return
}
}
this
.
curPage
--
this
.
curPage
--
;
this
.
setCurPageData
()
}
else
{
return
...
...
@@ -86,7 +87,11 @@ export class AskComponent implements OnInit {
})
}
addPage
()
{
if
(
this
.
nextBtn
===
false
){
return
;
}
if
(
this
.
curPage
<
16
)
{
//判断当前页是否有答案
if
(
this
.
curPage
==
0
||
this
.
allAnswers
[
this
.
curPage
]
||
...
...
@@ -102,26 +107,52 @@ export class AskComponent implements OnInit {
}
const
answerParam
=
{
survey
:
{
customerId
:
20
,
orderId
:
9999996
,
customerId
:
this
.
commonService
.
getQueryString
(
'customerId'
)
,
orderId
:
this
.
commonService
.
getQueryString
(
'orderId'
)
,
pages
:
this
.
filterItems
()
}
}
console
.
log
(
answerParam
)
if
(
this
.
curPage
==
16
)
{
this
.
commonService
.
saveCustomerAnwers
(
answerParam
).
then
(
res
=>
{
console
.
log
(
res
)
//
console.log(res)
})
}
console
.
log
(
this
.
curPage
)
// console.log(this.nextBtn
)
}
getAllAnswer
(
e
)
{
this
.
allAnswers
[
this
.
curPage
]
=
e
console
.
log
(
this
.
allAnswers
)
// console.log(this.allAnswers);
if
(
this
.
curPage
<
16
)
{
//判断当前页是否有答案
if
(
this
.
curPage
==
0
||
this
.
allAnswers
[
this
.
curPage
]
||
this
.
curPage
==
5
||
this
.
curPage
==
9
)
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
}
setCurPageData
()
{
// console.log(this.allAnswers)
if
(
this
.
curPage
<
16
)
{
//判断当前页是否有答案
if
(
this
.
curPage
==
0
||
this
.
allAnswers
[
this
.
curPage
]
||
this
.
curPage
==
5
||
this
.
curPage
==
9
)
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
}
const
thePateData
=
this
.
allQues
[
this
.
curPage
]
console
.
log
(
'thePateData------'
,
this
.
curPage
,
thePateData
)
//
console.log('thePateData------', this.curPage, thePateData)
this
.
curPageData
=
thePateData
const
page2Answer
=
this
.
allAnswers
[
1
]
if
(
this
.
curPage
==
2
)
{
...
...
@@ -211,7 +242,7 @@ export class AskComponent implements OnInit {
//1单身 3单亲
if
(
optionId
==
1
||
optionId
==
3
)
{
this
.
curPage
++
console
.
log
(
'page5'
,
this
.
curPage
,
this
.
curPageData
)
//
console.log('page5', this.curPage, this.curPageData)
this
.
curPageData
=
this
.
allQues
[
this
.
curPage
]
}
}
...
...
questionnair/src/app/common.service.ts
View file @
44e6aacc
...
...
@@ -73,4 +73,14 @@ export class CommonService {
return
res
;
})
}
getQueryString
(
name
)
{
const
gitUrlParam
=
window
.
location
.
search
;
const
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
);
const
r
=
decodeURIComponent
(
gitUrlParam
).
substr
(
1
).
match
(
reg
);
if
(
r
!=
null
)
{
return
r
[
2
];
}
return
null
;
}
}
questionnair/src/app/page11/page11.component.ts
View file @
44e6aacc
...
...
@@ -15,7 +15,7 @@ export class Page11Component implements OnInit {
ngOnInit
()
{
// this.allOption = {}
this
.
allOptions
=
[]
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
}
getAnswer
(
options
)
{
options
[
'selected'
]
=
!
options
[
'selected'
]
...
...
@@ -46,7 +46,7 @@ export class Page11Component implements OnInit {
}
}
console
.
log
(
this
.
allOptions
)
//
console.log(this.allOptions)
// 删掉未选中的疾病
// for (let i = 0; i < this.allOptions.length; i++){
// if (!this.allOptions[i]['selected']) {
...
...
questionnair/src/app/page14/page14.component.ts
View file @
44e6aacc
...
...
@@ -14,10 +14,10 @@ export class Page14Component implements OnInit {
constructor
()
{
}
ngOnInit
()
{
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this
.
optionType
=
this
.
curPageData
[
'questions'
][
0
].
optionType
console
.
log
(
this
.
optionType
)
//
console.log(this.optionType)
if
(
this
.
optionType
==
1
){
this
.
selectedObj
=
{}
this
.
setOptionSelected
()
...
...
questionnair/src/app/page15/page15.component.ts
View file @
44e6aacc
...
...
@@ -16,10 +16,10 @@ export class Page15Component implements OnInit {
constructor
()
{
}
ngOnInit
()
{
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
//拿到数据中是多选还是单选2表示多选1表示单选
this
.
optionType
=
this
.
curPageData
[
'questions'
][
0
].
optionType
console
.
log
(
this
.
optionType
)
//
console.log(this.optionType)
if
(
this
.
optionType
==
1
){
this
.
selectedObj
=
{}
this
.
setOptionSelected
()
...
...
@@ -30,7 +30,7 @@ export class Page15Component implements OnInit {
}
getManyAnswer
(
options
)
{
console
.
log
(
options
)
//
console.log(options)
options
[
'selected'
]
=
!
options
[
'selected'
]
for
(
let
i
=
0
;
i
<
this
.
allOptions
.
length
;
i
++
)
{
// 更改问题状态,防止重复往数组push
...
...
@@ -104,7 +104,7 @@ export class Page15Component implements OnInit {
setOptionSelected
()
{
const
options
=
this
.
curPageData
[
'questions'
][
0
].
options
console
.
log
(
this
.
curPageData
[
'questions'
][
0
])
//
console.log(this.curPageData['questions'][0])
if
(
!
options
)
{
return
}
...
...
questionnair/src/app/page16/page16.component.ts
View file @
44e6aacc
...
...
@@ -26,7 +26,7 @@ export class Page16Component implements OnInit {
ngOnInit
()
{
this
.
selectedProvinceObj
=
{}
this
.
selectedCityObj
=
{}
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
this
.
showAddress
=
false
this
.
setOptionSelected
()
}
...
...
@@ -45,7 +45,7 @@ export class Page16Component implements OnInit {
this
.
selectedProvinceObj
=
option
}
}
console
.
log
(
this
.
selectedProvinceObj
)
//
console.log(this.selectedProvinceObj)
this
.
provinceName
=
option
.
provinceName
this
.
provinceId
=
option
.
provinceId
this
.
getCityqry
()
...
...
@@ -62,7 +62,7 @@ export class Page16Component implements OnInit {
this
.
commonService
.
getCityqry
(
param
).
subscribe
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
cityList
=
res
[
'data'
].
cityList
console
.
log
(
this
.
cityList
)
//
console.log(this.cityList)
}
})
}
...
...
@@ -101,7 +101,7 @@ export class Page16Component implements OnInit {
setOptionSelected
()
{
const
options
=
this
.
provinceList
console
.
log
(
options
)
//
console.log(options)
if
(
!
options
)
{
return
}
...
...
questionnair/src/app/page17/page17.component.ts
View file @
44e6aacc
...
...
@@ -10,6 +10,6 @@ export class Page17Component implements OnInit {
constructor
()
{}
ngOnInit
()
{
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
}
}
questionnair/src/app/page2/page2.component.ts
View file @
44e6aacc
...
...
@@ -8,6 +8,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
export
class
Page2Component
implements
OnInit
{
@
Input
()
curPageData
:
Array
<
any
>
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
@
Output
()
controlNext
=
new
EventEmitter
<
any
>
()
selectedObj
:
Object
;
constructor
()
{}
...
...
@@ -35,7 +36,11 @@ export class Page2Component implements OnInit {
}
]
}
this
.
getAllAnswer
.
emit
(
ret
)
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this
.
getAllAnswer
.
emit
(
ret
);
this
.
controlNext
.
emit
();
// console.log(ret)
}
setOptionSelected
()
{
...
...
questionnair/src/app/page3/page3.component.ts
View file @
44e6aacc
...
...
@@ -42,7 +42,7 @@ export class Page3Component implements OnInit {
const
questionId
=
this
.
curQues
[
'questionId'
]
this
.
curAllQues
[
questionId
]
=
option
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
this
.
curAllQues
[
questionId
]
}
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]
]
}
})
const
ret
=
{
pageId
:
3
,
...
...
@@ -135,6 +135,6 @@ export class Page3Component implements OnInit {
]
}
}
console
.
log
(
this
.
curPageData
[
'questions'
])
//
console.log(this.curPageData['questions'])
}
}
questionnair/src/app/page6/page6.component.ts
View file @
44e6aacc
...
...
@@ -10,6 +10,6 @@ export class Page6Component implements OnInit {
constructor
()
{}
ngOnInit
()
{
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
}
}
questionnair/src/app/page7/page7.component.ts
View file @
44e6aacc
...
...
@@ -44,14 +44,14 @@ export class Page7Component implements OnInit {
setOptionSelected
()
{
const
questions
=
this
.
curPageData
[
'questions'
]
console
.
log
(
questions
)
//
console.log(questions)
if
(
!
questions
)
{
return
}
questions
.
map
(
question
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
console
.
log
(
this
.
selectedObj
)
//
console.log(this.selectedObj)
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
}
})
...
...
questionnair/src/app/page8/page8.component.ts
View file @
44e6aacc
...
...
@@ -18,7 +18,7 @@ export class Page8Component implements OnInit {
this
.
curAllQues
=
{}
this
.
selectedObj
=
{}
this
.
setOptionSelected
()
console
.
log
(
this
.
curPageData
)
//
console.log(this.curPageData)
}
getAnswer
(
question
,
options
)
{
const
questionId
=
question
[
'questionId'
]
...
...
@@ -40,6 +40,8 @@ export class Page8Component implements OnInit {
pageId
:
8
,
questions
}
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this
.
getAllAnswer
.
emit
(
ret
)
}
setOptionSelected
()
{
...
...
questionnair/src/app/page9/page9.component.ts
View file @
44e6aacc
...
...
@@ -20,7 +20,7 @@ export class Page9Component implements OnInit {
}
getAnswer
(
question
,
options
)
{
const
questionId
=
question
[
'questionId'
]
console
.
log
(
'select'
,
this
.
selectedObj
,
options
)
//
console.log('select', this.selectedObj, options)
if
(
!
this
.
selectedObj
[
questionId
])
{
this
.
selectedObj
[
questionId
]
=
options
options
[
'selected'
]
=
true
...
...
questionnair/src/styles.css
View file @
44e6aacc
...
...
@@ -97,6 +97,9 @@ ul li,ol li{
line-height
:
60px
;
font-weight
:
bold
;
}
.content_footer
div
.next
{
color
:
#8a8a8a
;
}
.content_footer
div
:nth-child
(
1
)
{
flex
:
0
0
15%
;
font-size
:
30px
;
...
...
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