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
a308ae59
Commit
a308ae59
authored
May 22, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
年龄
parent
4d4267d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
39 deletions
+44
-39
questionnaire/src/app/age/age.component.ts
+20
-13
questionnaire/src/app/job/job.component.ts
+24
-26
No files found.
questionnaire/src/app/age/age.component.ts
View file @
a308ae59
...
@@ -23,6 +23,7 @@ export class AgeComponent implements OnInit {
...
@@ -23,6 +23,7 @@ export class AgeComponent implements OnInit {
lastQuestions
:
Array
<
any
>
;
lastQuestions
:
Array
<
any
>
;
nextBtn
:
boolean
=
false
;
nextBtn
:
boolean
=
false
;
targetObj
:
any
=
{};
targetObj
:
any
=
{};
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
/**
/**
* 1:单身贵族
* 1:单身贵族
...
@@ -42,7 +43,6 @@ export class AgeComponent implements OnInit {
...
@@ -42,7 +43,6 @@ export class AgeComponent implements OnInit {
ngOnInit
()
{
ngOnInit
()
{
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
3
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
3
).
pop
();
console
.
log
(
this
.
lastQuestions
)
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
curPageData
=
res
[
'data'
][
'survey'
][
'pages'
].
filter
(
item
=>
item
.
pageId
===
3
).
pop
();
this
.
curPageData
=
res
[
'data'
][
'survey'
][
'pages'
].
filter
(
item
=>
item
.
pageId
===
3
).
pop
();
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
...
@@ -56,25 +56,32 @@ export class AgeComponent implements OnInit {
...
@@ -56,25 +56,32 @@ export class AgeComponent implements OnInit {
this
.
handleData
([]);
this
.
handleData
([]);
}
}
if
(
this
.
lastQuestions
)
{
if
(
this
.
lastQuestions
)
{
// 检测增加了几个孩子
const
childLength
=
this
.
lastQuestions
[
'questions'
].
filter
(
item
=>
item
.
questionSubId
).
length
;
if
(
childLength
>
0
)
{
for
(
let
i
=
0
;
i
<
childLength
;
i
++
)
{
this
.
addChild
();
}
}
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
this
.
lastQuestions
[
'questions'
][
i
][
'questionSubId'
]
==
this
.
curPageData
[
'questions'
][
j
][
'questionSubId'
])
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
this
.
targetObj
=
option
;
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
}
this
.
targetObj
=
option
;
// console.log(this.targetObj)
}
this
.
showToast
(
this
.
curPageData
[
'questions'
][
j
])
this
.
showToast
(
this
.
curPageData
[
'questions'
][
j
])
this
.
selectedAge
(
this
.
targetObj
);
this
.
selectedAge
(
this
.
targetObj
);
});
});
}
}
}
}
}
}
}
}
else
{
}
else
{
return
return
;
}
}
// console.log(this.curPageData)
console
.
log
(
this
.
curPageData
);
});
});
}
}
...
...
questionnaire/src/app/job/job.component.ts
View file @
a308ae59
...
@@ -14,7 +14,8 @@ export class JobComponent implements OnInit {
...
@@ -14,7 +14,8 @@ export class JobComponent implements OnInit {
id
:
any
;
id
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
lastQuestions
:
Array
<
any
>
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -49,46 +50,44 @@ export class JobComponent implements OnInit {
...
@@ -49,46 +50,44 @@ export class JobComponent implements OnInit {
if
(
this
.
id
==
1
)
{
if
(
this
.
id
==
1
)
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'3'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'3'
];
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
4
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
4
).
pop
();
console
.
log
(
this
.
lastQuestions
)
if
(
this
.
lastQuestions
)
{
if
(
this
.
lastQuestions
){
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
)
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
this
.
targetObj
=
option
this
.
targetObj
=
option
}
}
this
.
selectedJob
(
this
.
targetObj
);
this
.
selectedJob
(
this
.
targetObj
);
});
});
}
}
}
}
}
}
}
else
{
}
else
{
return
return
;
}
}
}
else
{
}
else
{
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'4'
];
this
.
curPageData
=
res
[
'data'
].
survey
.
pages
[
'4'
];
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
5
).
pop
();
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
5
).
pop
();
if
(
this
.
lastQuestions
)
{
if
(
this
.
lastQuestions
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
)
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
this
.
targetObj
=
option
this
.
targetObj
=
option
;
}
}
this
.
selectedJob
(
this
.
targetObj
);
this
.
selectedJob
(
this
.
targetObj
);
});
});
}
}
}
}
}
}
}
else
{
}
else
{
return
return
;
}
}
}
}
console
.
log
(
this
.
curPageData
)
}
}
});
});
}
}
...
@@ -111,8 +110,6 @@ export class JobComponent implements OnInit {
...
@@ -111,8 +110,6 @@ export class JobComponent implements OnInit {
}],
}],
};
};
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
this
.
commonService
.
addAnswer
(
this
.
pageAnswers
);
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
commonService
.
todos
)
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
if
(
this
.
pageAnswers
[
'questions'
].
length
>
0
)
{
this
.
nextBtn
=
true
;
this
.
nextBtn
=
true
;
}
else
{
}
else
{
...
@@ -139,6 +136,7 @@ export class JobComponent implements OnInit {
...
@@ -139,6 +136,7 @@ export class JobComponent implements OnInit {
return
;
return
;
}
}
}
}
// 上一步
// 上一步
before
()
{
before
()
{
this
.
commonService
.
before
();
this
.
commonService
.
before
();
...
...
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