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
90729eff
Commit
90729eff
authored
Jan 10, 2020
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
领取页
parent
d7ae3181
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
6 deletions
+26
-6
src/components/activity/give-courses/share-content/poster/poster.js
+25
-5
src/components/activity/give-courses/share-content/poster/poster.scss
+0
-1
src/components/activity/give-courses/share-content/share-content.scss
+1
-0
No files found.
src/components/activity/give-courses/share-content/poster/poster.js
View file @
90729eff
...
@@ -60,12 +60,28 @@ class Poster extends Component {
...
@@ -60,12 +60,28 @@ class Poster extends Component {
canvas
.
width
=
canvasWidth
canvas
.
width
=
canvasWidth
canvas
.
height
=
canvasWidth
*
bg
.
height
/
bg
.
width
canvas
.
height
=
canvasWidth
*
bg
.
height
/
bg
.
width
console
.
log
(
canvas
.
width
)
console
.
log
(
scale
)
// ctx.scale(scale, scale)
ctx
.
fillStyle
=
'#fff'
ctx
.
drawImage
(
bg
,
0
,
0
,
canvas
.
width
,
canvas
.
height
)
ctx
.
fillRect
(
0
,
0
,
canvas
.
width
,
canvas
.
height
)
// ctx.drawImage(bg, 0, 0, Math.round(+canvas.style.width.slice(0, -2)), Math.round(+canvas.style.height.slice(0, -2)))
ctx
.
fillStyle
=
'#000'
ctx
.
strokeRect
(
190
,
400
,
100
,
100
)
ctx
.
scale
(
scale
,
scale
)
ctx
.
strokeRect
(
190
,
400
,
100
,
100
)
document
.
body
.
appendChild
(
canvas
)
this
.
setState
({
poster
:
canvas
.
toDataURL
()
},
()
=>
{
const
{
savePoster
}
=
this
.
props
savePoster
&&
savePoster
(
this
.
state
.
poster
)
})
return
// ctx.drawImage(bg, 0, 0, canvas.width, canvas.height)
ctx
.
drawImage
(
bg
,
0
,
0
,
Math
.
round
(
+
canvas
.
style
.
width
.
slice
(
0
,
-
2
)),
Math
.
round
(
+
canvas
.
style
.
height
.
slice
(
0
,
-
2
)))
scale
=
1
let
r
=
16
*
scale
let
r
=
16
*
scale
const
avatarImage
=
await
this
.
getImage
(
avatar
)
const
avatarImage
=
await
this
.
getImage
(
avatar
)
const
ax
=
20
*
scale
const
ax
=
20
*
scale
...
@@ -83,7 +99,8 @@ class Poster extends Component {
...
@@ -83,7 +99,8 @@ class Poster extends Component {
ctx
.
fillText
(
username
,
2
*
r
+
ax
+
(
7
*
scale
),
22
*
scale
)
ctx
.
fillText
(
username
,
2
*
r
+
ax
+
(
7
*
scale
),
22
*
scale
)
let
qrcode
=
await
this
.
getQRCodeCanvas
(
redirectUrl
,
scale
,
posterWidth
)
let
qrcode
=
await
this
.
getQRCodeCanvas
(
redirectUrl
,
scale
,
posterWidth
)
ctx
.
drawImage
(
qrcode
,
192
*
scale
,
405
*
scale
,
posterWidth
*
(
100
/
(
window
.
innerWidth
*
0.72
)),
posterWidth
*
(
100
/
(
window
.
innerWidth
*
0.72
)))
// ctx.drawImage(qrcode, 192 * scale, 405 * scale, posterWidth * (100 / (window.innerWidth * 0.72)), posterWidth * (100 / (window.innerWidth * 0.72)))
ctx
.
drawImage
(
qrcode
,
190
*
scale
,
400
*
scale
,
70
,
70
)
// 540 384 810
// 540 384 810
// 894 636 1342
// 894 636 1342
// ctx.drawImage(qrcode, 220, 450, 60, 60)
// ctx.drawImage(qrcode, 220, 450, 60, 60)
...
@@ -115,11 +132,14 @@ class Poster extends Component {
...
@@ -115,11 +132,14 @@ class Poster extends Component {
let
codeWidth
=
100
*
scale
,
codeHeight
=
100
*
scale
,
let
codeWidth
=
100
*
scale
,
codeHeight
=
100
*
scale
,
codeSize
=
posterWidth
*
(
100
/
(
window
.
innerWidth
*
0.72
))
codeSize
=
posterWidth
*
(
100
/
(
window
.
innerWidth
*
0.72
))
canvas
.
style
.
width
=
`
${
codeSize
}
px`
canvas
.
style
.
width
=
`
${
codeSize
}
px`
canvas
.
style
.
height
=
`
${
codeSize
}
px`
canvas
.
style
.
height
=
`
${
codeSize
}
px`
canvas
.
width
=
codeWidth
canvas
.
width
=
codeWidth
canvas
.
height
=
codeHeight
canvas
.
height
=
codeHeight
document
.
body
.
appendChild
(
canvas
)
return
QRCode
.
toCanvas
(
canvas
,
text
)
return
QRCode
.
toCanvas
(
canvas
,
text
)
}
}
...
...
src/components/activity/give-courses/share-content/poster/poster.scss
View file @
90729eff
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
-webkit-overflow-scrolling
:
touch
;
-webkit-overflow-scrolling
:
touch
;
-webkit-touch-callout
:
none
;
-webkit-touch-callout
:
none
;
.placard-desc
{
.placard-desc
{
width
:
100%
;
width
:
100%
;
color
:
#fff
;
color
:
#fff
;
...
...
src/components/activity/give-courses/share-content/share-content.scss
View file @
90729eff
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
padding
:
30px
0
40px
0
;
padding
:
30px
0
40px
0
;
position
:
relative
;
position
:
relative
;
text-align
:
center
;
text-align
:
center
;
font-family
:
Microsoft
YaHei
,
Helvetica
Neue
,
STHeiti
,
Helvetica
,
Arial
,
sans-serif
;
.tab
{
.tab
{
display
:
flex
;
display
:
flex
;
...
...
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