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
fb3f4c19
Commit
fb3f4c19
authored
May 16, 2019
by
Chao Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复多选问题
parent
f93ab19e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
94 additions
and
119 deletions
+94
-119
questionnair/src/app/ask/ask.component.ts
+10
-25
questionnair/src/app/common.service.ts
+2
-8
questionnair/src/app/page10/page10.component.ts
+0
-1
questionnair/src/app/page11/page11.component.ts
+9
-47
questionnair/src/app/page12/page12.component.ts
+13
-0
questionnair/src/app/page13/page13.component.ts
+12
-0
questionnair/src/app/page14/page14.component.ts
+12
-1
questionnair/src/app/page15/page15.component.ts
+13
-0
questionnair/src/app/page16/page16.component.ts
+1
-1
questionnair/src/app/page3/page3.component.html
+19
-19
questionnair/src/app/page3/page3.component.ts
+3
-17
No files found.
questionnair/src/app/ask/ask.component.ts
View file @
fb3f4c19
...
...
@@ -39,7 +39,7 @@ export class AskComponent implements OnInit {
this
.
curPageData
=
this
.
allQues
[
this
.
curPage
]
}
})
this
.
commonService
.
provinceqry
({
insurerId
:
11
}).
subscribe
(
res
=>
{
this
.
commonService
.
provinceqry
({
insurerId
:
11
}).
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
provinceList
=
res
[
'data'
].
provinceList
}
...
...
@@ -92,7 +92,6 @@ export class AskComponent implements OnInit {
if
(
this
.
nextBtn
===
false
){
return
;
}
console
.
log
(
this
.
questionInfo
)
this
.
allAnswers
[
this
.
curPage
]
=
this
.
questionInfo
;
if
(
this
.
curPage
<
16
)
{
//判断当前页是否有答案
...
...
@@ -124,35 +123,21 @@ export class AskComponent implements OnInit {
}
}
getAllAnswer
(
e
)
{
let
result
=
false
;
this
.
questionInfo
=
e
;
console
.
log
(
e
)
const
questions
=
e
.
questions
;
if
(
questions
.
length
>
0
){
for
(
let
i
=
0
;
i
<
questions
.
length
;
i
++
){
let
options
=
questions
[
i
].
options
;
if
(
options
.
length
>
0
){
result
=
true
;
}
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
){
this
.
nextBtn
=
true
}
}
}
if
(
this
.
curPage
<
16
)
{
//判断当前页是否有答案
if
(
this
.
curPage
==
0
||
result
||
this
.
curPage
==
5
||
this
.
curPage
==
9
)
{
this
.
nextBtn
=
true
;
}
else
{
this
.
nextBtn
=
false
;
}
if
(
this
.
curPageData
[
'questions'
].
length
==
e
[
'questions'
].
length
){
this
.
nextBtn
=
true
}
}
setCurPageData
()
{
// console.log(this.allAnswers)
const
thePateData
=
this
.
allQues
[
this
.
curPage
]
this
.
curPageData
=
thePateData
...
...
questionnair/src/app/common.service.ts
View file @
fb3f4c19
...
...
@@ -40,12 +40,6 @@ export class CommonService {
return
response
;
});
}
// async getAllInfo(){
// const res = await this.surveyInfo()
// if(res['success']){
// this.questionList = res['data']['survey'].pages
// }
// }
/**
* 获取TOKEN
...
...
@@ -62,7 +56,7 @@ export class CommonService {
const
url
=
this
.
USER_API_URL
+
'/partner/provinceqry'
;
const
res
=
await
this
.
obtainToken
();
this
.
httpOptions
.
headers
=
this
.
httpOptions
.
headers
.
set
(
'X-Authorization'
,
res
[
'data'
][
'token'
]);
return
this
.
http
.
post
(
url
,
JSON
.
stringify
(
objParam
),
this
.
httpOptions
).
pipe
(
res
=>
{
return
this
.
http
.
post
(
url
,
JSON
.
stringify
(
objParam
),
this
.
httpOptions
).
toPromise
().
then
(
res
=>
{
return
res
;
})
}
...
...
@@ -73,7 +67,7 @@ export class CommonService {
this
.
httpOptions
.
headers
=
this
.
httpOptions
.
headers
.
set
(
'X-Authorization'
,
res
[
'data'
][
'token'
]);
return
this
.
http
.
post
(
url
,
JSON
.
stringify
(
objParam
),
this
.
httpOptions
)
.
pipe
(
res
=>
{
.
toPromise
().
then
(
res
=>
{
return
res
;
})
}
...
...
questionnair/src/app/page10/page10.component.ts
View file @
fb3f4c19
...
...
@@ -10,6 +10,5 @@ export class Page10Component implements OnInit {
constructor
()
{}
ngOnInit
()
{
console
.
log
(
this
.
curPageData
)
}
}
questionnair/src/app/page11/page11.component.ts
View file @
fb3f4c19
...
...
@@ -19,7 +19,6 @@ export class Page11Component implements OnInit {
this
.
getAlloptions
()
}
getAnswer
(
options
)
{
console
.
log
(
options
)
options
[
'selected'
]
=
!
options
[
'selected'
]
for
(
let
i
=
0
;
i
<
this
.
allOptions
.
length
;
i
++
)
{
// 更改问题状态,防止重复往数组push
...
...
@@ -47,39 +46,6 @@ export class Page11Component implements OnInit {
}
}
}
// console.log(this.allOptions)
// 删掉未选中的疾病
// for (let i = 0; i < this.allOptions.length; i++){
// if (!this.allOptions[i]['selected']) {
// let index = this.allOptions.indexOf(this.allOptions[i])
// if (index > -1) {
// this.allOptions.splice(index, 1)
// }
// }
// }
// if (!this.allOption[options['optionId']]) {
// this.allOption[options['optionId']] = {}
// }
// console.log(this.allOption)
// this.allOption[options['optionId']] = {
// selected: !this.allOption[options['optionId']]['selected'],
// options
// }
// const options_ret = Object.keys(this.allOption)
// .filter(item => {
// return this.allOption[item]['selected']
// })
// .map(questionId => {
// return {
// options: this.allOption[questionId]
// }
// })
// const result = this.allOptions.filter(item=>{
// item.selected==true
// })
// console.log(result)
const
ret
=
{
// ...this.curPageData,
pageId
:
this
.
curPageData
[
'pageId'
],
...
...
@@ -101,18 +67,14 @@ export class Page11Component implements OnInit {
}
getAlloptions
(){
// const questions = this.curPageData['questions']
// if(!questions){
// return
// }
// questions[0]['options'].forEach(option => {
// if(option['selected']){
// console.log(questions)
// this.allOptions = questions[0]['options']
// // console.log(questions[0]['options'])
// // console.log(this.allOptions[question])
// }
// });
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
){
return
}
questions
[
0
][
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
]){
this
.
allOptions
.
push
(
option
)
}
});
}
}
questionnair/src/app/page12/page12.component.ts
View file @
fb3f4c19
...
...
@@ -13,6 +13,7 @@ export class Page12Component implements OnInit {
ngOnInit
()
{
this
.
allOptions
=
[]
this
.
getAlloptions
()
}
getAnswer
(
options
)
{
options
[
'selected'
]
=
!
options
[
'selected'
]
...
...
@@ -61,4 +62,16 @@ export class Page12Component implements OnInit {
return
item
[
'selected'
]
==
true
;
})
}
getAlloptions
(){
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
){
return
}
questions
[
0
][
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
]){
this
.
allOptions
.
push
(
option
)
}
});
}
}
questionnair/src/app/page13/page13.component.ts
View file @
fb3f4c19
...
...
@@ -12,6 +12,7 @@ export class Page13Component implements OnInit {
ngOnInit
()
{
this
.
allOptions
=
[]
this
.
getAlloptions
()
}
getAnswer
(
options
)
{
options
[
'selected'
]
=
!
options
[
'selected'
]
...
...
@@ -59,4 +60,15 @@ export class Page13Component implements OnInit {
return
item
[
'selected'
]
==
true
;
})
}
getAlloptions
(){
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
){
return
}
questions
[
0
][
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
]){
this
.
allOptions
.
push
(
option
)
}
});
}
}
questionnair/src/app/page14/page14.component.ts
View file @
fb3f4c19
...
...
@@ -24,6 +24,7 @@ export class Page14Component implements OnInit {
}
if
(
this
.
optionType
==
2
){
this
.
allOptions
=
[]
this
.
getAlloptions
()
}
}
...
...
@@ -121,5 +122,15 @@ export class Page14Component implements OnInit {
this
.
getManyAnswer
(
options
)
}
}
getAlloptions
(){
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
){
return
}
questions
[
0
][
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
]){
this
.
allOptions
.
push
(
option
)
}
});
}
}
questionnair/src/app/page15/page15.component.ts
View file @
fb3f4c19
...
...
@@ -26,6 +26,7 @@ export class Page15Component implements OnInit {
}
if
(
this
.
optionType
==
2
){
this
.
allOptions
=
[]
this
.
getAlloptions
()
}
}
...
...
@@ -124,5 +125,17 @@ export class Page15Component implements OnInit {
this
.
getManyAnswer
(
options
)
}
}
getAlloptions
(){
const
questions
=
this
.
curPageData
[
'questions'
]
if
(
!
questions
){
return
}
questions
[
0
][
'options'
].
forEach
(
option
=>
{
if
(
option
[
'selected'
]){
this
.
allOptions
.
push
(
option
)
}
});
}
}
questionnair/src/app/page16/page16.component.ts
View file @
fb3f4c19
...
...
@@ -59,7 +59,7 @@ export class Page16Component implements OnInit {
insurerId
:
11
,
provinceId
:
this
.
provinceId
}
this
.
commonService
.
getCityqry
(
param
).
subscribe
(
res
=>
{
this
.
commonService
.
getCityqry
(
param
).
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
cityList
=
res
[
'data'
].
cityList
// console.log(this.cityList)
...
...
questionnair/src/app/page3/page3.component.html
View file @
fb3f4c19
...
...
@@ -12,26 +12,26 @@
</li>
</ul>
</div>
<div
class=
"addChild"
*
ngIf=
"isShowChildAgeBtn"
(
click
)="
addChild
()"
>
<
!-- <
div class="addChild" *ngIf="isShowChildAgeBtn" (click)="addChild()">
<div class="icon">+</div>
<div data-toggle="modal">增加孩子年龄</div>
</div> -->
<div
class=
"toastWrapper toast"
*
ngIf=
"isShow"
(
click
)="
closeToast
()"
>
</div>
<div>
{{result}}
</div>
<div
class=
"toastWrapper toast"
*
ngIf=
"isShow"
>
<div
class=
"toastContent"
>
<ul>
<li
[
ngClass
]="{
selected:
this
.
selectedNum =
==
options
.
optionId
}"
*
ngFor=
"let options of curQues.options"
(
click
)="
closeToast
();
getAnswer
(
options
);
changeStyle
(
options
,
options
.
optionId
)
"
>
{{ options.optionName }}
</li>
</ul>
</div>
</div>
</div>
<div
class=
"toastContent"
*
ngIf=
"isShow"
>
<ul>
<li
[
ngClass
]="{
selected:
this
.
curQuestionSelecte =
==
options
.
optionName
}"
*
ngFor=
"let options of curQues.options"
(
click
)="
closeToast
();
getAnswer
(
options
);
changeStyle
(
options
,
options
.
optionId
)
"
>
{{ options.optionName }}
</li>
</ul>
</div>
questionnair/src/app/page3/page3.component.ts
View file @
fb3f4c19
...
...
@@ -20,6 +20,7 @@ export class Page3Component implements OnInit {
curQuesLen
:
number
//增加孩子点击次数
addChildCount
:
number
curQuestionSelecte
:
string
;
constructor
()
{}
ngOnInit
()
{
...
...
@@ -33,6 +34,8 @@ export class Page3Component implements OnInit {
this
.
isShow
=
true
this
.
curQues
=
question
this
.
curQuesIndex
=
idx
// console.log(question)
this
.
curQuestionSelecte
=
question
.
name
}
closeToast
()
{
this
.
isShow
=
false
...
...
@@ -55,23 +58,6 @@ export class Page3Component implements OnInit {
this
.
curPageData
[
'questions'
][
this
.
curQuesIndex
][
'name'
]
=
options
.
optionName
this
.
selectedNum
=
optionId
// for (let i = 0; i < this.curQuesLen; i++) {
// for (
// let j = 0;
// j < this.curPageData['questions'][i]['options'].length;
// j++
// ) {
// if (
// options.optionId ==
// this.curPageData['questions'][i].options[j].optionId
// ) {
// this.curPageData['questions'][i]['name'] = this.curPageData[
// 'questions'
// ][i].options[j].optionName
// }
// }
// }
}
addChild
()
{
...
...
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