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
e91e49df
Commit
e91e49df
authored
May 16, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除多个问题初始化
parent
fb98e718
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
51 deletions
+10
-51
questionnair/src/app/ask/ask.component.ts
+2
-26
questionnair/src/app/page3/page3.component.ts
+4
-1
questionnair/src/app/page5/page5.component.ts
+1
-0
questionnair/src/app/page7/page7.component.ts
+3
-8
questionnair/src/app/page8/page8.component.ts
+0
-8
questionnair/src/app/page9/page9.component.ts
+0
-8
No files found.
questionnair/src/app/ask/ask.component.ts
View file @
e91e49df
...
@@ -46,10 +46,6 @@ export class AskComponent implements OnInit {
...
@@ -46,10 +46,6 @@ export class AskComponent implements OnInit {
})
})
}
}
reducePage
()
{
reducePage
()
{
if
(
this
.
questionInfo
){
this
.
allAnswers
[
this
.
curPage
]
=
this
.
questionInfo
;
this
.
questionInfo
=
null
}
if
(
this
.
curPage
>
0
)
{
if
(
this
.
curPage
>
0
)
{
const
page2Answer
=
this
.
allAnswers
[
1
]
const
page2Answer
=
this
.
allAnswers
[
1
]
if
(
page2Answer
){
if
(
page2Answer
){
...
@@ -88,24 +84,6 @@ export class AskComponent implements OnInit {
...
@@ -88,24 +84,6 @@ export class AskComponent implements OnInit {
}
else
{
}
else
{
return
return
}
}
// if(this.curPage == 6 || this.curPage == 8){
// const page2Answer = this.allAnswers[1]
// const optionId = page2Answer.questions[0].options[0].optionId
// if(optionId==1 || optionId==3){
// if(this.questionInfo['questions'].length>0){
// this.nextBtn = true
// }
// }
// }
// if(this.curPageData['questions'].length == this.questionInfo['questions'].length){
// this.nextBtn = true
// }
console
.
log
(
this
.
questionInfo
)
// if(){
// }
}
}
filterItems
()
{
filterItems
()
{
return
this
.
allAnswers
.
filter
(
item
=>
{
return
this
.
allAnswers
.
filter
(
item
=>
{
...
@@ -143,10 +121,10 @@ export class AskComponent implements OnInit {
...
@@ -143,10 +121,10 @@ export class AskComponent implements OnInit {
pages
:
this
.
filterItems
()
pages
:
this
.
filterItems
()
}
}
}
}
console
.
log
(
answerParam
)
if
(
this
.
curPage
==
16
)
{
if
(
this
.
curPage
==
16
)
{
this
.
commonService
.
saveCustomerAnwers
(
answerParam
).
then
(
res
=>
{
this
.
commonService
.
saveCustomerAnwers
(
answerParam
).
then
(
res
=>
{
// console.log(res)
})
})
}
}
}
}
...
@@ -219,7 +197,6 @@ export class AskComponent implements OnInit {
...
@@ -219,7 +197,6 @@ export class AskComponent implements OnInit {
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
}
}
}
}
// console.log('thePateData------', this.curPage, thePateData)
}
}
filterPage2
(
optionId
,
thePateData
)
{
filterPage2
(
optionId
,
thePateData
)
{
...
@@ -271,7 +248,6 @@ export class AskComponent implements OnInit {
...
@@ -271,7 +248,6 @@ export class AskComponent implements OnInit {
//1单身 3单亲
//1单身 3单亲
if
(
optionId
==
1
||
optionId
==
3
)
{
if
(
optionId
==
1
||
optionId
==
3
)
{
this
.
curPage
++
this
.
curPage
++
// console.log('page5', this.curPage, this.curPageData)
this
.
curPageData
=
this
.
allQues
[
this
.
curPage
]
this
.
curPageData
=
this
.
allQues
[
this
.
curPage
]
}
}
}
}
...
...
questionnair/src/app/page3/page3.component.ts
View file @
e91e49df
...
@@ -36,6 +36,7 @@ export class Page3Component implements OnInit {
...
@@ -36,6 +36,7 @@ export class Page3Component implements OnInit {
this
.
curQuesIndex
=
idx
this
.
curQuesIndex
=
idx
// console.log(question)
// console.log(question)
this
.
curQuestionSelecte
=
question
.
name
this
.
curQuestionSelecte
=
question
.
name
}
}
closeToast
()
{
closeToast
()
{
this
.
isShow
=
false
this
.
isShow
=
false
...
@@ -43,9 +44,11 @@ export class Page3Component implements OnInit {
...
@@ -43,9 +44,11 @@ export class Page3Component implements OnInit {
getAnswer
(
option
)
{
getAnswer
(
option
)
{
const
questionId
=
this
.
curQues
[
'questionId'
]
const
questionId
=
this
.
curQues
[
'questionId'
]
this
.
curAllQues
[
questionId
]
=
option
this
.
curAllQues
[
questionId
]
=
option
console
.
log
(
this
.
curAllQues
)
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
})
const
ret
=
{
const
ret
=
{
pageId
:
3
,
pageId
:
3
,
questions
questions
...
@@ -57,9 +60,9 @@ export class Page3Component implements OnInit {
...
@@ -57,9 +60,9 @@ export class Page3Component implements OnInit {
//当前选中项
//当前选中项
this
.
curPageData
[
'questions'
][
this
.
curQuesIndex
][
'name'
]
=
this
.
curPageData
[
'questions'
][
this
.
curQuesIndex
][
'name'
]
=
options
.
optionName
options
.
optionName
}
}
addChild
()
{
addChild
()
{
// this.addChildCount--
// this.addChildCount--
// if (this.addChildCount >= 0) {
// if (this.addChildCount >= 0) {
...
...
questionnair/src/app/page5/page5.component.ts
View file @
e91e49df
...
@@ -45,6 +45,7 @@ export class Page5Component implements OnInit {
...
@@ -45,6 +45,7 @@ export class Page5Component implements OnInit {
options
.
forEach
(
option
=>
{
options
.
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
=
option
;
this
.
selectedObj
=
option
;
console
.
log
(
this
.
selectedObj
)
this
.
getAnswer
(
this
.
selectedObj
)
this
.
getAnswer
(
this
.
selectedObj
)
}
}
})
})
...
...
questionnair/src/app/page7/page7.component.ts
View file @
e91e49df
...
@@ -11,14 +11,17 @@ export class Page7Component implements OnInit {
...
@@ -11,14 +11,17 @@ export class Page7Component implements OnInit {
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
curAllQues
:
Object
curAllQues
:
Object
selectedObj
:
Object
selectedObj
:
Object
selectedObj1
:
Object
constructor
()
{}
constructor
()
{}
ngOnInit
()
{
ngOnInit
()
{
this
.
curAllQues
=
{}
this
.
curAllQues
=
{}
this
.
selectedObj
=
{}
this
.
selectedObj
=
{}
this
.
selectedObj1
=
{}
this
.
setOptionSelected
()
this
.
setOptionSelected
()
}
}
getAnswer
(
question
,
options
)
{
getAnswer
(
question
,
options
)
{
console
.
log
(
question
,
options
)
//获取当前页面问题id
//获取当前页面问题id
const
questionId
=
question
[
'questionId'
]
const
questionId
=
question
[
'questionId'
]
if
(
!
this
.
selectedObj
[
questionId
])
{
if
(
!
this
.
selectedObj
[
questionId
])
{
...
@@ -53,14 +56,6 @@ export class Page7Component implements OnInit {
...
@@ -53,14 +56,6 @@ export class Page7Component implements OnInit {
if
(
option
[
'selected'
])
{
if
(
option
[
'selected'
])
{
// console.log(this.selectedObj)
// console.log(this.selectedObj)
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
const
ret
=
{
pageId
:
7
,
questions
}
this
.
getAllAnswer
.
emit
(
ret
)
}
}
})
})
})
})
...
...
questionnair/src/app/page8/page8.component.ts
View file @
e91e49df
...
@@ -53,14 +53,6 @@ export class Page8Component implements OnInit {
...
@@ -53,14 +53,6 @@ export class Page8Component implements OnInit {
question
[
'options'
].
forEach
(
option
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
const
ret
=
{
pageId
:
8
,
questions
}
this
.
getAllAnswer
.
emit
(
ret
)
}
}
})
})
})
})
...
...
questionnair/src/app/page9/page9.component.ts
View file @
e91e49df
...
@@ -50,14 +50,6 @@ export class Page9Component implements OnInit {
...
@@ -50,14 +50,6 @@ export class Page9Component implements OnInit {
question
[
'options'
].
forEach
(
option
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
const
ret
=
{
pageId
:
9
,
questions
}
this
.
getAllAnswer
.
emit
(
ret
)
}
}
})
})
})
})
...
...
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