Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-ces
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
wisdom-ces
Commits
ca5ad94d
Commit
ca5ad94d
authored
Oct 17, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
color
parent
c5004ead
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
31 deletions
+59
-31
survey-write.html
src/pages/mine/mySurvey/survey-write/survey-write.html
+0
-2
survey-write.ts
src/pages/mine/mySurvey/survey-write/survey-write.ts
+59
-29
No files found.
src/pages/mine/mySurvey/survey-write/survey-write.html
View file @
ca5ad94d
...
...
@@ -27,10 +27,8 @@
</p>
<div
class=
"padding-0-16"
>
<ng-container
*
ngIf=
"item.quesType == 1"
>
<!--<p class="input-radio"><label for="{{item.id}}0"><input name="{{item.id}}" id="{{item.id}}0" value="0" type="radio">是</label></p>-->
<p
class=
"input-radio"
><input
[(
ngModel
)]="
item
.
answerdesc
"
name=
"{{item.questionQueId}}"
value=
"0"
type=
"radio"
>
是
</p>
<p
class=
"input-radio"
><input
[(
ngModel
)]="
item
.
answerdesc
"
name=
"{{item.questionQueId}}"
value=
"1"
type=
"radio"
>
否
</p>
<!--<p class="input-radio"><label for="{{item.id}}1"><input name="{{item.id}}" id="{{item.id}}1" value="1" type="radio">否</label></p>-->
</ng-container>
<!--单选题-->
<ng-container
*
ngIf=
"item.quesType == 2"
>
...
...
src/pages/mine/mySurvey/survey-write/survey-write.ts
View file @
ca5ad94d
import
{
Component
}
from
'@angular/core'
;
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
AppService
}
from
"../../../../service/appHttpService"
;
import
{
Component
}
from
'@angular/core'
;
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
AppService
}
from
"../../../../service/appHttpService"
;
@
IonicPage
()
...
...
@@ -13,8 +13,9 @@ export class SurveyWritePage {
item
;
temp
;
ansArr
=
[];
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
public
appService
:
AppService
)
{
public
appService
:
AppService
)
{
}
ionViewDidLoad
()
{
...
...
@@ -22,56 +23,85 @@ export class SurveyWritePage {
this
.
getDetail
();
}
getDetail
()
{
getDetail
()
{
const
id
=
''
;
this
.
appService
.
ObserverHttpGetAdd
(
'/wisdomgroup/modules/question/findQuesByQuestionId/'
,
this
.
item
.
id
)
.
subscribe
((
res
)
=>
{
this
.
appService
.
ObserverHttpGetAdd
(
'/wisdomgroup/modules/question/findQuesByQuestionId/'
,
this
.
item
.
id
)
.
subscribe
((
res
)
=>
{
this
.
temp
=
res
.
json
().
datalist
;
for
(
let
i
=
0
;
i
<
this
.
temp
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
temp
.
length
;
i
++
)
{
const
data
=
{
'questionId'
:
this
.
temp
[
i
].
questionId
,
'questionQueId'
:
this
.
temp
[
i
].
id
,
'answerdesc'
:
''
,
'quesType'
:
this
.
temp
[
i
].
quesType
,
'title'
:
this
.
temp
[
i
].
title
,
'quesDesc'
:
JSON
.
parse
(
this
.
temp
[
i
].
quesDesc
),
'isans'
:
'1'
'questionId'
:
this
.
temp
[
i
].
questionId
,
'questionQueId'
:
this
.
temp
[
i
].
id
,
'answerdesc'
:
''
,
'quesType'
:
this
.
temp
[
i
].
quesType
,
'title'
:
this
.
temp
[
i
].
title
,
'quesDesc'
:
JSON
.
parse
(
this
.
temp
[
i
].
quesDesc
),
'isAns'
:
this
.
temp
[
i
].
isAns
};
this
.
ansArr
.
push
(
data
);
}
console
.
log
(
this
.
ansArr
);
})
}
//多选
mutiSelect
(
i
,
index
){
this
.
ansArr
[
i
].
answerdesc
+=
","
+
index
;
console
.
log
(
this
.
ansArr
);
mutiSelect
(
i
,
index
)
{
if
(
this
.
ansArr
[
i
].
answerdesc
.
indexOf
(
index
)
!=
-
1
)
{
this
.
ansArr
[
i
].
answerdesc
=
this
.
ansArr
[
i
].
answerdesc
.
replace
(
','
+
index
,
''
);
}
else
{
this
.
ansArr
[
i
].
answerdesc
+=
","
+
index
;
}
console
.
log
(
this
.
ansArr
[
i
]);
}
submit
()
{
if
(
!
this
.
check
())
{
return
false
;
}
submit
(){
let
arrData
=
[];
for
(
let
i
=
0
;
i
<
this
.
ansArr
.
length
;
i
++
)
{
if
(
this
.
ansArr
[
i
].
quesType
==
3
)
{
for
(
let
i
=
0
;
i
<
this
.
ansArr
.
length
;
i
++
)
{
if
(
this
.
ansArr
[
i
].
quesType
==
3
)
{
let
length
=
this
.
ansArr
[
i
].
answerdesc
.
length
;
this
.
ansArr
[
i
].
answerdesc
=
this
.
ansArr
[
i
].
answerdesc
.
substr
(
1
,
length
-
1
);
this
.
ansArr
[
i
].
answerdesc
=
this
.
ansArr
[
i
].
answerdesc
.
substr
(
1
,
length
-
1
);
}
const
data
=
{
'questionId'
:
this
.
ansArr
[
i
].
questionId
,
'questionQueId'
:
this
.
ansArr
[
i
].
questionQueId
,
'answerdesc'
:
this
.
ansArr
[
i
].
answerdesc
,
'isans'
:
this
.
ansArr
[
i
].
isans
'questionId'
:
this
.
ansArr
[
i
].
questionId
,
'questionQueId'
:
this
.
ansArr
[
i
].
questionQueId
,
'answerdesc'
:
this
.
ansArr
[
i
].
answerdesc
,
'isans'
:
this
.
ansArr
[
i
].
isans
};
arrData
.
push
(
data
);
}
console
.
log
(
arrData
);
const
qData
=
{
'array'
:
JSON
.
stringify
(
arrData
)
'array'
:
JSON
.
stringify
(
arrData
)
}
this
.
appService
.
ObserverHttpPost
(
'/wisdomgroup/modules/question/create/quesuser'
,
qData
)
.
subscribe
((
res
)
=>
{
this
.
appService
.
ObserverHttpPost
(
'/wisdomgroup/modules/question/create/quesuser'
,
qData
)
.
subscribe
((
res
)
=>
{
this
.
navCtrl
.
pop
();
})
}
check
()
{
let
count
=
0
;
for
(
let
i
=
0
;
i
<
this
.
ansArr
.
length
;
i
++
)
{
if
(
this
.
ansArr
[
i
].
isAns
==
1
)
{
if
(
this
.
ansArr
[
i
].
answerdesc
==
""
)
{
this
.
appService
.
popToastView
(
'有必答题未答'
,
'middle'
,
1500
);
count
++
;
break
;
}
}
}
if
(
count
>
0
)
{
return
false
;
}
return
true
;
}
}
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