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
659869c1
Commit
659869c1
authored
Dec 13, 2019
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享码确认无误时再来绘制
parent
cf2fd5f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
src/app/my/mk-material-detail/mk-material-detail.component.ts
+21
-13
No files found.
src/app/my/mk-material-detail/mk-material-detail.component.ts
View file @
659869c1
...
...
@@ -32,6 +32,19 @@ export class MkMaterialDetailComponent implements OnInit {
};
// 发送请求保存分享码
this
.
shareCallBack
();
}
download
(
canvas
)
{
const
a
=
document
.
createElement
(
'a'
);
// 设置地址
a
.
href
=
canvas
.
toDataURL
(
'image/png'
,
1
);
// 设置下载名称
a
.
download
=
'银盾保险经纪'
;
// 触发点击事件
a
.
click
();
}
canvasPic
()
{
this
.
canvas
.
nativeElement
.
width
=
window
.
screen
.
width
;
this
.
canvas
.
nativeElement
.
height
=
window
.
screen
.
height
;
const
canvas
=
this
.
canvas
.
nativeElement
as
HTMLCanvasElement
;
...
...
@@ -64,31 +77,26 @@ export class MkMaterialDetailComponent implements OnInit {
// 绘制图像 就是绘制二维码到我们自己写的canvas中去
ctx
.
drawImage
(
shareQr
,
this
.
canvas
.
nativeElement
.
width
-
120
,
this
.
canvas
.
nativeElement
.
height
-
125
,
100
,
100
);
document
.
querySelector
(
'#bannerImg'
).
setAttribute
(
'src'
,
canvas
.
toDataURL
(
'image/png'
,
1
));
this
.
canvas
.
nativeElement
.
style
.
display
=
'none'
;
};
// 绘制字体
ctx
.
font
=
'14px 微软雅黑'
;
ctx
.
fillStyle
=
'#081a71'
;
ctx
.
fillText
(
'长按了解详情'
,
this
.
canvas
.
nativeElement
.
width
-
115
,
this
.
canvas
.
nativeElement
.
height
-
8
);
ctx
.
fillText
(
`银盾保险经纪
${
this
.
lifeCustomerInfo
.
practitionerBasicInfo
.
name
}
`
,
15
,
this
.
canvas
.
nativeElement
.
height
-
100
);
ctx
.
fillText
(
`银盾保险经纪
${
this
.
lifeCustomerInfo
[
'practitionerBasicInfo'
][
'name'
]
}
`
,
15
,
this
.
canvas
.
nativeElement
.
height
-
100
);
ctx
.
fillText
(
`手机号:
${
this
.
lifeCustomerInfo
.
mobileNo
}
`
,
15
,
this
.
canvas
.
nativeElement
.
height
-
70
);
ctx
.
fillText
(
'微信号:123456'
,
15
,
this
.
canvas
.
nativeElement
.
height
-
40
);
};
}
download
(
canvas
)
{
const
a
=
document
.
createElement
(
'a'
);
// 设置地址
a
.
href
=
canvas
.
toDataURL
(
'image/png'
,
1
);
// 设置下载名称
a
.
download
=
'银盾保险在线'
;
// 触发点击事件
a
.
click
();
}
shareCallBack
()
{
this
.
myService
.
shareCallBack
(
this
.
shareInfo
).
subscribe
(
res
=>
{
console
.
log
(
res
);
})
if
(
res
[
'success'
])
{
this
.
canvasPic
();
}
else
{
}
});
}
}
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