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
2ce358eb
Commit
2ce358eb
authored
May 17, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回问题
parent
80387efb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
23 deletions
+94
-23
questionnair/src/app/ask/ask.component.ts
+15
-3
questionnair/src/app/page2/page2.component.ts
+1
-2
questionnair/src/app/page3/page3.component.ts
+3
-2
questionnair/src/app/page7/page7.component.ts
+25
-7
questionnair/src/app/page8/page8.component.ts
+25
-6
questionnair/src/app/page9/page9.component.ts
+25
-3
No files found.
questionnair/src/app/ask/ask.component.ts
View file @
2ce358eb
...
...
@@ -121,7 +121,6 @@ export class AskComponent implements OnInit {
pages
:
this
.
filterItems
()
}
}
console
.
log
(
answerParam
)
if
(
this
.
curPage
==
16
)
{
this
.
commonService
.
saveCustomerAnwers
(
answerParam
).
then
(
res
=>
{
...
...
@@ -130,8 +129,9 @@ export class AskComponent implements OnInit {
}
getAllAnswer
(
e
)
{
this
.
questionInfo
=
e
;
console
.
log
(
e
)
const
page2Answer
=
this
.
allAnswers
[
1
]
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
(
e
[
'questions'
].
length
>
0
){
...
...
@@ -140,7 +140,19 @@ export class AskComponent implements OnInit {
}
}
if
(
this
.
curPageData
[
'questions'
].
length
==
e
[
'questions'
].
length
){
this
.
nextBtn
=
true
for
(
let
i
=
0
;
i
<
e
[
'questions'
].
length
;
i
++
){
if
(
e
[
'questions'
][
i
][
'options'
].
length
>
0
){
for
(
let
j
=
0
;
j
<
e
[
'questions'
][
i
][
'options'
].
length
;
j
++
){
if
(
!
e
[
'questions'
][
i
][
'options'
][
j
][
'optionId'
]){
this
.
nextBtn
=
false
}
else
{
this
.
nextBtn
=
true
}
}
}
}
}
else
{
this
.
nextBtn
=
false
}
}
setCurPageData
()
{
...
...
questionnair/src/app/page2/page2.component.ts
View file @
2ce358eb
...
...
@@ -8,7 +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
()
{}
...
...
@@ -39,7 +39,6 @@ export class Page2Component implements OnInit {
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this
.
getAllAnswer
.
emit
(
ret
);
this
.
controlNext
.
emit
();
// console.log(ret)
}
...
...
questionnair/src/app/page3/page3.component.ts
View file @
2ce358eb
...
...
@@ -56,12 +56,13 @@ export class Page3Component implements OnInit {
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]}
});
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
questions
.
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
if
(
questions
[
i
][
'questionId'
]
!=
this
.
questions
[
j
][
'questionId'
])
{
questions
.
push
(
this
.
questions
[
j
]);
break
;
}
break
;
}
}
const
ret
=
{
...
...
@@ -86,7 +87,7 @@ export class Page3Component implements OnInit {
if
(
this
.
curPageData
[
'questions'
].
length
>
0
)
{
for
(
let
i
=
0
;
i
<
this
.
curPageData
[
'questions'
].
length
;
i
++
)
{
if
(
!
this
.
curPageData
[
'questions'
][
i
][
'name'
])
{
return
;
break
}
let
option
=
{};
let
question
=
{
...
...
questionnair/src/app/page7/page7.component.ts
View file @
2ce358eb
...
...
@@ -11,17 +11,16 @@ export class Page7Component implements OnInit {
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
curAllQues
:
Object
selectedObj
:
Object
selectedObj1
:
Object
questions
:
Array
<
any
>
;
constructor
()
{}
ngOnInit
()
{
this
.
curAllQues
=
{}
this
.
selectedObj
=
{}
this
.
selectedObj1
=
{}
this
.
questions
=
[]
this
.
setOptionSelected
()
}
getAnswer
(
question
,
options
)
{
console
.
log
(
question
,
options
)
//获取当前页面问题id
const
questionId
=
question
[
'questionId'
]
if
(
!
this
.
selectedObj
[
questionId
])
{
...
...
@@ -38,6 +37,16 @@ export class Page7Component implements OnInit {
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
for
(
let
j
=
0
;
j
<
this
.
questions
.
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
if
(
questions
[
i
][
'questionId'
]
!=
this
.
questions
[
j
][
'questionId'
])
{
questions
.
push
(
this
.
questions
[
j
]);
break
;
}
break
;
}
}
const
ret
=
{
pageId
:
7
,
questions
...
...
@@ -46,18 +55,27 @@ export class Page7Component implements OnInit {
}
setOptionSelected
()
{
const
questions
=
this
.
curPageData
[
'questions'
]
const
questions
2
=
this
.
curPageData
[
'questions'
]
// console.log(questions)
if
(
!
questions
)
{
if
(
!
questions
2
)
{
return
}
questions
.
map
(
question
=>
{
questions
2
.
map
(
question
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
// console.log(this.selectedObj)
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
}
})
})
const
questions
=
Object
.
keys
(
this
.
selectedObj
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
selectedObj
[
questionId
]]
}
})
this
.
questions
=
questions
const
ret
=
{
pageId
:
7
,
questions
}
this
.
getAllAnswer
.
emit
(
ret
)
}
}
questionnair/src/app/page8/page8.component.ts
View file @
2ce358eb
...
...
@@ -9,12 +9,13 @@ export class Page8Component implements OnInit {
@
Input
()
curPageData
:
Array
<
any
>
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
curAllQues
:
Object
selectedNum
:
number
selectedTwo
:
number
selectedObj
:
Object
questions
:
Array
<
any
>
;
constructor
()
{}
ngOnInit
()
{
this
.
questions
=
[];
this
.
curAllQues
=
{}
this
.
selectedObj
=
{}
this
.
setOptionSelected
()
...
...
@@ -36,25 +37,43 @@ export class Page8Component implements OnInit {
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
for
(
let
j
=
0
;
j
<
this
.
questions
.
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
if
(
questions
[
i
][
'questionId'
]
!=
this
.
questions
[
j
][
'questionId'
])
{
questions
.
push
(
this
.
questions
[
j
]);
break
;
}
break
;
}
}
const
ret
=
{
pageId
:
8
,
questions
}
// console.log(this.curPageData['questions']);
// console.log(ret.questions)
this
.
getAllAnswer
.
emit
(
ret
)
}
setOptionSelected
()
{
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
)
{
const
questions
2
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
2
)
{
return
}
questions
.
map
(
question
=>
{
questions
2
.
map
(
question
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
}
})
})
const
questions
=
Object
.
keys
(
this
.
selectedObj
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
selectedObj
[
questionId
]]
}
})
this
.
questions
=
questions
const
ret
=
{
pageId
:
8
,
questions
}
this
.
getAllAnswer
.
emit
(
ret
)
}
}
questionnair/src/app/page9/page9.component.ts
View file @
2ce358eb
...
...
@@ -11,12 +11,15 @@ export class Page9Component implements OnInit {
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
curAllQues
:
Object
selectedObj
:
Object
questions
:
Array
<
any
>
;
constructor
()
{}
ngOnInit
()
{
this
.
curAllQues
=
{}
this
.
selectedObj
=
{}
this
.
questions
=
[];
this
.
setOptionSelected
()
}
getAnswer
(
question
,
options
)
{
const
questionId
=
question
[
'questionId'
]
...
...
@@ -35,6 +38,15 @@ export class Page9Component implements OnInit {
const
questions
=
Object
.
keys
(
this
.
curAllQues
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
curAllQues
[
questionId
]]
}
})
for
(
let
j
=
0
;
j
<
this
.
questions
.
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
if
(
questions
[
i
][
'questionId'
]
!=
this
.
questions
[
j
][
'questionId'
])
{
questions
.
push
(
this
.
questions
[
j
]);
break
;
}
break
;
}
}
const
ret
=
{
pageId
:
9
,
questions
...
...
@@ -42,16 +54,26 @@ export class Page9Component implements OnInit {
this
.
getAllAnswer
.
emit
(
ret
)
}
setOptionSelected
()
{
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
)
{
const
questions
2
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
2
)
{
return
}
questions
.
map
(
question
=>
{
questions
2
.
map
(
question
=>
{
question
[
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
])
{
this
.
selectedObj
[
question
[
'questionId'
]]
=
option
}
})
})
const
questions
=
Object
.
keys
(
this
.
selectedObj
).
map
(
questionId
=>
{
return
{
questionId
,
options
:
[
this
.
selectedObj
[
questionId
]]
}
})
this
.
questions
=
questions
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