Toggle navigation
Toggle navigation
This project
Loading...
Sign in
mobile
/
YH_RNComponent
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
孙凯
8 years ago
Commit
8bfd1ed582460c209fd299116b268f676c100dc4
1 parent
63e78c52
add add coupon review by hongmo
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
36 deletions
js/myAssets/components/addCoupon/AddCoupon.js
js/myAssets/containers/AddCouponContainer.js
js/myAssets/components/addCoupon/AddCoupon.js
View file @
8bfd1ed
...
...
@@ -24,15 +24,22 @@ export default class AddCoupon extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
textInputChange
=
this
.
textInputChange
.
bind
(
this
);
this
.
state
=
{
disable
:
true
,
text
:
''
,
};
}
shouldComponentUpdate
(
nextProps
){
if
(
Immutable
.
is
(
nextProps
.
resource
,
this
.
props
.
resource
))
{
return
false
;
}
else
{
return
true
;
textInputChange
(
event
)
{
let
dis
=
true
;
if
(
event
.
nativeEvent
.
text
)
{
dis
=
false
;
}
this
.
setState
({
disable
:
dis
,
text
:
event
.
nativeEvent
.
text
,
});
}
render
()
{
...
...
@@ -43,31 +50,33 @@ export default class AddCoupon extends Component {
let
needShowToast
=
data
?
data
.
showMessage
:
false
;
let
message
=
data
?
data
.
message
:
false
;
console
.
log
(
data
);
return
(
<
View
style
=
{
styles
.
container
}
>
<
TextInput
autoCapitalize
=
"none"
clearButtonMode
=
"always"
placeholder
=
{
'输入优惠劵码'
}
onChange
=
{
this
.
props
.
updateValue
}
style
=
{
styles
.
textInput
}
maxLength
=
{
50
}
underlineColorAndroid
=
"transparent"
onFocus
=
{()
=>
{
//this.props.onFocus && this.props.onFocus(refId);
}}
/
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
{
// this.props.onPressUseNow && this.props.onPressUseNow(resource)
}}
>
<
View
style
=
{{
marginTop
:
10
,
marginLeft
:
10
,
width
:
70
,
height
:
35
*
DEVICE_WIDTH_RATIO
,
backgroundColor
:
'red'
,
borderRadius
:
5
,
alignItems
:
'center'
,
justifyContent
:
'center'
}}
>
<
Text
style
=
{
styles
.
text
}
>
确定
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
contentContainer
}
>
<
TextInput
multiline
=
{
true
}
autoCapitalize
=
{
'none'
}
clearButtonMode
=
{
'always'
}
placeholder
=
{
'输入优惠劵码'
}
onChange
=
{
this
.
textInputChange
}
style
=
{
styles
.
textInput
}
maxLength
=
{
50
}
underlineColorAndroid
=
"transparent"
/
>
<
TouchableOpacity
activeOpacity
=
{
1
}
onPress
=
{()
=>
{
if
(
!
this
.
state
.
disable
)
{
let
dismissKeyboard
=
require
(
'dismissKeyboard'
);
dismissKeyboard
();
this
.
props
.
onPressOK
&&
this
.
props
.
onPressOK
(
this
.
state
.
text
)
}
}}
>
<
View
style
=
{{
marginTop
:
10
,
marginLeft
:
10
,
width
:
70
,
height
:
35
*
DEVICE_WIDTH_RATIO
,
backgroundColor
:
this
.
state
.
disable
?
'gray'
:
'red'
,
borderRadius
:
5
,
alignItems
:
'center'
,
justifyContent
:
'center'
}}
>
<
Text
style
=
{
styles
.
text
}
>
确定
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
{
needShowToast
?
<
Prompt
text
=
{
message
}
duration
=
{
1000
}
...
...
@@ -86,6 +95,9 @@ const DEVICE_WIDTH_RATIO = width / 320;
let
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
},
contentContainer
:
{
flexDirection
:
'row'
,
},
textInput
:
{
...
...
js/myAssets/containers/AddCouponContainer.js
View file @
8bfd1ed
...
...
@@ -45,23 +45,22 @@ class AddCouponContainer extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
resetReceiveCouponResult
=
this
.
resetReceiveCouponResult
.
bind
(
this
);
this
.
updateValue
=
this
.
updateValue
.
bind
(
this
);
this
.
onPressOK
=
this
.
onPressOK
.
bind
(
this
);
}
componentDidMount
()
{
// this.props.actions.addCoupon('aaaaaaaaa');
}
componentWillUnmount
()
{
}
resetReceiveCouponResult
()
{
this
.
props
.
actions
.
resetReceiveCouponResult
();
onPressOK
(
coupon_code
){
this
.
props
.
actions
.
addCoupon
(
coupon_code
);
}
updateValue
(
event
)
{
console
.
log
(
event
);
resetReceiveCouponResult
()
{
this
.
props
.
actions
.
resetReceiveCouponResult
();
}
render
()
{
...
...
@@ -71,7 +70,7 @@ class AddCouponContainer extends Component {
<
AddCoupon
resource
=
{
addCoupon
}
resetReceiveCouponResult
=
{
this
.
resetReceiveCouponResult
}
updateValue
=
{
this
.
updateValue
}
onPressOK
=
{
this
.
onPressOK
}
/
>
<
/View
>
);
...
...
Please
register
or
login
to post a comment