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
2d00082b
Commit
2d00082b
authored
May 17, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改后退时出现的问题
parent
d9e02c3f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
47 deletions
+57
-47
questionnair/src/app/ask/ask.component.html
+1
-1
questionnair/src/app/page3/page3.component.ts
+56
-46
No files found.
questionnair/src/app/ask/ask.component.html
View file @
2d00082b
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
<div>
获取家庭分析报告
</div>
<div>
获取家庭分析报告
</div>
</div>
</div>
<div
class=
"content_footer"
*
ngIf=
"curPage != 0 && curPage!=16"
>
<div
class=
"content_footer"
*
ngIf=
"curPage != 0 && curPage!=16"
>
<!-- <div (click)="reducePage()" style="color: #8a8a8a;"><</div> --
>
<div
(
click
)="
reducePage
()"
style=
"color: #8a8a8a;"
>
<
</div
>
<div
<div
(
click
)="
addPage
()"
(
click
)="
addPage
()"
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
...
...
questionnair/src/app/page3/page3.component.ts
View file @
2d00082b
...
@@ -10,29 +10,31 @@ export class Page3Component implements OnInit {
...
@@ -10,29 +10,31 @@ export class Page3Component implements OnInit {
@
Input
()
isShowChildAgeBtn
:
boolean
@
Input
()
isShowChildAgeBtn
:
boolean
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
@
Output
()
getAllAnswer
=
new
EventEmitter
<
any
>
()
isShow
:
boolean
isShow
:
boolean
;
curQues
:
Object
curQues
:
Object
;
curAllQues
:
Object
curAllQues
:
Object
;
selectedNum
:
number
selectedNum
:
number
;
options
:
Array
<
any
>
options
:
Array
<
any
>
;
curQuesIndex
:
number
curQuesIndex
:
number
;
//当前问题长度
//当前问题长度
curQuesLen
:
number
curQuesLen
:
number
;
//增加孩子点击次数
//增加孩子点击次数
addChildCount
:
number
addChildCount
:
number
;
curQuestionSelecte
:
string
;
curQuestionSelecte
:
string
;
questions
:
Array
<
any
>
;
questions
:
Array
<
any
>
;
selectedObj
:
Object
;
selectedObj
:
Object
;
constructor
()
{
constructor
()
{
this
.
questions
=
[];
this
.
questions
=
[];
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
curQues
=
{}
this
.
curQues
=
{}
;
this
.
curAllQues
=
{}
this
.
curAllQues
=
{}
;
this
.
curQuesLen
=
this
.
curPageData
[
'questions'
].
length
this
.
curQuesLen
=
this
.
curPageData
[
'questions'
].
length
;
//初始化增加孩子按钮可以点2次
//初始化增加孩子按钮可以点2次
this
.
addChildCount
=
2
;
this
.
addChildCount
=
2
;
this
.
selectedOptions
();
// console.log(this.curPageData)
// console.log(this.curPageData)
}
}
...
@@ -53,12 +55,21 @@ export class Page3Component implements OnInit {
...
@@ -53,12 +55,21 @@ export class Page3Component implements OnInit {
this
.
curAllQues
[
questionId
]
=
option
this
.
curAllQues
[
questionId
]
=
option
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
]]}
})
});
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
)
{
for
(
let
j
=
0
;
j
<
this
.
questions
.
length
;
j
++
)
{
if
(
questions
[
i
][
'questionId'
]
!=
this
.
questions
[
j
][
'questionId'
])
{
questions
.
push
(
this
.
questions
[
j
]);
break
;
}
}
}
const
ret
=
{
const
ret
=
{
pageId
:
3
,
pageId
:
3
,
questions
questions
}
};
this
.
getAllAnswer
.
emit
(
ret
)
console
.
log
(
ret
);
this
.
getAllAnswer
.
emit
(
ret
);
}
}
changeStyle
(
options
,
optionId
)
{
changeStyle
(
options
,
optionId
)
{
...
@@ -71,37 +82,36 @@ export class Page3Component implements OnInit {
...
@@ -71,37 +82,36 @@ export class Page3Component implements OnInit {
}
}
// 保存用户选择的信息
// 保存用户选择的信息
// selectedOptions() {
selectedOptions
()
{
// if (this.curPageData['questions'].length > 0) {
if
(
this
.
curPageData
[
'questions'
].
length
>
0
)
{
// for (let i = 0; i < this.curPageData['questions'].length; i++) {
for
(
let
i
=
0
;
i
<
this
.
curPageData
[
'questions'
].
length
;
i
++
)
{
// if (!this.curPageData['questions'][i]['name']) {
if
(
!
this
.
curPageData
[
'questions'
][
i
][
'name'
])
{
// return;
return
;
// }
}
// let option = {};
let
option
=
{};
// let question = {
let
question
=
{
// questionId: '',
questionId
:
''
,
// options: []
options
:
[]
// };
};
// question.questionId = this.curPageData['questions'][i].questionId;
question
.
questionId
=
this
.
curPageData
[
'questions'
][
i
].
questionId
;
// option = {
option
=
{
// customerInput: null,
customerInput
:
null
,
// optionId: this.curPageData['questions'][i]['optionId'],
optionId
:
this
.
curPageData
[
'questions'
][
i
][
'optionId'
],
// optionName: this.curPageData['questions'][i]['name'],
optionName
:
this
.
curPageData
[
'questions'
][
i
][
'name'
],
// optionOrder: 2,
optionOrder
:
2
,
// selected: true
selected
:
true
// };
};
// question.options.push(option);
question
.
options
.
push
(
option
);
// this.questions.push(question);
this
.
questions
.
push
(
question
);
// }
}
// }
}
const
ret
=
{
// const ret = {
pageId
:
3
,
// pageId: 3,
questions
:
this
.
questions
// questions: this.questions
};
// }
console
.
log
(
ret
);
// console.log(ret);
this
.
getAllAnswer
.
emit
(
ret
);
// this.getAllAnswer.emit(ret);
}
// }
addChild
()
{
addChild
()
{
// this.addChildCount--
// this.addChildCount--
...
...
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