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
dc40a45f
Commit
dc40a45f
authored
Aug 23, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
poster
parent
e1acf99d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
30 deletions
+45
-30
src/components/sharePoster/index.js
+45
-30
No files found.
src/components/sharePoster/index.js
View file @
dc40a45f
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
;
import
'./index.scss'
import
'./index.scss'
;
import
{
HeaderBar
}
from
'../../common'
import
{
HeaderBar
}
from
'@/common'
;
import
{
http
,
api
,
getParam
}
from
'@/utils'
import
{
http
,
getParam
}
from
'@/utils'
;
import
QRCode
from
'qrcode'
import
QRCode
from
'qrcode'
;
import
{
Toast
}
from
'antd-mobile'
import
{
Toast
}
from
'antd-mobile'
;
class
SharePoster
extends
Component
{
class
SharePoster
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -23,7 +21,7 @@ class SharePoster extends Component {
...
@@ -23,7 +21,7 @@ class SharePoster extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getCodeWe
()
this
.
getCodeWe
()
;
http
.
get
(
`
${
API
.
home
}
/m/dist/posters/
${
getParam
(
'courseId'
)}
/
${
getParam
(
'uid'
)}
`
).
then
((
res
)
=>
{
http
.
get
(
`
${
API
.
home
}
/m/dist/posters/
${
getParam
(
'courseId'
)}
/
${
getParam
(
'uid'
)}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
this
.
setState
({
...
@@ -221,56 +219,73 @@ class SharePoster extends Component {
...
@@ -221,56 +219,73 @@ class SharePoster extends Component {
squareClick
=
(
index
)
=>
{
squareClick
=
(
index
)
=>
{
this
.
setState
({
this
.
setState
({
smallactive
:
index
smallactive
:
index
})
})
;
this
.
initCanvas
(
this
.
state
.
bgImage
,
index
);
this
.
initCanvas
(
this
.
state
.
bgImage
,
index
);
}
}
render
()
{
render
()
{
const
{
distPrice
=
{},
smallListImg
=
[],
smallactive
}
=
this
.
state
;
return
(
return
(
<
div
className
=
'share-poster'
>
<
div
className
=
'share-poster'
>
<
HeaderBar
title
=
'生成专属海报'
arrow
=
{
true
}
cart
=
{
false
}
><
/HeaderBar
>
<
HeaderBar
title
=
'生成专属海报'
arrow
=
{
true
}
cart
=
{
false
}
/
>
<
div
className
=
"total-container"
>
<
div
className
=
"total-container"
>
<
div
className
=
'placard-img-container'
id
=
'imgWrapper'
>
<
div
className
=
'placard-img-container'
id
=
'imgWrapper'
>
<
img
src
=
{
this
.
state
.
billSrc
.
src
}
alt
=
""
/>
<
img
src
=
{
this
.
state
.
billSrc
.
src
}
alt
=
""
/>
<
/div
>
<
/div
>
<
img
src
=
{
this
.
state
.
codeSrc
}
alt
=
""
id
=
'qrcode'
className
=
'placard-code'
/>
<
img
<
canvas
id
=
'canvas'
width
=
'450'
height
=
'800'
src
=
{
this
.
state
.
codeSrc
}
className
=
{
this
.
state
.
billSrc
===
''
?
''
:
'hide'
}
><
/canvas
>
alt
=
""
id
=
'qrcode'
className
=
'placard-code'
/>
<
canvas
id
=
'canvas'
width
=
'450'
height
=
'800'
className
=
{
this
.
state
.
billSrc
===
''
?
''
:
'hide'
}
/
>
<
/div
>
<
/div
>
<
div
className
=
'placard-desc'
>
<
div
className
=
'placard-desc'
>
<
span
className
=
'placard-sharetxt'
>
<
span
className
=
'placard-sharetxt'
>
长按保存海报分享给好友,每有一人通过您的分享购买该课程,您可以
长按保存海报分享给好友,每有一人通过您的分享购买该课程,您可以
{
{
this
.
state
.
distPrice
.
count_type
===
0
&&
distPrice
.
count_type
===
0
&&
<
span
className
=
'placard-price'
>
获得
{
this
.
state
.
distPrice
.
first_level_tip
}
元的佣金奖励。
<
/span
>
<
span
className
=
'placard-price'
>
获得
{
distPrice
.
first_level_tip
}
元的佣金奖励。
<
/span
>
}
}
{
{
this
.
state
.
distPrice
.
count_type
===
1
&&
distPrice
.
count_type
===
1
&&
<
span
<
span
className
=
'placard-price'
>
className
=
'placard-price'
>
获得成交金额的
{
this
.
state
.
distPrice
.
first_level_scale
}
%
作为佣金奖励。
<
/span
>
获得成交金额的
{
distPrice
.
first_level_scale
}
%
作为佣金奖励。
<
/span
>
}
}
<
/span
>
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
'placard-swiper'
>
<
div
className
=
'placard-swiper'
>
<
ul
className
=
'placard-list'
>
<
ul
className
=
'placard-list'
>
{
{
this
.
state
.
smallListImg
&&
this
.
state
.
smallListImg
.
length
>
0
&&
this
.
state
.
smallListImg
.
map
((
item
,
index
)
=>
{
smallListImg
.
length
>
0
&&
smallListImg
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
li
onClick
=
{
this
.
squareClick
.
bind
(
this
,
index
)}
key
=
{
index
}
<
li
className
=
{
this
.
state
.
smallactive
===
index
?
'active'
:
''
}
>
onClick
=
{
this
.
squareClick
.
bind
(
this
,
index
)}
<
img
src
=
{
item
.
square
}
alt
=
""
/>
key
=
{
index
}
className
=
{
smallactive
===
index
?
'active'
:
''
}
>
<
img
src
=
{
item
.
square
}
alt
=
""
/>
<
/li
>
<
/li
>
)
)
;
})
})
}
}
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
)
;
}
}
}
}
export
default
SharePoster
export
default
SharePoster
;
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