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
373a640a
Commit
373a640a
authored
May 22, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
孩子年龄
parent
fa4d8075
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
34 deletions
+120
-34
questionnaire/src/app/age/age.component.html
+1
-1
questionnaire/src/app/age/age.component.ts
+24
-5
questionnaire/src/app/family/family.component.ts
+0
-1
questionnaire/src/app/income/income.component.ts
+20
-2
questionnaire/src/app/job/job.component.ts
+39
-3
questionnaire/src/app/loan/loan.component.ts
+14
-10
questionnaire/src/app/social-security/social-security.component.html
+2
-2
questionnaire/src/app/social-security/social-security.component.ts
+20
-10
No files found.
questionnaire/src/app/age/age.component.html
View file @
373a640a
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<ul
class=
"ageContent"
>
<ul
class=
"ageContent"
>
<li
*
ngFor=
"let optionsList of this.curPageData?.questions; index as i"
>
<li
*
ngFor=
"let optionsList of this.curPageData?.questions; index as i"
>
<div>
{{ optionsList.questionName }}
</div>
<div>
{{ optionsList.questionName }}
</div>
<b
(
click
)="
showToast
(
optionsList
,
i
)"
style=
"width:35%;text-align: center;float: right"
>
<b
(
click
)="
showToast
(
optionsList
)"
style=
"width:35%;text-align: center;float: right"
>
<span
style=
"width:20%;text-align: center;"
>
{{ optionsList.optionName}}
</span>
<span
style=
"width:20%;text-align: center;"
>
{{ optionsList.optionName}}
</span>
<span
style=
"width:10%;text-align: center;float: right"
>
>
</span>
<span
style=
"width:10%;text-align: center;float: right"
>
>
</span>
</b>
</b>
...
...
questionnaire/src/app/age/age.component.ts
View file @
373a640a
...
@@ -13,7 +13,7 @@ export class AgeComponent implements OnInit {
...
@@ -13,7 +13,7 @@ export class AgeComponent implements OnInit {
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
isShow
:
boolean
;
isShow
:
boolean
;
curQues
:
any
;
curQues
:
any
;
curQuesIndex
:
number
;
pageAnswers
:
any
;
pageAnswers
:
any
;
// 可添加的孩子总个数
// 可添加的孩子总个数
totalChildLimitCount
:
number
;
totalChildLimitCount
:
number
;
...
@@ -22,7 +22,7 @@ export class AgeComponent implements OnInit {
...
@@ -22,7 +22,7 @@ export class AgeComponent implements OnInit {
// 上一次的答案
// 上一次的答案
lastQuestions
:
Array
<
any
>
;
lastQuestions
:
Array
<
any
>
;
nextBtn
:
boolean
=
false
;
nextBtn
:
boolean
=
false
;
targetObj
:
any
=
{};
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
/**
/**
* 1:单身贵族
* 1:单身贵族
...
@@ -41,7 +41,8 @@ export class AgeComponent implements OnInit {
...
@@ -41,7 +41,8 @@ export class AgeComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
console
.
log
(
this
.
commonService
.
todosCopy
)
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'
];
...
@@ -54,6 +55,25 @@ export class AgeComponent implements OnInit {
...
@@ -54,6 +55,25 @@ export class AgeComponent implements OnInit {
}
else
{
}
else
{
this
.
handleData
([]);
this
.
handleData
([]);
}
}
if
(
this
.
lastQuestions
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>
-
1
)
{
this
.
targetObj
=
option
;
}
// console.log(this.targetObj)
this
.
showToast
(
this
.
curPageData
[
'questions'
][
j
])
this
.
selectedAge
(
this
.
targetObj
);
});
}
}
}
}
else
{
return
}
// console.log(this.curPageData)
// console.log(this.curPageData)
});
});
}
}
...
@@ -106,10 +126,9 @@ export class AgeComponent implements OnInit {
...
@@ -106,10 +126,9 @@ export class AgeComponent implements OnInit {
}
}
}
}
showToast
(
question
,
idx
)
{
showToast
(
question
)
{
this
.
isShow
=
true
;
this
.
isShow
=
true
;
this
.
curQues
=
question
;
this
.
curQues
=
question
;
this
.
curQuesIndex
=
idx
;
for
(
let
i
=
0
;
i
<
question
[
'options'
].
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
question
[
'options'
].
length
;
i
++
)
{
if
(
question
.
optionName
==
question
[
'options'
][
i
].
optionName
)
{
if
(
question
.
optionName
==
question
[
'options'
][
i
].
optionName
)
{
question
[
'options'
][
i
][
'selected'
]
=
true
question
[
'options'
][
i
][
'selected'
]
=
true
...
...
questionnaire/src/app/family/family.component.ts
View file @
373a640a
...
@@ -34,7 +34,6 @@ export class FamilyComponent implements OnInit {
...
@@ -34,7 +34,6 @@ export class FamilyComponent implements OnInit {
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
commonService
.
surveyInfo
().
then
(
res
=>
{
this
.
curPageData
=
res
[
'data'
][
'survey'
][
'pages'
].
filter
(
item
=>
item
.
pageId
===
2
).
pop
();
this
.
curPageData
=
res
[
'data'
][
'survey'
][
'pages'
].
filter
(
item
=>
item
.
pageId
===
2
).
pop
();
if
(
this
.
lastQuestions
)
{
if
(
this
.
lastQuestions
)
{
this
.
lastSelectedOptionId
=
this
.
lastQuestions
[
'questions'
][
'0'
][
'options'
][
'0'
].
optionId
;
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
)
{
...
...
questionnaire/src/app/income/income.component.ts
View file @
373a640a
...
@@ -13,7 +13,8 @@ export class IncomeComponent implements OnInit {
...
@@ -13,7 +13,8 @@ export class IncomeComponent implements OnInit {
// 家庭结构
// 家庭结构
type
:
any
;
type
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -32,8 +33,9 @@ export class IncomeComponent implements OnInit {
...
@@ -32,8 +33,9 @@ export class IncomeComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
();
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
7
).
pop
();
this
.
surveyInfo
();
}
}
surveyInfo
()
{
surveyInfo
()
{
...
@@ -42,6 +44,22 @@ export class IncomeComponent implements OnInit {
...
@@ -42,6 +44,22 @@ export class IncomeComponent implements OnInit {
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'6'
];
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'6'
];
// console.log(this.curPageData)
// console.log(this.curPageData)
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
if
(
this
.
lastQuestions
){
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
}
this
.
selectedIncome
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
});
}
}
}
}
else
{
return
;
}
}
}
})
})
}
}
...
...
questionnaire/src/app/job/job.component.ts
View file @
373a640a
...
@@ -13,7 +13,8 @@ export class JobComponent implements OnInit {
...
@@ -13,7 +13,8 @@ export class JobComponent implements OnInit {
type
:
any
;
type
:
any
;
id
:
any
;
id
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -31,7 +32,6 @@ export class JobComponent implements OnInit {
...
@@ -31,7 +32,6 @@ export class JobComponent implements OnInit {
* */
* */
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
type
=
this
.
route
.
snapshot
.
queryParams
[
'type'
];
this
.
id
=
this
.
route
.
snapshot
[
'data'
][
'0'
][
'id'
];
this
.
id
=
this
.
route
.
snapshot
[
'data'
][
'0'
][
'id'
];
console
.
log
(
this
.
id
)
this
.
pageAnswers
=
{
this
.
pageAnswers
=
{
pageId
:
''
,
pageId
:
''
,
questions
:
[{
questions
:
[{
...
@@ -48,9 +48,45 @@ export class JobComponent implements OnInit {
...
@@ -48,9 +48,45 @@ export class JobComponent implements OnInit {
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
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
();
console
.
log
(
this
.
lastQuestions
)
if
(
this
.
lastQuestions
){
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
}
this
.
selectedJob
(
this
.
targetObj
);
});
}
}
}
}
else
{
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
();
if
(
this
.
lastQuestions
){
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
}
this
.
selectedJob
(
this
.
targetObj
);
});
}
}
}
}
else
{
return
}
}
}
console
.
log
(
this
.
curPageData
)
console
.
log
(
this
.
curPageData
)
}
}
...
...
questionnaire/src/app/loan/loan.component.ts
View file @
373a640a
...
@@ -43,18 +43,22 @@ export class LoanComponent implements OnInit {
...
@@ -43,18 +43,22 @@ export class LoanComponent implements OnInit {
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'7'
];
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'7'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
if
(
this
.
lastQuestions
){
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
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
this
.
selectedLoan
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
}
this
.
selectedLoan
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
});
});
}
}
}
}
}
}
else
{
return
;
}
}
}
}
console
.
log
(
this
.
pageAnswers
)
console
.
log
(
this
.
pageAnswers
)
...
...
questionnaire/src/app/social-security/social-security.component.html
View file @
373a640a
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
{{ options.optionName }}
{{ options.optionName }}
</li>
</li>
</ul>
</ul>
<div
class=
"questionTitle"
*
ngIf=
"
hasMate
"
>
<div
class=
"questionTitle"
*
ngIf=
"
this.type == 2 || this.type == 4
"
>
{{ this.curPageData?.questions[1]['questionName'] }}
{{ this.curPageData?.questions[1]['questionName'] }}
</div>
</div>
<ul
class=
"jobContent"
*
ngIf=
"
hasMate
"
>
<ul
class=
"jobContent"
*
ngIf=
"
this.type == 2 || this.type == 4
"
>
<li
<li
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
[
ngClass
]="{
selected:
options
['
selected
']
==
true
}"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
*
ngFor=
"let options of this.curPageData?.questions[1]['options']"
...
...
questionnaire/src/app/social-security/social-security.component.ts
View file @
373a640a
...
@@ -9,12 +9,12 @@ import {ActivatedRoute, Router} from "@angular/router";
...
@@ -9,12 +9,12 @@ import {ActivatedRoute, Router} from "@angular/router";
})
})
export
class
SocialSecurityComponent
implements
OnInit
{
export
class
SocialSecurityComponent
implements
OnInit
{
curPageData
:
Array
<
any
>
;
curPageData
:
Array
<
any
>
;
hasMate
:
boolean
;
// 家庭结构
// 家庭结构
type
:
any
;
type
:
any
;
nextBtn
:
boolean
;
nextBtn
:
boolean
;
pageAnswers
:
any
;
pageAnswers
:
any
;
lastQuestions
:
Array
<
any
>
;
targetObj
:
Object
=
{}
constructor
(
private
commonService
:
CommonService
,
constructor
(
private
commonService
:
CommonService
,
private
router
:
Router
,
private
router
:
Router
,
private
route
:
ActivatedRoute
)
{
private
route
:
ActivatedRoute
)
{
...
@@ -33,14 +33,9 @@ export class SocialSecurityComponent implements OnInit {
...
@@ -33,14 +33,9 @@ export class SocialSecurityComponent implements OnInit {
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
surveyInfo
();
// 判断家庭决定是否显示配偶
if
(
this
.
type
==
2
||
this
.
type
==
4
)
{
this
.
hasMate
=
true
;
}
else
{
this
.
hasMate
=
false
;
}
this
.
nextBtn
=
false
;
this
.
nextBtn
=
false
;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
9
).
pop
();
this
.
surveyInfo
();
}
}
surveyInfo
()
{
surveyInfo
()
{
...
@@ -48,7 +43,22 @@ export class SocialSecurityComponent implements OnInit {
...
@@ -48,7 +43,22 @@ export class SocialSecurityComponent implements OnInit {
if
(
res
[
'success'
])
{
if
(
res
[
'success'
])
{
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'8'
];
this
.
curPageData
=
res
[
'data'
][
'survey'
].
pages
[
'8'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
this
.
pageAnswers
.
pageId
=
this
.
curPageData
[
'pageId'
];
// console.log(this.curPageData)
if
(
this
.
lastQuestions
){
for
(
let
i
=
0
;
i
<
this
.
lastQuestions
[
'questions'
].
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
curPageData
[
'questions'
].
length
;
j
++
)
{
if
(
this
.
lastQuestions
[
'questions'
][
i
].
questionId
==
this
.
curPageData
[
'questions'
][
j
].
questionId
)
{
this
.
lastQuestions
[
'questions'
][
i
][
'options'
].
forEach
(
option
=>
{
if
(
Object
.
keys
(
option
).
indexOf
(
'optionId'
)
>-
1
){
this
.
targetObj
=
option
}
this
.
selectedSocial
(
this
.
curPageData
[
'questions'
][
j
],
this
.
targetObj
);
});
}
}
}
}
else
{
return
;
}
}
}
})
})
}
}
...
...
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