Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
e1663110
Commit
e1663110
authored
Apr 15, 2020
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海报
parent
43d32701
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
src/components/sharePoster/index.js
+16
-16
No files found.
src/components/sharePoster/index.js
View file @
e1663110
...
...
@@ -47,11 +47,11 @@ class SharePoster extends Component {
let
$height
=
800
;
let
avatarWidth
=
50
// imgList[index].poster_width // 头像宽度
let
avatarHeight
=
50
// imgList[index].poster_height // 头像高度
let
avatarPositionX
=
(
imgList
[
index
].
header_position_x
*
$width
)
// 头像x轴位置
let
avatarPositionY
=
(
imgList
[
index
].
header_position_y
*
$height
)
// 头像Y轴位置
let
avatarPositionX
=
(
imgList
[
index
].
header_position_x
*
$width
)
// 头像x轴位置
let
avatarPositionY
=
(
imgList
[
index
].
header_position_y
*
$height
)
-
18
// 头像Y轴位置
let
qrCodePositionX
=
imgList
[
index
].
qr_code_x
*
$width
// 二维码x轴位置
let
qrCodePositionY
=
imgList
[
index
].
qr_code_y
*
$height
// 二维码y轴位置
let
qrCodePositionY
=
imgList
[
index
].
qr_code_y
*
$height
+
7
// 二维码y轴位置
let
qrCodeWidth
=
(
imgList
[
index
].
qr_code_width
*
$width
)
// 二维码宽度
let
qrCodeHeight
=
(
imgList
[
index
].
qr_code_height
*
$height
)
-
avatarHeight
/
2
// 二维码高度
...
...
@@ -82,7 +82,7 @@ class SharePoster extends Component {
bgImage
.
setAttribute
(
'crossOrigin'
,
'anonymous'
);
bgImage
.
onload
=
function
()
{
context
.
drawImage
(
bgImage
,
0
,
0
,
450
,
800
);
context
.
drawImage
(
qrCodeImg
,
320
,
685
,
100
,
100
);
context
.
drawImage
(
qrCodeImg
,
qrCodePositionX
,
qrCodePositionY
,
100
,
100
);
context
.
fillStyle
=
imgList
[
index
].
username_color
;
context
.
font
=
"16px serif"
;
context
.
fillText
(
'@'
+
_this
.
state
.
name
,
(
avatarPositionX
+
avatarWidth
)
+
20
,
(
avatarPositionY
+
avatarHeight
/
2
));
...
...
@@ -228,24 +228,24 @@ class SharePoster extends Component {
const
{
distPrice
=
{},
smallListImg
=
[],
smallactive
}
=
this
.
state
;
return
(
<
div
className
=
'share-poster'
>
<
HeaderBar
title
=
'生成专属海报'
arrow
=
{
true
}
<
HeaderBar
title
=
'生成专属海报'
arrow
=
{
true
}
cart
=
{
false
}
/
>
<
div
className
=
"total-container"
>
<
div
className
=
'placard-img-container'
id
=
'imgWrapper'
>
<
img
src
=
{
this
.
state
.
billSrc
.
src
}
alt
=
""
/>
<
/div
>
<
img
src
=
{
this
.
state
.
codeSrc
}
alt
=
""
id
=
'qrcode'
<
img
src
=
{
this
.
state
.
codeSrc
}
alt
=
""
id
=
'qrcode'
className
=
'placard-code'
/>
<
canvas
id
=
'canvas'
width
=
'450'
<
canvas
id
=
'canvas'
width
=
'450'
height
=
'800'
className
=
{
this
.
state
.
billSrc
===
''
?
''
:
'hide'
}
/
>
...
...
@@ -272,8 +272,8 @@ class SharePoster extends Component {
{
smallListImg
.
length
>
0
&&
smallListImg
.
map
((
item
,
index
)
=>
{
return
(
<
li
onClick
=
{
this
.
squareClick
.
bind
(
this
,
index
)}
<
li
onClick
=
{
this
.
squareClick
.
bind
(
this
,
index
)}
key
=
{
index
}
className
=
{
smallactive
===
index
?
'active'
:
''
}
>
...
...
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