Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydLife
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
Sweet Zhang
ydLife
Commits
7625427c
Commit
7625427c
authored
Feb 11, 2020
by
sweet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
产品海报对接
parent
7ee1de0b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
28 deletions
+73
-28
src/app/my/mk-material-detail/mk-material-detail.component.ts
+44
-23
src/app/my/mk-material/mk-material.component.html
+4
-4
src/app/my/mk-material/mk-material.component.ts
+17
-1
src/app/my/my.service.ts
+8
-0
No files found.
src/app/my/mk-material-detail/mk-material-detail.component.ts
View file @
7625427c
...
...
@@ -15,9 +15,11 @@ import * as uuid from 'uuid';
})
export
class
MkMaterialDetailComponent
implements
OnInit
{
@
ViewChild
(
'canvas'
)
canvas
:
ElementRef
<
any
>
;
// 区分险种 1.产险-健康险
productType
:
number
;
materialItemId
:
string
;
// 1是指itemId 是productID 2是指planid
materialItemType
:
string
;
// 海报图
productPosterPath
:
string
;
lifeCustomerInfo
:
any
;
shareInfo
:
any
;
// 自定义内容部分高度
...
...
@@ -36,26 +38,9 @@ export class MkMaterialDetailComponent implements OnInit {
ngOnInit
()
{
this
.
materialItemId
=
this
.
activateRoute
.
snapshot
.
paramMap
.
get
(
'itemId'
);
if
(
this
.
materialItemId
.
substr
(
0
,
2
)
===
'ph'
)
{
this
.
productType
=
1
;
}
this
.
materialItemType
=
this
.
activateRoute
.
snapshot
.
queryParams
[
'itemType'
];
this
.
lifeCustomerInfo
=
localStorage
.
getItem
(
'lifeCustomerInfo'
)
?
JSON
.
parse
(
localStorage
.
getItem
(
'lifeCustomerInfo'
))
:
null
;
// 分享信息
const
shareCodeUuid
=
uuid
.
v4
();
this
.
shareInfo
=
{
...
this
.
lifeCommonService
.
generateShareCode
(),
shareCode
:
shareCodeUuid
,
customerId
:
this
.
lifeCustomerInfo
.
customerId
,
productId
:
this
.
materialItemId
,
url
:
`
${
environment
.
ORIGINNAME
}
/life/
${
this
.
materialItemId
}
?shareCode=
${
shareCodeUuid
}
`
};
if
(
this
.
productType
===
1
)
{
this
.
shareInfo
.
productId
=
null
;
this
.
shareInfo
.
planId
=
this
.
materialItemId
.
substr
(
2
);
this
.
shareInfo
.
url
=
`
${
environment
.
ORIGINNAME
}
/hProductDetail/
${
this
.
materialItemId
.
substr
(
2
)}
?shareCode=
${
shareCodeUuid
}
&type=9`
;
}
// 发送请求保存分享码
this
.
shareCallBack
();
this
.
posterQuery
(
this
.
materialItemId
,
this
.
materialItemType
);
}
async
canvasPic
()
{
...
...
@@ -78,14 +63,13 @@ export class MkMaterialDetailComponent implements OnInit {
const
avatarurlY
=
this
.
canvas
.
nativeElement
.
height
-
(
this
.
contentHeight
+
50
)
/
2
*
ratio
;
// 绘制的头像在画布上的位置
const
avatarImg
=
new
Image
();
avatarImg
.
setAttribute
(
'crossOrigin'
,
'anonymous'
);
// avatarImg.src = `${environment.ORIGINNAME}/assets/img/meng.png`;
if
(
this
.
lifeCustomerInfo
.
practitionerBasicInfo
.
headImagePath
)
{
avatarImg
.
src
=
this
.
lifeCustomerInfo
.
practitionerBasicInfo
.
headImagePath
+
'?v='
+
new
Date
().
getTime
();
}
else
{
avatarImg
.
src
=
`
${
environment
.
ORIGINNAME
}
/assets/img/meng.png?v=
${
new
Date
().
getTime
()}
`
;
}
// 这里的第一张图片就是可以是你们的海报 这里注意绘制的顺序 我们要手动控制
img
.
src
=
`
${
environment
.
ORIGINNAME
}
/ydLife/assets/images/mk-material/
${
this
.
materialItemId
}
.jpg?v=
${
new
Date
().
getTime
()}
`
;
img
.
src
=
this
.
productPosterPath
;
img
.
onload
=
()
=>
{
// 加载海报图
ctx
.
drawImage
(
img
,
0
,
0
,
this
.
canvas
.
nativeElement
.
width
,
this
.
canvas
.
nativeElement
.
height
);
...
...
@@ -202,4 +186,41 @@ export class MkMaterialDetailComponent implements OnInit {
},
100
)
});
}
// 获取大图
posterQuery
(
itemId
,
itemType
)
{
this
.
myService
.
posterQuery
({
paginationInfo
:
{
noLimitFlag
:
'CONFIRM'
}
}).
subscribe
(
res
=>
{
if
(
res
[
'success'
])
{
const
posterInfos
=
res
[
'data'
][
'posterInfos'
];
const
posterInfo
=
posterInfos
.
filter
(
item
=>
item
.
itemId
==
itemId
&&
item
.
itemType
==
itemType
).
pop
();
this
.
productPosterPath
=
posterInfo
.
productPosterPath
+
'?v='
+
new
Date
().
getTime
();
// 分享信息
const
shareCodeUuid
=
uuid
.
v4
();
this
.
shareInfo
=
{
...
this
.
lifeCommonService
.
generateShareCode
(),
shareCode
:
shareCodeUuid
,
customerId
:
this
.
lifeCustomerInfo
.
customerId
,
productId
:
this
.
materialItemId
,
url
:
`
${
environment
.
ORIGINNAME
}
/life/
${
this
.
materialItemId
}
?shareCode=
${
shareCodeUuid
}
`
};
if
(
itemType
==
'2'
)
{
this
.
shareInfo
.
productId
=
null
;
this
.
shareInfo
.
planId
=
this
.
materialItemId
;
}
if
(
!
posterInfo
.
noPlanProduct
)
{
if
(
posterInfo
.
productCategoryId
==
'2'
)
{
this
.
shareInfo
.
url
=
`
${
environment
.
ORIGINNAME
}
/hProductDetail/
${
this
.
materialItemId
}
?shareCode=
${
shareCodeUuid
}
&type=7`
;
}
else
if
(
posterInfo
.
productCategoryId
==
'5'
)
{
this
.
shareInfo
.
url
=
`
${
environment
.
ORIGINNAME
}
/hProductDetail/
${
this
.
materialItemId
}
?shareCode=
${
shareCodeUuid
}
&type=9`
;
}
}
// 发送请求保存分享码
this
.
shareCallBack
();
}
});
}
}
src/app/my/mk-material/mk-material.component.html
View file @
7625427c
<div
class=
"materialContainer"
>
<div
class=
"materialItem"
*
ngFor=
"let
materialItem of materialList
s;index as i"
[
routerLink
]="['/
material
',
materialItem
.
itemId
]
"
>
<div
class=
"materialItem"
*
ngFor=
"let
posterInfo of posterInfo
s;index as i"
[
routerLink
]="['/
material
',
posterInfo
.
itemId
]"
[
queryParams
]="{
itemType:posterInfo
.
itemType
}
"
>
<div>
<img
src=
"{{
'./assets/images/mk-material/'+materialItem.itemId+'thumb.jpg'
}}"
alt=
""
class=
"img-responsive"
>
<img
src=
"{{
posterInfo.thumbnailPath
}}"
alt=
""
class=
"img-responsive"
>
</div>
<div
class=
"title"
>
{{
materialItem
.title}}
</div>
<div
class=
"title"
>
{{
posterInfo
.title}}
</div>
</div>
</div>
src/app/my/mk-material/mk-material.component.ts
View file @
7625427c
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Router
}
from
"@angular/router"
;
import
{
MyService
}
from
"../my.service"
;
@
Component
({
selector
:
'ydlife-mk-material'
,
templateUrl
:
'./mk-material.component.html'
,
...
...
@@ -7,8 +9,9 @@ import {Router} from "@angular/router";
})
export
class
MkMaterialComponent
implements
OnInit
{
materialLists
:
Array
<
any
>
;
posterInfos
:
Array
<
any
>
;
constructor
(
private
router
:
Router
)
{
constructor
(
private
router
:
Router
,
private
myService
:
MyService
)
{
}
ngOnInit
()
{
...
...
@@ -24,6 +27,19 @@ export class MkMaterialComponent implements OnInit {
{
id
:
7
,
itemId
:
'138'
,
title
:
'中信保诚祯爱减额定期寿险'
},
{
id
:
8
,
itemId
:
'139'
,
title
:
'中信保诚祯爱增额定期寿险'
}
];
this
.
posterQuery
();
}
posterQuery
()
{
this
.
myService
.
posterQuery
({
paginationInfo
:
{
noLimitFlag
:
'CONFIRM'
}
}).
subscribe
(
res
=>
{
if
(
res
[
'success'
])
{
this
.
posterInfos
=
res
[
'data'
][
'posterInfos'
];
}
});
}
}
src/app/my/my.service.ts
View file @
7625427c
...
...
@@ -10,6 +10,7 @@ export class MyService {
}
private
API
=
environment
.
BACKEND_URL_CONFIG_VALUE
;
// 保存分享码
shareCallBack
(
shareInfo
)
{
const
url
=
this
.
API
+
'/shareCallBack'
;
...
...
@@ -30,4 +31,11 @@ export class MyService {
return
this
.
http
.
post
(
url
,
JSON
.
stringify
({
id
:
id
,
announcementTypeId
:
announcementTypeId
}));
}
// 产品海报
posterQuery
(
paginationInfo
)
{
const
url
=
this
.
API
+
'/posterQuery'
;
return
this
.
http
.
post
(
url
,
JSON
.
stringify
(
paginationInfo
));
}
}
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