Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Ad1Appraisal-Mobile
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
Ad1Appraisal-Mobile
Commits
2ebd8fb3
Commit
2ebd8fb3
authored
Mar 09, 2020
by
didam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
didam
parent
4875346d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
237 additions
and
31 deletions
+237
-31
homepageScreen.js
app/container/home/homepageScreen.js
+84
-8
profile.js
app/container/profile/profile.js
+69
-7
constants.js
app/library/constants.js
+2
-0
login.js
app/login.js
+3
-1
loginNew.js
app/loginNew.js
+51
-12
api.js
app/service/api.js
+6
-2
splashScreen.js
app/splashScreen.js
+22
-1
No files found.
app/container/home/homepageScreen.js
View file @
2ebd8fb3
...
@@ -14,6 +14,9 @@ import {
...
@@ -14,6 +14,9 @@ import {
import
{
Dropdown
}
from
'react-native-material-dropdown'
;
import
{
Dropdown
}
from
'react-native-material-dropdown'
;
import
Images
from
'../../library/images'
;
import
Images
from
'../../library/images'
;
import
api
from
'../../service/api'
;
import
api
from
'../../service/api'
;
import
reactotron
from
'reactotron-react-native'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
Constant
from
'../../library/constants'
;
class
HomePageScreen
extends
Component
{
class
HomePageScreen
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -33,7 +36,11 @@ class HomePageScreen extends Component {
...
@@ -33,7 +36,11 @@ class HomePageScreen extends Component {
},
},
],
],
arrayWarehouse
:
[],
arrayWarehouse
:
[],
selectedWarehouse
:
''
selectedWarehouse
:
''
,
visAccepted
:
false
,
visAppraisal
:
false
,
visApproved
:
false
,
username
:
''
}
}
}
}
...
@@ -47,12 +54,53 @@ class HomePageScreen extends Component {
...
@@ -47,12 +54,53 @@ class HomePageScreen extends Component {
}
else
if
(
item
==
'Appraisal'
)
{
}
else
if
(
item
==
'Appraisal'
)
{
this
.
props
.
navigation
.
navigate
(
'Appraisal'
)
this
.
props
.
navigation
.
navigate
(
'Appraisal'
)
}
else
{
}
else
{
this
.
props
.
navigation
.
navigate
(
'
MenuPenerimaan
'
)
this
.
props
.
navigation
.
navigate
(
'
Approval
'
)
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getWarehouse
()
// this.getWarehouse()
this
.
getPermissions
()
this
.
getUserWarehouse
()
this
.
getData
()
// AsyncStorage.setItem(Constant.TOKEN, 'keisiiii')
}
getPermissions
()
{
api
.
create
().
getPermission
().
then
((
response
)
=>
{
reactotron
.
log
(
response
)
if
(
response
.
data
.
status
==
'success'
)
{
this
.
setState
({
visAccepted
:
response
.
data
.
data
.
access_accepted
,
visAppraisal
:
response
.
data
.
data
.
access_appraisal
,
visApproved
:
response
.
data
.
data
.
access_approved
})
}
})
}
async
getData
()
{
var
username
=
await
AsyncStorage
.
getItem
(
Constant
.
USERNAME
)
// reactotron.log(data1)
this
.
setState
({
username
})
}
getUserWarehouse
()
{
api
.
create
().
getUserWarehouse
().
then
((
response
)
=>
{
reactotron
.
log
(
response
)
if
(
response
.
data
.
status
==
'success'
)
{
let
arrayWarehouse
=
[]
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
arrayWarehouse
.
push
({
value
:
item
.
warehouse_id
,
label
:
item
.
warehouse_name
,
code
:
item
.
warehouse_code
,
companyId
:
item
.
company_id
})
})
this
.
setState
({
arrayWarehouse
})
}
})
}
}
getWarehouse
(){
getWarehouse
(){
...
@@ -99,11 +147,14 @@ class HomePageScreen extends Component {
...
@@ -99,11 +147,14 @@ class HomePageScreen extends Component {
</LinearGradient> */
}
</LinearGradient> */
}
<
ScrollView
style
=
{{
flex
:
1
}}
>
<
ScrollView
style
=
{{
flex
:
1
}}
>
<
ImageBackground
source
=
{
Images
.
background2
}
style
=
{{
width
:
'100%'
,
height
:
200
,
justifyContent
:
'center'
}}
>
<
ImageBackground
source
=
{
Images
.
background2
}
style
=
{{
width
:
'100%'
,
height
:
200
,
justifyContent
:
'center'
}}
>
<
View
style
=
{{
alignItems
:
'center'
,
justifyContent
:
'center'
,
marginTop
:
100
}}
>
<
View
style
=
{{
alignItems
:
'center'
,
justifyContent
:
'flex-end'
,
flex
:
1
}}
>
<
Text
style
=
{{
color
:
'#fff'
,
fontSize
:
20
}}
>
DADANG
TUKIMIN
<
/Text
>
<
Text
style
=
{{
color
:
'#fff'
,
fontSize
:
20
,
marginBottom
:
20
}}
>
{
String
(
this
.
state
.
username
).
replace
(
/
\.
/g
,
' '
).
replace
(
/
\s(
.
)
/g
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})
.
replace
(
/
\s
/g
,
' '
)
.
replace
(
/^
(
.
)
/
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
alignItems
:
'flex-end'
,
justifyContent
:
'flex-end'
,
marginTop
:
20
,
paddingHorizontal
:
20
,
flexDirection
:
'row'
}}
>
<
View
style
=
{{
alignItems
:
'flex-end'
,
justifyContent
:
'flex-end'
,
marginTop
:
20
,
paddingHorizontal
:
20
,
flexDirection
:
'row'
}}
>
<
Dropdown
{
/*
<Dropdown
label='-- Warehouse --'
label='-- Warehouse --'
labelFontSize={12}
labelFontSize={12}
itemColor={'#e6e6e6'}
itemColor={'#e6e6e6'}
...
@@ -114,15 +165,40 @@ class HomePageScreen extends Component {
...
@@ -114,15 +165,40 @@ class HomePageScreen extends Component {
data={this.state.arrayWarehouse}
data={this.state.arrayWarehouse}
onChangeText={(e) => this.setState({ selectedWarehouse: e })}
onChangeText={(e) => this.setState({ selectedWarehouse: e })}
value={this.state.selectedWarehouse}
value={this.state.selectedWarehouse}
/
>
/> */
}
<
View
style
=
{{
flex
:
1
,
alignItems
:
'flex-end'
,
justifyContent
:
'center'
,
marginBottom
:
20
}}
>
{
/* <Text style={{color:'#fff'}}> Dadang Kuspriadi </Text> */
}
<
Menu
>
<
MenuTrigger
>
<
View
style
=
{{
alignItems
:
'center'
,
justifyContent
:
'center'
,
flexDirection
:
'row'
}}
>
<
Text
style
=
{{
color
:
'#fff'
}}
>
Warehouse
<
/Text
>
<
FontAwesome5Icon
size
=
{
20
}
color
=
{
'#fff'
}
name
=
{
'angle-down'
}
style
=
{{
marginLeft
:
10
,
marginBottom
:
-
5
}}
/
>
<
/View
>
<
/MenuTrigger
>
<
MenuOptions
optionsContainerStyle
=
{{
borderRadius
:
5
,
paddingVertical
:
10
,
paddingHorizontal
:
10
,
backgroundColor
:
'white'
,
width
:
null
,
height
:
null
,
marginTop
:
20
}}
>
{
this
.
state
.
arrayWarehouse
.
map
((
item
,
index
)
=>
{
return
(
<
MenuOption
style
=
{{
marginTop
:
index
==
0
?
0
:
5
,
borderBottomColor
:
'#dbdbdb'
,
borderBottomWidth
:
.
5
}}
onSelect
=
{()
=>
{
this
.
setState
({
selectedWarehouse
:
item
})}}
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
item
.
label
}
<
/Text
>
<
/MenuOption
>
)
})}
{
/* <MenuOption style={{marginTop: 5}} onSelect={() => alert('asd')}>
<Text>Warehouse 2</Text>
</MenuOption> */
}
<
/MenuOptions
>
<
/Menu
>
<
/View
>
{
/* <Text style={{color:'#fff', fontSize: 14}}> Warehouse</Text>
{
/* <Text style={{color:'#fff', fontSize: 14}}> Warehouse</Text>
<FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/> */
}
<FontAwesome5Icon name={'angle-down'} color={'#fff'} size={20} style={{marginLeft: 10, marginBottom: -1}}/> */
}
<
/View
>
<
/View
>
<
/ImageBackground
>
<
/ImageBackground
>
<
View
style
=
{{
padding
:
10
,
paddingVertical
:
20
,
flexDirection
:
'row'
,
width
:
'100%'
}}
>
<
View
style
=
{{
padding
:
10
,
paddingVertical
:
20
,
flexDirection
:
'row'
,
width
:
'100%'
}}
>
{
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
var
itemVis
=
item
==
'Penerimaan'
?
this
.
state
.
visAccepted
:
item
==
'Appraisal'
?
this
.
state
.
visAppraisal
:
this
.
state
.
visApproved
return
(
return
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleNav
(
item
)}
activeOpacity
=
{.
5
}
>
itemVis
&&
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleNav
(
item
)}
activeOpacity
=
{.
5
}
>
<
Image
source
=
{
item
==
'Penerimaan'
?
Images
.
IconPenerimaan
:
item
==
'Appraisal'
?
Images
.
IconAppraisal
:
Images
.
IconApproval
}
style
=
{{
width
:
125
,
height
:
125
,
marginLeft
:
0
}}
/
>
<
Image
source
=
{
item
==
'Penerimaan'
?
Images
.
IconPenerimaan
:
item
==
'Appraisal'
?
Images
.
IconAppraisal
:
Images
.
IconApproval
}
style
=
{{
width
:
125
,
height
:
125
,
marginLeft
:
0
}}
/
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
)
)
...
...
app/container/profile/profile.js
View file @
2ebd8fb3
...
@@ -4,27 +4,67 @@ import LinearGradient from 'react-native-linear-gradient';
...
@@ -4,27 +4,67 @@ import LinearGradient from 'react-native-linear-gradient';
import
Colors
from
'../../library/colors'
;
import
Colors
from
'../../library/colors'
;
import
FontAwesome5
from
'react-native-vector-icons/FontAwesome5'
import
FontAwesome5
from
'react-native-vector-icons/FontAwesome5'
import
MaterialIcons
from
'react-native-vector-icons/MaterialIcons'
import
MaterialIcons
from
'react-native-vector-icons/MaterialIcons'
import
{
Image
}
from
'react-native'
;
import
{
Image
,
Keyboard
}
from
'react-native'
;
import
Images
from
'../../library/images'
;
import
Images
from
'../../library/images'
;
import
AwesomeButton
from
'react-native-really-awesome-button'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
{
StackActions
,
NavigationActions
,
NavigationEvents
}
from
'react-navigation'
;
import
Constant
from
'../../library/constants'
;
class
Profile
extends
Component
{
class
Profile
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
arrayDummy
:
[
arrayDummy
:
[
{
image
:
'user-alt'
,
title
:
'DADANG TUKIMIN'
},
{
image
:
'phone'
,
title
:
'+62 8123192381'
},
{
image
:
'mail-bulk'
,
title
:
'datuk@gmail.com'
},
{
image
:
'lock'
,
title
:
'*******'
},
// {image: Images.MenuProfile, title: 'DADANG TUKIMIN' },
// {image: Images.MenuProfile, title: 'DADANG TUKIMIN' },
]
],
username
:
''
,
email
:
''
}
}
}
}
componentDidMount
()
{
this
.
getToken
()
}
navigateToLogin
(
next
)
{
next
()
AsyncStorage
.
clear
(()
=>
{
const
navigation
=
this
.
props
.
navigation
;
const
resetAction
=
StackActions
.
reset
({
index
:
0
,
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'LoginNew'
})],
});
navigation
.
dispatch
(
resetAction
)
})
}
async
getToken
()
{
var
username
=
await
AsyncStorage
.
getItem
(
Constant
.
USERNAME
)
var
email
=
await
AsyncStorage
.
getItem
(
Constant
.
EMAIL
)
username
=
String
(
username
).
replace
(
/
\.
/g
,
' '
).
replace
(
/
\s(
.
)
/g
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})
.
replace
(
/
\s
/g
,
' '
)
.
replace
(
/^
(
.
)
/
,
function
(
$1
)
{
return
$1
.
toUpperCase
();
})
// var username = await AsyncStorage.getItem(Constant.USERNAME)
var
arrayDummy
=
[]
arrayDummy
.
push
(
{
image
:
'user-alt'
,
title
:
username
},
{
image
:
'phone'
,
title
:
'+62 8123192381'
},
{
image
:
'mail-bulk'
,
title
:
email
},
{
image
:
'lock'
,
title
:
'*******'
},
)
this
.
setState
({
username
,
arrayDummy
})
// alert(token)
}
render
()
{
render
()
{
return
(
return
(
<
Container
style
=
{{
alignItems
:
'center'
}}
>
<
Container
style
=
{{
alignItems
:
'center'
}}
>
{
/* <NavigationEvents
onDidFocus={() => this.getToken()}
/> */
}
<
LinearGradient
style
=
{{
height
:
'25%'
,
width
:
'110%'
,
borderBottomLeftRadius
:
300
,
borderBottomRightRadius
:
300
,
alignItems
:
'center'
}}
colors
=
{[
'#e4b300'
,
'#e4b300'
]}
angle
=
{
155
}
useAngle
>
<
LinearGradient
style
=
{{
height
:
'25%'
,
width
:
'110%'
,
borderBottomLeftRadius
:
300
,
borderBottomRightRadius
:
300
,
alignItems
:
'center'
}}
colors
=
{[
'#e4b300'
,
'#e4b300'
]}
angle
=
{
155
}
useAngle
>
<
Text
style
=
{{
marginTop
:
50
,
fontSize
:
20
,
fontWeight
:
'bold'
}}
>
DADANG
TUKIMIN
<
/Text
>
<
Text
style
=
{{
marginTop
:
50
,
fontSize
:
20
,
fontWeight
:
'bold'
}}
>
{
this
.
state
.
username
}
<
/Text
>
<
View
style
=
{{
width
:
130
,
height
:
130
,
borderRadius
:
400
,
backgroundColor
:
'#fff'
,
marginTop
:
35
}}
>
<
View
style
=
{{
width
:
130
,
height
:
130
,
borderRadius
:
400
,
backgroundColor
:
'#fff'
,
marginTop
:
35
}}
>
<
Image
source
=
{
Images
.
UserIcons
}
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
/
>
<
Image
source
=
{
Images
.
UserIcons
}
style
=
{{
width
:
'100%'
,
height
:
'100%'
}}
/
>
<
/View
>
<
/View
>
...
@@ -53,6 +93,28 @@ class Profile extends Component {
...
@@ -53,6 +93,28 @@ class Profile extends Component {
)
)
})}
})}
<
/View
>
<
/View
>
<
View
style
=
{{
width
:
'75%'
,
borderRadius
:
100
,
alignSelf
:
'center'
,
marginBottom
:
30
,
flex
:
1
,
justifyContent
:
'flex-end'
,
marginTop
:
100
}}
>
<
AwesomeButton
width
=
{
'100%'
}
raiseLevel
=
{
3
}
springRelease
=
{
true
}
type
=
"primary"
progress
backgroundDarker
=
{
'#e3b91f'
}
backgroundShadow
=
{
'#e3c143'
}
height
=
{
50
}
borderColor
=
{
Colors
.
blackBasic
}
backgroundColor
=
{
'#e4b300'
}
backgroundProgress
=
{
'#ffef85'
}
progressLoadingTime
=
{
300
}
borderRadius
=
{
50
}
style
=
{{
alignSelf
:
'center'
}}
onPress
=
{
next
=>
{
/** Do Something **/
Keyboard
.
dismiss
this
.
navigateToLogin
(
next
)
}}
>
<
Text
style
=
{{
color
:
Colors
.
blackBasic
,
fontWeight
:
'bold'
}}
>
Logout
<
/Text
>
<
/AwesomeButton
>
<
/View
>
<
/Container
>
<
/Container
>
);
);
...
...
app/library/constants.js
View file @
2ebd8fb3
...
@@ -11,6 +11,8 @@ const Constant = {
...
@@ -11,6 +11,8 @@ const Constant = {
ROLE
:
'ROLE'
,
ROLE
:
'ROLE'
,
TOKEN_EXPR
:
'TOKEN_EXPR'
,
TOKEN_EXPR
:
'TOKEN_EXPR'
,
AVATAR
:
'AVATAR'
,
AVATAR
:
'AVATAR'
,
COMPANY
:
'COMPANY'
,
LASTACTION
:
'LASTACTION'
}
}
export
default
Constant
;
export
default
Constant
;
\ No newline at end of file
app/login.js
View file @
2ebd8fb3
...
@@ -10,6 +10,7 @@ import AwesomeButton from 'react-native-really-awesome-button';
...
@@ -10,6 +10,7 @@ import AwesomeButton from 'react-native-really-awesome-button';
import
api
from
'./service/api'
;
import
api
from
'./service/api'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
reactotron
from
'reactotron-react-native'
;
class
componentName
extends
Component
{
class
componentName
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -28,7 +29,8 @@ class componentName extends Component {
...
@@ -28,7 +29,8 @@ class componentName extends Component {
}).
then
((
Response
)
=>
{
}).
then
((
Response
)
=>
{
if
(
Response
.
data
.
status
==
'success'
)
{
if
(
Response
.
data
.
status
==
'success'
)
{
next
();
next
();
this
.
navigateToLogin
()
reactotron
.
log
(
Response
)
// this.navigateToLogin()
}
}
})
})
}
}
...
...
app/loginNew.js
View file @
2ebd8fb3
...
@@ -12,6 +12,8 @@ import api from './service/api';
...
@@ -12,6 +12,8 @@ import api from './service/api';
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
Images
from
'./library/images'
;
import
Images
from
'./library/images'
;
import
reactotron
from
'reactotron-react-native'
;
import
Constant
from
'./library/constants'
;
class
LoginScreen
extends
Component
{
class
LoginScreen
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -25,31 +27,68 @@ class LoginScreen extends Component {
...
@@ -25,31 +27,68 @@ class LoginScreen extends Component {
}
}
handleLogin
(
next
)
{
handleLogin
(
next
)
{
// api.create().login({
api
.
create
().
login
({
// username: this.state.username,
username
:
this
.
state
.
username
,
// password: this.state.password
password
:
this
.
state
.
password
// }).then((Response) => {
}).
then
((
Response
)
=>
{
// if (Response.data.status == 'success') {
reactotron
.
log
(
Response
)
if
(
Response
.
data
.
status
==
'success'
)
{
next
();
next
();
this
.
getDataUser
(
Response
.
data
.
data
.
token_mobile
,
Response
.
data
.
data
.
token_expired_mobile
,
Response
.
data
.
data
.
username
,
Response
.
data
.
data
.
user_id
,
Response
.
data
.
data
.
role_id
,
Response
.
data
.
data
.
email
,
Response
.
data
.
data
.
fullname
,
Response
.
data
.
data
.
company_id
,
Response
.
data
.
data
.
last_action
)
this
.
navigateToLogin
()
this
.
navigateToLogin
()
//
} else {
}
else
{
//
next();
next
();
//
alert(Response.data.message)
//
alert(Response.data.message)
//
}
}
//
})
})
}
}
navigateToLogin
()
{
navigateToLogin
()
{
AsyncStorage
.
clear
(()
=>
{
//
AsyncStorage.clear(() => {
const
navigation
=
this
.
props
.
navigation
;
const
navigation
=
this
.
props
.
navigation
;
const
resetAction
=
StackActions
.
reset
({
const
resetAction
=
StackActions
.
reset
({
index
:
0
,
index
:
0
,
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'HomeNavigation'
})],
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'HomeNavigation'
})],
});
});
navigation
.
dispatch
(
resetAction
)
navigation
.
dispatch
(
resetAction
)
})
//
})
}
}
async
getDataUser
(
token
,
token_expr
,
username
,
id
,
role
,
email
,
fullname
,
company
,
lastAction
)
{
reactotron
.
log
(
token
,
token_expr
,
username
,
id
,
role
,
email
,
fullname
,
company
,
lastAction
)
try
{
AsyncStorage
.
setItem
(
Constant
.
TOKEN
,
token
)
AsyncStorage
.
setItem
(
Constant
.
TOKEN_EXPR
,
token_expr
)
AsyncStorage
.
setItem
(
Constant
.
USERNAME
,
username
)
AsyncStorage
.
setItem
(
Constant
.
USER_ID
,
String
(
id
))
AsyncStorage
.
setItem
(
Constant
.
ROLE
,
role
[
0
])
AsyncStorage
.
setItem
(
Constant
.
EMAIL
,
email
)
AsyncStorage
.
setItem
(
Constant
.
FULLNAME
,
fullname
)
AsyncStorage
.
setItem
(
Constant
.
COMPANY
,
String
(
company
))
AsyncStorage
.
setItem
(
Constant
.
LASTACTION
,
lastAction
)
}
catch
{
AsyncStorage
.
setItem
(
Constant
.
TOKEN
,
''
)
AsyncStorage
.
setItem
(
Constant
.
TOKEN_EXPR
,
''
)
AsyncStorage
.
setItem
(
Constant
.
USERNAME
,
''
)
AsyncStorage
.
setItem
(
Constant
.
USER_ID
,
'USER_ID'
)
AsyncStorage
.
setItem
(
Constant
.
ROLE
,
''
)
AsyncStorage
.
setItem
(
Constant
.
EMAIL
,
''
)
AsyncStorage
.
setItem
(
Constant
.
FULLNAME
,
''
)
AsyncStorage
.
setItem
(
Constant
.
COMPANY
,
''
)
AsyncStorage
.
setItem
(
Constant
.
LASTACTION
,
''
)
}
}
render
()
{
render
()
{
return
(
return
(
<
ImageBackground
source
=
{
Images
.
background1
}
style
=
{{
flex
:
1
,
width
:
null
,
height
:
null
,
justifyContent
:
'center'
}}
resizeMode
=
{
'stretch'
}
resizeMethod
=
{
'auto'
}
>
<
ImageBackground
source
=
{
Images
.
background1
}
style
=
{{
flex
:
1
,
width
:
null
,
height
:
null
,
justifyContent
:
'center'
}}
resizeMode
=
{
'stretch'
}
resizeMethod
=
{
'auto'
}
>
...
...
app/service/api.js
View file @
2ebd8fb3
...
@@ -24,7 +24,7 @@ const create = () => {
...
@@ -24,7 +24,7 @@ const create = () => {
// alert(url)
// alert(url)
// api.setBaseURL(`${url}/api/`)
// api.setBaseURL(`${url}/api/`)
}
else
{
}
else
{
token
=
"05ddbcb9f17bc952ed1c66fa2664e63710ed869a5bbb5079dcfec4424b9057a240b758b8b45fb7f617ffba0a966ebc2dd0e392491112ec8c64a2f311492dd0f0"
token
=
res
// url = Constant.BASE_URL.MASTER + '/api/'
// url = Constant.BASE_URL.MASTER + '/api/'
// alert(url)
// alert(url)
// api.setBaseURL(`${url}/api/`)
// api.setBaseURL(`${url}/api/`)
...
@@ -45,12 +45,16 @@ const create = () => {
...
@@ -45,12 +45,16 @@ const create = () => {
const
login
=
(
value
)
=>
POST
(
'auth/login'
,
value
)
const
login
=
(
value
)
=>
POST
(
'auth/login'
,
value
)
const
getListClar
=
(
value
)
=>
api
.
post
(
'demo/get_list_clar'
,
value
)
const
getListClar
=
(
value
)
=>
api
.
post
(
'demo/get_list_clar'
,
value
)
const
getWarehouse
=
()
=>
GET
(
'demo/get_user_warehouse'
)
const
getWarehouse
=
()
=>
GET
(
'demo/get_user_warehouse'
)
const
getPermission
=
()
=>
GET
(
'demo/get_permission'
)
const
getUserWarehouse
=
()
=>
GET
(
'demo/get_user_warehouse'
)
return
{
return
{
login
,
login
,
getListClar
,
getListClar
,
getWarehouse
getWarehouse
,
getPermission
,
getUserWarehouse
}
}
}
}
...
...
app/splashScreen.js
View file @
2ebd8fb3
...
@@ -8,6 +8,7 @@ const { Value, timing } = Animated;
...
@@ -8,6 +8,7 @@ const { Value, timing } = Animated;
import
AsyncStorage
from
'@react-native-community/async-storage'
import
AsyncStorage
from
'@react-native-community/async-storage'
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
{
StackActions
,
NavigationActions
}
from
'react-navigation'
;
import
Images
from
'./library/images'
;
import
Images
from
'./library/images'
;
import
Constant
from
'./library/constants'
;
const
height
=
Dimensions
.
get
(
'screen'
).
height
const
height
=
Dimensions
.
get
(
'screen'
).
height
const
width
=
Dimensions
.
get
(
'screen'
).
width
const
width
=
Dimensions
.
get
(
'screen'
).
width
...
@@ -54,7 +55,27 @@ class SplashScreen extends Component {
...
@@ -54,7 +55,27 @@ class SplashScreen extends Component {
setTimeout
(()
=>
{
this
.
_anim2
.
start
()},
600
)
setTimeout
(()
=>
{
this
.
_anim2
.
start
()},
600
)
setTimeout
(()
=>
{
this
.
_anim4
.
start
()},
1500
)
setTimeout
(()
=>
{
this
.
_anim4
.
start
()},
1500
)
this
.
_anim5
.
start
(()
=>
{
this
.
setState
({
text
:
true
})})
this
.
_anim5
.
start
(()
=>
{
this
.
setState
({
text
:
true
})})
setTimeout
(()
=>
{
this
.
navigateToLogin
()},
2500
)
this
.
getData
()
}
async
getData
()
{
var
Token
=
await
AsyncStorage
.
getItem
(
Constant
.
TOKEN
)
alert
(
Token
)
if
(
Token
==
null
||
Token
==
'TOKEN'
||
Token
==
''
)
{
setTimeout
(()
=>
{
this
.
navigateToLogin
()},
2500
)
}
else
{
setTimeout
(()
=>
{
this
.
navigateToHomepage
()},
2500
)
}
}
navigateToHomepage
()
{
const
navigation
=
this
.
props
.
navigation
;
const
resetAction
=
StackActions
.
reset
({
index
:
0
,
actions
:
[
NavigationActions
.
navigate
({
routeName
:
'HomeNavigation'
})],
});
navigation
.
dispatch
(
resetAction
)
}
}
navigateToLogin
()
{
navigateToLogin
()
{
...
...
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