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
a432fc73
Commit
a432fc73
authored
Jun 04, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tmp
parent
b1a33eac
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
31 deletions
+33
-31
src/components/coupons/common/Coupon/index.js
+2
-2
src/components/coupons/common/ExchangeBar/index.js
+2
-2
src/components/coupons/exchange-coupons/coupons.scss
+2
-1
src/components/coupons/exchange-coupons/index.js
+6
-13
src/components/coupons/use-coupons/index.js
+20
-11
src/components/coupons/use-coupons/use-coupon.scss
+1
-2
No files found.
src/components/coupons/common/Coupon/index.js
View file @
a432fc73
import
React
,
{
Component
}
from
'react'
import
React
,
{
Pure
Component
}
from
'react'
import
'./coupon.scss'
import
classnames
from
'classnames'
class
Coupon
extends
Component
{
class
Coupon
extends
Pure
Component
{
pick
=
()
=>
{
let
{
purpose
,
select
,
invalid
}
=
this
.
props
...
...
src/components/coupons/common/ExchangeBar/index.js
View file @
a432fc73
...
...
@@ -10,7 +10,7 @@ class ExchangeBar extends Component {
}
render
()
{
const
{
onChange
,
exchange
Num
}
=
this
.
props
const
{
onChange
,
exchange
Code
}
=
this
.
props
return
(
<
div
className
=
"exchange-bar"
>
<
Input
...
...
@@ -19,7 +19,7 @@ class ExchangeBar extends Component {
type
=
{
'number'
}
/
>
<
button
className
=
{
classnames
({
active
:
exchange
Num
&&
exchangeNum
.
length
>
0
active
:
exchange
Code
&&
exchangeCode
.
length
>
0
})}
>
兑换
<
/button
>
<
/div
>
...
...
src/components/coupons/exchange-coupons/coupons.scss
View file @
a432fc73
...
...
@@ -19,6 +19,6 @@
}
.coupon-list
{
padding
:
15px
12px
;
padding
:
72px
12px
0
;
}
}
\ No newline at end of file
src/components/coupons/exchange-coupons/index.js
View file @
a432fc73
import
React
,
{
Component
}
from
'react'
import
React
,
{
Pure
Component
}
from
'react'
import
'./coupons.scss'
// import { Toast } from "antd-mobile";
...
...
@@ -25,32 +25,25 @@ const mockData = [
]
class
ExchangeCoupons
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
exchangeNum
:
''
}
class
ExchangeCoupons
extends
PureComponent
{
state
=
{
exchangeCode
:
''
}
onChange
=
(
val
)
=>
{
this
.
setState
({
exchange
Num
:
val
})
this
.
setState
({
exchange
Code
:
val
})
}
useCoupon
=
(
val
)
=>
{
console
.
log
(
val
)
}
componentDidMount
()
{
document
.
getElementsByClassName
(
'tabbar'
)[
0
].
style
.
display
=
'none'
}
render
()
{
return
(
<
div
id
=
'coupons'
>
<
ExchangeBar
onChange
=
{
this
.
onChange
}
exchange
Num
=
{
this
.
state
.
exchangeNum
}
exchange
Code
=
{
this
.
state
.
exchangeCode
}
/
>
<
Content
coupons
=
{
mockData
}
...
...
src/components/coupons/use-coupons/index.js
View file @
a432fc73
...
...
@@ -3,8 +3,7 @@ import './use-coupon.scss'
import
ExchangeaBar
from
"../common/ExchangeBar"
;
import
Coupon
from
'../common/Coupon'
import
{
WithFullSize
}
from
'@/HOCs'
import
{
http
,
api
}
from
'@/utils'
const
mockData
=
{
valid
:
[
...
...
@@ -44,12 +43,22 @@ const mockData = {
class
UseCoupon
extends
Component
{
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
selected
:
0
,
exchangeNum
:
''
}
state
=
{
selected
:
0
,
exchangeCode
:
''
,
couponList
:
[]
}
componentDidMount
(){
http
.
get
(
`
${
api
.
home
}
/m/coupon/all`
)
.
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
code
===
200
){
this
.
setState
({
couponList
:
data
.
data
})
}
})
}
select
=
(
val
)
=>
{
...
...
@@ -60,7 +69,7 @@ class UseCoupon extends Component {
}
handleChange
=
(
val
)
=>
{
this
.
setState
({
exchange
Num
:
val
})
this
.
setState
({
exchange
Code
:
val
})
}
render
()
{
...
...
@@ -123,4 +132,4 @@ function Content({coupons, selected, ...rest}) {
)
}
export
default
WithFullSize
(
UseCoupon
);
\ No newline at end of file
export
default
UseCoupon
;
\ No newline at end of file
src/components/coupons/use-coupons/use-coupon.scss
View file @
a432fc73
.use-coupon
{
height
:
100%
;
display
:
flex
;
flex-flow
:
column
;
.coupons-area
{
padding
:
15
px
12px
;
padding
:
72
px
12px
;
background
:
$bg_f5f5f5
;
flex
:
1
1
auto
;
...
...
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