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
59f75a16
Commit
59f75a16
authored
Nov 29, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加缓存
parent
c6253af5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
17 deletions
+49
-17
questionnaire/src/app/app.component.ts
+7
-3
questionnaire/src/app/live/live.component.html
+1
-1
questionnaire/src/app/live/live.component.ts
+41
-13
No files found.
questionnaire/src/app/app.component.ts
View file @
59f75a16
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
"./common.service"
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
"./common.service"
;
@
Component
({
selector
:
'app-root'
,
...
...
@@ -12,7 +12,11 @@ export class AppComponent implements OnInit {
}
ngOnInit
()
{
const
customerId
=
this
.
commonService
.
getQueryString
(
'customerId'
);
let
customerId
=
this
.
commonService
.
getQueryString
(
'customerId'
);
const
double12_customerInfo
=
localStorage
.
getItem
(
'double12_customerInfo'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'double12_customerInfo'
))
:
null
;
if
(
double12_customerInfo
)
{
customerId
=
double12_customerInfo
.
customerId
;
}
const
orderId
=
this
.
commonService
.
getQueryString
(
'orderId'
);
if
(
customerId
)
{
sessionStorage
.
setItem
(
'customerId'
,
customerId
);
...
...
questionnaire/src/app/live/live.component.html
View file @
59f75a16
...
...
@@ -17,7 +17,7 @@
</div>
<div
class=
"content_footer"
>
<div
style=
"color: #8a8a8a;"
(
click
)="
before
()"
>
<
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
()"
>
下一步
</div>
<div
[
ngStyle
]="{
color:
nextBtn =
=
false
?
'#
8a8a8a
'
:
'#
ec2d37
'
}"
(
click
)="
next
(
null
)"
>
下一步
</div>
</div>
<div
class=
"toastWrapper toast"
*
ngIf=
"isShow"
(
click
)="
closeToast
();"
>
...
...
questionnaire/src/app/live/live.component.ts
View file @
59f75a16
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../common.service'
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../common.service'
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
@
Component
({
selector
:
'app-live'
,
...
...
@@ -49,7 +49,7 @@ export class LiveComponent implements OnInit {
questions
:
[{
questionId
:
''
,
questionName
:
''
,
options
:
[{
optionId
:
''
,
optionName
:
''
,
optionOrder
:
''
,
selected
:
''
}]
options
:
[{
optionId
:
''
,
optionName
:
''
,
optionOrder
:
''
,
selected
:
''
}]
}],
};
this
.
loginData
=
{
...
...
@@ -65,7 +65,7 @@ export class LiveComponent implements OnInit {
this
.
tipsFlag
=
false
;
this
.
lastQuestions
=
this
.
commonService
.
todosCopy
.
filter
(
item
=>
item
.
pageId
==
16
).
pop
();
// 获取省份
this
.
commonService
.
provinceqry
({
insurerId
:
11
}).
then
(
res
=>
{
this
.
commonService
.
provinceqry
({
insurerId
:
11
}).
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
provinceList
=
res
[
'data'
].
provinceList
;
}
...
...
@@ -165,7 +165,7 @@ export class LiveComponent implements OnInit {
}
}
next
()
{
next
(
type
)
{
if
(
this
.
nextBtn
==
true
)
{
const
param
=
{
survey
:
{
...
...
@@ -176,6 +176,22 @@ export class LiveComponent implements OnInit {
};
// 有campaignInfo表示 自动评测
if
(
sessionStorage
.
getItem
(
'campaignInfo'
))
{
const
double12_customerInfo
=
localStorage
.
getItem
(
'double12_customerInfo'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'double12_customerInfo'
))
:
null
;
if
(
double12_customerInfo
)
{
param
.
survey
.
customerId
=
double12_customerInfo
.
customerId
;
const
orderIdParam
=
{
name
:
double12_customerInfo
.
customerName
,
customerId
:
double12_customerInfo
.
customerId
,
campaignInfo
:
{
"campaignCode"
:
JSON
.
parse
(
sessionStorage
.
getItem
(
'campaignInfo'
))[
'campaignCode'
],
"campaignTaskCode"
:
JSON
.
parse
(
sessionStorage
.
getItem
(
'campaignInfo'
))[
'campaignTaskCode'
]
}
}
if
(
type
!==
1
)
{
this
.
getOrderId
(
orderIdParam
);
return
;
}
}
if
(
!
param
||
!
param
.
survey
.
customerId
||
param
.
survey
.
customerId
===
'null'
||
param
.
survey
.
customerId
===
'undefined'
)
{
this
.
loginModalFlag
=
true
;
return
;
...
...
@@ -232,7 +248,7 @@ export class LiveComponent implements OnInit {
this
.
errorModal
(
'手机号码输入有误'
);
return
;
}
else
if
(
this
.
loginData
.
mobileNo
)
{
this
.
commonService
.
verificationCode
({
mobileNo
:
this
.
loginData
.
mobileNo
,
type
:
'1'
}).
then
(
res
=>
{
this
.
commonService
.
verificationCode
({
mobileNo
:
this
.
loginData
.
mobileNo
,
type
:
'1'
}).
then
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
sendBtnFlag
=
true
;
this
.
errorModal
(
'发送成功'
);
...
...
@@ -276,15 +292,21 @@ export class LiveComponent implements OnInit {
}).
then
(
res
=>
{
if
(
res
[
'success'
])
{
// 登录
this
.
commonService
.
login
({
'mobileNo'
:
this
.
loginData
.
mobileNo
}).
then
(
response
=>
{
this
.
commonService
.
login
({
'mobileNo'
:
this
.
loginData
.
mobileNo
}).
then
(
response
=>
{
if
(
response
[
'success'
])
{
const
double12_customerInfo
=
{
customerId
:
response
[
'data'
][
'customerId'
],
customerName
:
this
.
loginData
.
name
,
mobileNo
:
this
.
loginData
.
mobileNo
};
localStorage
.
setItem
(
'double12_customerInfo'
,
JSON
.
stringify
(
double12_customerInfo
));
// 登录成功
this
.
loginModalFlag
=
false
;
//获取customerId后调用获取orderId接口
if
(
response
[
'data'
][
'customerId'
])
{
sessionStorage
.
setItem
(
'customerId'
,
response
[
'data'
][
'customerId'
]);
}
this
.
getOrderId
();
this
.
getOrderId
(
null
);
}
else
{
// 登录失败
this
.
errorModal
(
res
[
'message'
]);
...
...
@@ -297,9 +319,13 @@ export class LiveComponent implements OnInit {
})
}
//获取orderId后调用保存问卷
getOrderId
()
{
const
orderIdParam
=
{
// 获取orderId后调用保存问卷
getOrderId
(
obj
)
{
let
orderIdParam
;
if
(
obj
)
{
orderIdParam
=
obj
;
}
else
{
orderIdParam
=
{
name
:
this
.
loginData
.
name
,
customerId
:
sessionStorage
.
getItem
(
'customerId'
),
campaignInfo
:
{
...
...
@@ -307,10 +333,12 @@ export class LiveComponent implements OnInit {
"campaignTaskCode"
:
JSON
.
parse
(
sessionStorage
.
getItem
(
'campaignInfo'
))[
'campaignTaskCode'
]
}
}
}
this
.
commonService
.
createActivityOrder
(
orderIdParam
).
then
(
res
=>
{
if
(
res
[
'success'
])
{
sessionStorage
.
setItem
(
'orderId'
,
res
[
'data'
][
'orderId'
]);
this
.
next
();
this
.
next
(
1
);
}
else
{
this
.
errorModal
(
res
[
'message'
]);
...
...
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