Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
eCartPro-Customer
Project
Project
Details
Activity
Releases
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
Dida Adams Arizona
eCartPro-Customer
Commits
770bef86
Commit
770bef86
authored
Aug 03, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1f49b78d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
34 deletions
+55
-34
HomePageScreen.js
App/Containers/HomePageScreen.js
+18
-8
MyAccountScreen.js
App/Containers/MyAccountScreen.js
+33
-24
Api.js
App/Services/Api.js
+4
-2
No files found.
App/Containers/HomePageScreen.js
View file @
770bef86
...
@@ -34,7 +34,8 @@ class HomePageScreen extends Component {
...
@@ -34,7 +34,8 @@ class HomePageScreen extends Component {
open
:
false
,
open
:
false
,
authView
:
false
,
authView
:
false
,
user
:
this
.
props
.
user
,
user
:
this
.
props
.
user
,
cartLength
:
0
cartLength
:
0
,
banner
:
[]
}
}
}
}
...
@@ -75,6 +76,15 @@ class HomePageScreen extends Component {
...
@@ -75,6 +76,15 @@ class HomePageScreen extends Component {
// bottomOffset: 40,
// bottomOffset: 40,
})
})
}
}
getBanner
()
{
Api
.
create
().
getBanner
().
then
((
response
)
=>
{
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
banner
:
response
.
data
.
data
})
}
console
.
log
(
response
.
data
)
})
}
drawerContent
=
()
=>
{
drawerContent
=
()
=>
{
return
(
return
(
...
@@ -148,7 +158,7 @@ class HomePageScreen extends Component {
...
@@ -148,7 +158,7 @@ class HomePageScreen extends Component {
_renderItem
=
({
item
,
index
})
=>
{
_renderItem
=
({
item
,
index
})
=>
{
return
(
return
(
<
View
style
=
{{
height
:
'100%'
}}
>
<
View
style
=
{{
height
:
'100%'
}}
>
<
Image
source
=
{
item
}
style
=
{{
width
:
Metrics
.
screenWidth
,
height
:
'100%'
}}
/
>
<
Image
source
=
{
{
uri
:
item
.
banner_image
}
}
style
=
{{
width
:
Metrics
.
screenWidth
,
height
:
'100%'
}}
/
>
<
/View
>
<
/View
>
);
);
}
}
...
@@ -168,8 +178,8 @@ class HomePageScreen extends Component {
...
@@ -168,8 +178,8 @@ class HomePageScreen extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
getCart
()
this
.
getCart
()
this
.
getAppInfo
()
this
.
getAppInfo
()
this
.
getBanner
()
if
(
this
.
state
.
user
==
null
)
{
if
(
this
.
state
.
user
==
null
)
{
this
.
setState
({
authView
:
true
})
this
.
setState
({
authView
:
true
})
}
}
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
BackHandler
.
addEventListener
(
"hardwareBackPress"
,
this
.
backAction
);
...
@@ -214,7 +224,7 @@ class HomePageScreen extends Component {
...
@@ -214,7 +224,7 @@ class HomePageScreen extends Component {
>
>
<
View
style
=
{{
marginBottom
:
-
15
}}
>
<
View
style
=
{{
marginBottom
:
-
15
}}
>
<
View
style
=
{{
zIndex
:
1
,
flexGrow
:
1
,
alignItems
:
'center'
,
width
:
'100%'
,
elevation
:
this
.
state
.
opacity
==
1
?
10
:
0
,
position
:
'absolute'
,
top
:
0
,
paddingBottom
:
10
,
paddingHorizontal
:
25
,
paddingTop
:
this
.
state
.
open
?
STATUSBAR_HEIGHT
-
10
:
STATUSBAR_HEIGHT
+
25
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
backgroundColor
:
`rgba(255, 255, 255,
${
this
.
state
.
opacity
}
)`
}}
>
<
View
style
=
{{
zIndex
:
1
,
flexGrow
:
1
,
alignItems
:
'center'
,
width
:
'100%'
,
elevation
:
this
.
state
.
opacity
==
1
?
10
:
0
,
position
:
'absolute'
,
top
:
0
,
paddingBottom
:
10
,
paddingHorizontal
:
25
,
paddingTop
:
this
.
state
.
open
?
STATUSBAR_HEIGHT
-
10
:
STATUSBAR_HEIGHT
+
25
,
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
backgroundColor
:
`rgba(255, 255, 255,
${
this
.
state
.
opacity
}
)`
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
setState
({
open
:
true
})}
style
=
{{
width
:
'1
0
%'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
setState
({
open
:
true
})}
style
=
{{
width
:
'1
5
%'
}}
>
<
FontAwesome
name
=
"bars"
size
=
{
20
}
color
=
{
this
.
state
.
opacity
>=
.
5
?
'#e3e3e3'
:
'#FFF'
}
/
>
<
FontAwesome
name
=
"bars"
size
=
{
20
}
color
=
{
this
.
state
.
opacity
>=
.
5
?
'#e3e3e3'
:
'#FFF'
}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
width
:
'70%'
,
elevation
:
this
.
state
.
opacity
==
1
?
0
:
5
,
alignItems
:
'center'
,
flexDirection
:
'row'
,
paddingVertical
:
12
,
paddingHorizontal
:
15
,
backgroundColor
:
this
.
state
.
opacity
>=
.
5
?
'#f1f1f1'
:
'#FFF'
,
borderRadius
:
25
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'ListSearchScreen'
)}
>
<
TouchableOpacity
style
=
{{
width
:
'70%'
,
elevation
:
this
.
state
.
opacity
==
1
?
0
:
5
,
alignItems
:
'center'
,
flexDirection
:
'row'
,
paddingVertical
:
12
,
paddingHorizontal
:
15
,
backgroundColor
:
this
.
state
.
opacity
>=
.
5
?
'#f1f1f1'
:
'#FFF'
,
borderRadius
:
25
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'ListSearchScreen'
)}
>
...
@@ -237,20 +247,20 @@ class HomePageScreen extends Component {
...
@@ -237,20 +247,20 @@ class HomePageScreen extends Component {
<
View
style
=
{{
height
:
450
,
width
:
'100%'
,
backgroundColor
:
'white'
}}
>
<
View
style
=
{{
height
:
450
,
width
:
'100%'
,
backgroundColor
:
'white'
}}
>
<
Carousel
<
Carousel
ref
=
{(
c
)
=>
{
this
.
_carousel
=
c
;
}}
ref
=
{(
c
)
=>
{
this
.
_carousel
=
c
;
}}
data
=
{
this
.
state
.
banner
Dummy
}
data
=
{
this
.
state
.
banner
}
renderItem
=
{
this
.
_renderItem
}
renderItem
=
{
this
.
_renderItem
}
sliderWidth
=
{
Metrics
.
screenWidth
}
sliderWidth
=
{
Metrics
.
screenWidth
}
itemWidth
=
{
Metrics
.
screenWidth
}
itemWidth
=
{
Metrics
.
screenWidth
}
autoplay
=
{
true
}
autoplay
=
{
true
}
loop
=
{
true
}
loop
=
{
true
}
loopClonesPerSide
=
{
this
.
state
.
banner
Dummy
.
length
}
loopClonesPerSide
=
{
this
.
state
.
banner
.
length
}
// layout={'stack'}
// layout={'stack'}
onSnapToItem
=
{(
index
)
=>
this
.
setState
({
activeSlide
:
index
})
}
onSnapToItem
=
{(
index
)
=>
this
.
setState
({
activeSlide
:
index
})
}
/
>
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
width
:
'100%'
,
backgroundColor
:
'transparent'
,
marginTop
:
-
100
}}
>
<
View
style
=
{{
width
:
'100%'
,
backgroundColor
:
'transparent'
,
marginTop
:
-
100
}}
>
{
this
.
state
.
banner
Dummy
.
length
>
0
&&
<
View
style
=
{{
backgroundColor
:
'transparent'
,
alignItems
:
'center'
,
width
:
"100%"
,
padding
:
20
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,}}
>
{
this
.
state
.
banner
.
length
>
0
&&
<
View
style
=
{{
backgroundColor
:
'transparent'
,
alignItems
:
'center'
,
width
:
"100%"
,
padding
:
20
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,}}
>
{
this
.
state
.
banner
Dummy
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
banner
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
View
key
=
{
index
}
style
=
{{
backgroundColor
:
this
.
state
.
activeSlide
==
index
?
'#4cc9f0'
:
'#e6e6e6'
,
width
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
height
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
borderRadius
:
10
,
marginLeft
:
index
==
0
?
0
:
10
}}
/
>
<
View
key
=
{
index
}
style
=
{{
backgroundColor
:
this
.
state
.
activeSlide
==
index
?
'#4cc9f0'
:
'#e6e6e6'
,
width
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
height
:
this
.
state
.
activeSlide
==
index
?
10
:
5
,
borderRadius
:
10
,
marginLeft
:
index
==
0
?
0
:
10
}}
/
>
)
)
...
...
App/Containers/MyAccountScreen.js
View file @
770bef86
...
@@ -66,31 +66,40 @@ class MyAccountScreen extends Component {
...
@@ -66,31 +66,40 @@ class MyAccountScreen extends Component {
}
else
if
(
type
==
'Kata Sandi'
)
{
}
else
if
(
type
==
'Kata Sandi'
)
{
this
.
props
.
navigation
.
navigate
(
'ChangePasswordScreen'
);
this
.
props
.
navigation
.
navigate
(
'ChangePasswordScreen'
);
}
else
if
(
type
==
'Keluar'
)
{
}
else
if
(
type
==
'Keluar'
)
{
this
.
props
.
authClearData
()
Alert
.
alert
(
"Konfirmasi"
,
"Apakah anda yakin ingin keluar?"
,
[
Api
.
create
().
logout
(
this
.
props
.
auth
.
user
.
data
.
user_id
).
then
((
response
)
=>
{
{
// console.log(response.data)
text
:
"Tidak"
,
Toast
.
show
({
onPress
:
()
=>
null
,
type
:
'success'
,
style
:
"cancel"
position
:
'bottom'
,
},
text1
:
'Success'
,
{
text
:
"Ya"
,
onPress
:
()
=>
{
text2
:
`
${
response
.
data
.
message
}
👋`
,
this
.
props
.
authClearData
()
visibilityTime
:
2500
,
Api
.
create
().
logout
(
this
.
props
.
auth
.
user
.
data
.
user_id
).
then
((
response
)
=>
{
autoHide
:
true
,
// console.log(response.data)
// topOffset: 100,
Toast
.
show
({
// bottomOffset: 40,
type
:
'success'
,
})
position
:
'bottom'
,
})
text1
:
'Success'
,
const
resetAction
=
StackActions
.
reset
({
text2
:
`
${
response
.
data
.
message
}
👋`
,
index
:
0
,
visibilityTime
:
2500
,
actions
:
[
autoHide
:
true
,
NavigationActions
.
navigate
({
// topOffset: 100,
routeName
:
'HomeNavigation'
,
// bottomOffset: 40,
})
})
})
],
const
resetAction
=
StackActions
.
reset
({
key
:
null
index
:
0
,
});
actions
:
[
AsyncStorage
.
clear
()
NavigationActions
.
navigate
({
this
.
props
.
navigation
.
dispatch
(
resetAction
);
routeName
:
'HomeNavigation'
,
})
],
key
:
null
});
AsyncStorage
.
clear
()
this
.
props
.
navigation
.
dispatch
(
resetAction
);
}
}
]);
}
else
{
}
else
{
}
}
...
...
App/Services/Api.js
View file @
770bef86
...
@@ -76,7 +76,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
...
@@ -76,7 +76,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
const
topUpWallet
=
(
body
)
=>
api
.
post
(
'topup_wallet'
,
body
)
const
getPaymentMethod
=
()
=>
api
.
get
(
'get_payment_method'
)
const
getPaymentMethod
=
()
=>
api
.
get
(
'get_payment_method'
)
const
getAllKupon
=
()
=>
api
.
get
(
'get_all_coupon'
)
const
getAllKupon
=
()
=>
api
.
get
(
'get_all_coupon'
)
const
getBanner
=
()
=>
api
.
get
(
'get_banner'
)
// Order
// Order
const
createOrder
=
(
body
)
=>
api
.
post
(
'create_order'
,
body
)
const
createOrder
=
(
body
)
=>
api
.
post
(
'create_order'
,
body
)
const
getOrder
=
(
body
)
=>
api
.
post
(
'get_order'
,
body
)
const
getOrder
=
(
body
)
=>
api
.
post
(
'get_order'
,
body
)
...
@@ -211,7 +212,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
...
@@ -211,7 +212,8 @@ const create = (baseURL = 'https://apiecart.eksad.com/mobile/') => {
cancelOrder
,
cancelOrder
,
getCancelReasonOrder
,
getCancelReasonOrder
,
getOrderStatus
,
getOrderStatus
,
getAllKupon
getAllKupon
,
getBanner
}
}
}
}
...
...
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