Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InvestCustomer
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
1
Merge Requests
1
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
Giang Tran
InvestCustomer
Commits
b9b63375
Commit
b9b63375
authored
May 10, 2021
by
Nguyễn Thị Thúy
Browse files
Options
Browse Files
Download
Plain Diff
complete integrate price api
parents
999be0f6
dc328c41
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
402 additions
and
61 deletions
+402
-61
project.pbxproj
ios/Invest.xcodeproj/project.pbxproj
+2
-2
Info.plist
ios/Invest/Info.plist
+2
-0
Functions.js
src/Config/Functions.js
+14
-1
RootView.js
src/RootView.js
+1
-1
AccountVerificationView.js
src/Screens/AccountVerification/AccountVerificationView.js
+10
-2
GeneralInfor.js
src/Screens/AccountVerification/Tab/GeneralInfor.js
+25
-8
Profile.js
src/Screens/AccountVerification/Tab/Profile.js
+7
-5
Home.js
src/Screens/Home/Home.js
+24
-22
HomeView.js
src/Screens/Home/HomeView.js
+7
-5
SwiperComponent.js
src/Screens/Home/SwiperComponent.js
+4
-3
users.js
src/apis/Functions/users.js
+5
-0
url.js
src/apis/url.js
+2
-0
images.js
src/assets/images.js
+1
-0
imagePicker.png
src/assets/images/imagePicker.png
+0
-0
HeaderHome.js
src/components/Header/HeaderHome.js
+41
-3
PickerAvatart.js
src/components/Picker/PickerAvatart.js
+235
-0
PickerImg.js
src/components/Picker/PickerImg.js
+2
-0
PickerImgUni.js
src/components/Picker/PickerImgUni.js
+4
-2
SnackBar.js
src/components/SnackBar.js
+4
-2
en.js
src/helper/i18/locales/en.js
+2
-0
vn.js
src/helper/i18/locales/vn.js
+6
-4
TabNavigation.js
src/routers/TabNavigation.js
+4
-1
No files found.
ios/Invest.xcodeproj/project.pbxproj
View file @
b9b63375
...
...
@@ -903,7 +903,7 @@
CODE_SIGN_ENTITLEMENTS
=
Invest/Invest.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
3
;
CURRENT_PROJECT_VERSION
=
5
;
DEVELOPMENT_TEAM
=
MXZ24GRH48
;
ENABLE_BITCODE
=
NO
;
GCC_PREPROCESSOR_DEFINITIONS
=
(
...
...
@@ -937,7 +937,7 @@
CODE_SIGN_ENTITLEMENTS
=
Invest/Invest.entitlements
;
CODE_SIGN_IDENTITY
=
"Apple Development"
;
CODE_SIGN_STYLE
=
Automatic
;
CURRENT_PROJECT_VERSION
=
3
;
CURRENT_PROJECT_VERSION
=
5
;
DEVELOPMENT_TEAM
=
MXZ24GRH48
;
INFOPLIST_FILE
=
Invest/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
...
...
ios/Invest/Info.plist
View file @
b9b63375
...
...
@@ -24,6 +24,8 @@
<
string
>
$
(
MARKETING_VERSION
)<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
UIRequiresFullScreen
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
CFBundleURLTypes
<
/k
e
y
>
<
a
rr
a
y
>
<
d
i
c
t
>
...
...
src/Config/Functions.js
View file @
b9b63375
...
...
@@ -11,13 +11,15 @@ import _ from 'lodash';
import
I18n
from
'../helper/i18/i18n'
;
import
AppText
from
'../components/AppText'
;
import
{
DETAILNEW
,
NOTIFICATION
}
from
'../routers/ScreenNames'
;
import
{
DETAILNEW
,
TABNAVIGATOR
}
from
'../routers/ScreenNames'
;
import
R
from
'../assets/R'
;
export
const
convertScreen
=
(
name
)
=>
{
switch
(
name
)
{
case
'CUSTOMER_NEWS'
:
return
DETAILNEW
;
case
'CUSTOMER_NOTIFICATION'
:
return
TABNAVIGATOR
;
default
:
return
DETAILNEW
;
}
...
...
@@ -60,6 +62,17 @@ export const renderStatus = (status) => {
}}
/
>
);
case
4
:
return
(
<
AppText
i18nKey
=
{
'RejectVerify'
}
style
=
{{
color
:
'#F99D1D'
,
fontSize
:
getFontXD
(
42
),
fontWeight
:
'bold'
,
}}
/
>
);
case
3
:
return
(
<
AppText
...
...
src/RootView.js
View file @
b9b63375
...
...
@@ -32,13 +32,13 @@ const RootView = (props) => {
return
(
<>
<
View
style
=
{{
flex
:
1
}}
>
{
/* <DropDown /> */
}
<
Modal
isVisible
=
{
props
.
loadingModal
.
isVisible
}
>
<
SkypeIndicator
color
=
{
'white'
}
/
>
<
/Modal
>
<
StackNavigation
/>
<
/View
>
{
/*<VersionChecker/>*/
}
{
/* <DropDown /> */
}
<
NoInternetComponent
/>
<
/
>
...
...
src/Screens/AccountVerification/AccountVerificationView.js
View file @
b9b63375
...
...
@@ -33,12 +33,20 @@ const AccountVerificationView = (props) => {
}}
>
<
Tab
.
Screen
name
=
"GeneralInfor"
component
=
{
props
.
user
.
status
==
1
?
GeneralInfor
:
GeneralView
}
component
=
{
props
.
user
.
status
==
1
||
props
.
user
.
status
==
4
?
GeneralInfor
:
GeneralView
}
options
=
{{
tabBarLabel
:
I18n
.
t
(
'GeneralInformation'
)}}
/
>
<
Tab
.
Screen
name
=
"Profile"
component
=
{
props
.
user
.
status
==
1
?
Profile
:
ProfileView
}
component
=
{
props
.
user
.
status
==
1
||
props
.
user
.
status
==
4
?
Profile
:
ProfileView
}
options
=
{{
tabBarLabel
:
I18n
.
t
(
'Profile'
)}}
/
>
<
/Tab.Navigator
>
...
...
src/Screens/AccountVerification/Tab/GeneralInfor.js
View file @
b9b63375
...
...
@@ -13,7 +13,7 @@ import {
Keyboard
,
}
from
'react-native'
;
import
R
from
'../../../assets/R'
;
import
moment
from
'moment
'
;
import
{
connect
}
from
'react-redux
'
;
import
TextField
from
'../../../components/Input/TextField'
;
import
TextMulti
from
'../../../components/Input/TextMulti'
;
...
...
@@ -24,13 +24,21 @@ import I18n from '../../../helper/i18/i18n';
import
{
checkFormatArray
,
convertTime
}
from
'../../../Config/Functions'
;
const
GeneralInfor
=
(
props
)
=>
{
const
[
lastName
,
setLastName
]
=
useState
(
''
);
const
[
firstName
,
setFirstName
]
=
useState
(
''
);
const
[
phone
,
setPhone
]
=
useState
(
''
);
const
[
address
,
setAdress
]
=
useState
(
''
);
const
[
birth
,
setBirth
]
=
useState
(
new
Date
());
const
[
lastName
,
setLastName
]
=
useState
(
props
.
user
.
l_name
);
const
[
firstName
,
setFirstName
]
=
useState
(
props
.
user
.
f_name
);
const
[
phone
,
setPhone
]
=
useState
(
props
.
user
.
phone
);
const
[
address
,
setAdress
]
=
useState
(
props
.
user
.
address
);
const
[
birth
,
setBirth
]
=
useState
(
new
Date
(
props
.
user
.
birthday
));
console
.
log
(
'User'
,
props
.
user
);
const
onNextPress
=
()
=>
{
const
titles
=
[
I18n
.
t
(
'FirstLastName'
).
toLowerCase
(),
I18n
.
t
(
'Name'
).
toLowerCase
(),
I18n
.
t
(
'PhoneNumber'
).
toLowerCase
(),
I18n
.
t
(
'Address'
).
toLowerCase
()];
const
titles
=
[
I18n
.
t
(
'FirstLastName'
).
toLowerCase
(),
I18n
.
t
(
'Name'
).
toLowerCase
(),
I18n
.
t
(
'PhoneNumber'
).
toLowerCase
(),
I18n
.
t
(
'Address'
).
toLowerCase
(),
];
const
index
=
checkFormatArray
([
lastName
,
firstName
,
phone
,
address
]);
if
(
index
===
true
)
{
props
.
navigation
.
navigate
(
'Profile'
,
{
...
...
@@ -59,6 +67,7 @@ const GeneralInfor = (props) => {
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
TextField
value
=
{
lastName
}
title
=
{
I18n
.
t
(
'FirstLastName'
)}
onChangeText
=
{(
val
)
=>
setLastName
(
val
)}
/
>
...
...
@@ -66,12 +75,14 @@ const GeneralInfor = (props) => {
<
View
style
=
{{
width
:
20
}}
/
>
<
View
style
=
{{
flex
:
1
}}
>
<
TextField
value
=
{
firstName
}
title
=
{
I18n
.
t
(
'Name'
)}
onChangeText
=
{(
val
)
=>
setFirstName
(
val
)}
/
>
<
/View
>
<
/View
>
<
TextField
value
=
{
phone
}
isNumber
=
{
true
}
title
=
{
I18n
.
t
(
'PhoneNumber'
)}
onChangeText
=
{(
val
)
=>
setPhone
(
val
)}
...
...
@@ -85,6 +96,7 @@ const GeneralInfor = (props) => {
/
>
<
TextMulti
value
=
{
address
}
title
=
{
I18n
.
t
(
'Address'
)}
onChangeText
=
{(
val
)
=>
setAdress
(
val
)}
/
>
...
...
@@ -123,4 +135,9 @@ const styles = StyleSheet.create({
},
});
export
default
GeneralInfor
;
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{})(
GeneralInfor
);
src/Screens/AccountVerification/Tab/Profile.js
View file @
b9b63375
...
...
@@ -48,11 +48,10 @@ const dataType = [
];
const
Profile
=
(
props
)
=>
{
const
[
urlFont
,
setUrlFont
]
=
useState
(
''
);
const
[
urlBack
,
setUrlBack
]
=
useState
(
''
);
const
[
urlSign
,
setUrlSign
]
=
useState
(
''
);
// const [cmnd, setCMND] = useState('');
// const [date_range, setDate_range] = useState(new Date());
const
[
urlFont
,
setUrlFont
]
=
useState
(
props
.
user
.
identity_before
);
const
[
urlBack
,
setUrlBack
]
=
useState
(
props
.
user
.
identity_after
);
const
[
urlSign
,
setUrlSign
]
=
useState
(
props
.
user
.
sign_img
);
const
[
type
,
setType
]
=
useState
();
const
createFormData
=
(
identity_after
,
identity_before
,
sign_img
,
body
)
=>
{
...
...
@@ -172,14 +171,17 @@ const Profile = (props) => {
flex
:
1
,
}}
>
<
PickerImgUni
uriImage
=
{
urlFont
}
onSelectImg
=
{(
path
)
=>
setUrlFont
(
path
)}
title
=
{
I18n
.
t
(
'IdentityCardFrontPhoto'
)}
/
>
<
PickerImgUni
uriImage
=
{
urlBack
}
onSelectImg
=
{(
path
)
=>
setUrlBack
(
path
)}
title
=
{
I18n
.
t
(
'IdentityCardBackPhoto'
)}
/
>
<
PickerImgUni
uriImage
=
{
urlSign
}
onSelectImg
=
{(
path
)
=>
setUrlSign
(
path
)}
title
=
{
I18n
.
t
(
'SignPhoto'
)}
/
>
...
...
src/Screens/Home/Home.js
View file @
b9b63375
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Alert
,
Platform
}
from
'react-native'
;
import
{
View
,
Alert
,
Platform
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
getTransaction
}
from
'../../apis/Functions/users'
;
import
{
getImagesHome
}
from
'../../apis/Functions/General'
;
...
...
@@ -13,36 +13,38 @@ import _ from 'lodash';
const
Home
=
(
props
)
=>
{
const
[
data
,
setData
]
=
useState
({
total_deposit
:
0
,
total_withdraw
:
0
});
const
[
dataPrice
,
setDataPrice
]
=
useState
([
]);
const
[
dataPriceFilter
,
setDataPriceFilter
]
=
useState
([
]);
const
[
dataPrice
,
setDataPrice
]
=
useState
([]);
const
[
dataPriceFilter
,
setDataPriceFilter
]
=
useState
([]);
const
[
listImage
,
setListImage
]
=
useState
([]);
const
[
filters
,
setFilters
]
=
useState
([]);
const
[
filterId
,
setFilterId
]
=
useState
(
-
1
);
useEffect
(()
=>
{
getData
();
initSocket
()
initSocket
()
;
},
[]);
useEffect
(()
=>
{
const
newList
=
filterId
==
-
1
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
item
=>
item
.
category_id
==
filterId
)
setDataPriceFilter
(
newList
)
const
newList
=
filterId
==
-
1
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
item
=>
item
.
category_id
==
filterId
)
;
setDataPriceFilter
(
newList
)
;
},
[
dataPrice
]);
const
initSocket
=
()
=>
{
let
io
=
require
(
'socket.io-client'
);
let
socket
=
io
.
connect
(
'http://222.252.22.174:8087'
,
{
transports
:
[
'websocket'
],
jsonp
:
false
,
reconnect
:
true
});
let
socket
=
io
.
connect
(
'http://222.252.22.174:8087'
,
{
transports
:
[
'websocket'
],
jsonp
:
false
,
reconnect
:
true
,
});
socket
.
on
(
'response-update-price'
,
(
message
)
=>
{
receivedMessage
(
message
)
receivedMessage
(
message
)
;
});
}
}
;
const
receivedMessage
=
(
message
)
=>
{
setDataPrice
(
message
)
}
setDataPrice
(
message
)
;
}
;
const
getData
=
async
()
=>
{
props
.
showLoading
()
props
.
showLoading
()
;
const
res
=
await
getTransaction
({});
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
setData
(
res
.
data
.
data
);
...
...
@@ -63,7 +65,7 @@ const Home = (props) => {
page_index
:
1
,
type
:
'PRODUCT'
,
});
console
.
log
(
resCategoryProduct
)
console
.
log
(
resCategoryProduct
)
;
if
((
resCategoryProduct
.
data
.
code
=
200
&&
resCategoryProduct
.
data
.
data
))
{
let
data
=
[];
data
.
push
({
id
:
-
1
,
name
:
'All'
});
...
...
@@ -78,16 +80,16 @@ const Home = (props) => {
}
else
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'Can_not_get_data'
));
}
props
.
hideLoading
()
console
.
log
(
'filterId'
,
filterId
)
props
.
hideLoading
()
;
console
.
log
(
'filterId'
,
filterId
)
;
};
const
changeFilter
=
(
id
)
=>
{
setFilterId
(
id
)
const
newList
=
id
==
-
1
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
item
=>
item
.
category_id
==
id
)
setDataPriceFilter
(
newList
)
console
.
log
(
id
,
newList
)
}
setFilterId
(
id
)
;
const
newList
=
id
==
-
1
?
[...
dataPrice
]
:
_
.
filter
([...
dataPrice
],
item
=>
item
.
category_id
==
id
)
;
setDataPriceFilter
(
newList
)
;
console
.
log
(
id
,
newList
)
;
}
;
return
<
HomeView
data
=
{
data
}
...
...
src/Screens/Home/HomeView.js
View file @
b9b63375
...
...
@@ -20,12 +20,14 @@ const HomeView = (props) => {
<
HeaderHome
/>
{
props
.
listImage
.
length
>
0
?
(
<
SwiperComponent
listImage
=
{
props
.
listImage
}
/
>
)
:
null
}
)
:
(
<
View
style
=
{{
height
:
10
}}
/
>
)}
<
PriceListView
setFilterId
=
{
props
.
setFilterId
}
filterId
=
{
props
.
filterId
}
filters
=
{
props
.
filters
}
dataPrice
=
{
props
.
dataPrice
}
setFilterId
=
{
props
.
setFilterId
}
filterId
=
{
props
.
filterId
}
filters
=
{
props
.
filters
}
dataPrice
=
{
props
.
dataPrice
}
/
>
<
/ScrollView
>
<
/ImageBackground
>
...
...
src/Screens/Home/SwiperComponent.js
View file @
b9b63375
...
...
@@ -9,6 +9,7 @@ const styles = StyleSheet.create({
container
:
{
marginHorizontal
:
20
,
marginBottom
:
10
,
borderRadius
:
5
,
height
:
HEIGHTXD
(
400
),
marginTop
:
25
,
...
...
@@ -42,21 +43,21 @@ const SwiperComponent = (props) => {
autoplay
=
{
true
}
>
<
View
style
=
{{
borderRadius
:
10
}}
>
<
Image
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
10
}}
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
5
}}
source
=
{{
uri
:
props
.
listImage
[
0
].
url
}}
resizeMode
=
{
'cover'
}
/
>
<
/View
>
<
View
style
=
{{
borderRadius
:
10
}}
>
<
Image
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
10
}}
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
5
}}
source
=
{{
uri
:
props
.
listImage
[
1
].
url
}}
resizeMode
=
{
'cover'
}
/
>
<
/View
>
<
View
style
=
{{
borderRadius
:
10
}}
>
<
Image
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
10
}}
style
=
{{
height
:
HEIGHTXD
(
400
),
width
:
'100%'
,
borderRadius
:
5
}}
source
=
{{
uri
:
props
.
listImage
[
2
].
url
}}
resizeMode
=
{
'cover'
}
/
>
...
...
src/apis/Functions/users.js
View file @
b9b63375
...
...
@@ -61,3 +61,8 @@ export const getNewestVersionInfo = async (body) =>
GetData
(
url
.
urlGetNewestVersionInfo
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
changeAvatart
=
async
(
body
)
=>
PostFormData
(
url
.
urlChangeAvatar
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/url.js
View file @
b9b63375
...
...
@@ -44,4 +44,6 @@ export default {
//Transaction
urlGetTransactionListByCategory
:
`
${
root
}
api/v1/transactions/products`
,
urlGetContractDescription
:
`
${
root
}
api/v1/transactions/products/specification-contract/`
,
urlChangeAvatar
:
root
+
'api/v1/customers/update-avatar'
,
};
src/assets/images.js
View file @
b9b63375
...
...
@@ -91,6 +91,7 @@ const images = {
iconTriangleUp
:
require
(
'./images/iconTriangleUp.png'
),
iconTriangleDown
:
require
(
'./images/iconTriangleDown.png'
),
iconSort
:
require
(
'./images/iconSort.png'
),
imagePicker
:
require
(
'./images/imagePicker.png'
),
};
export
default
images
;
src/assets/images/imagePicker.png
0 → 100644
View file @
b9b63375
57.7 KB
src/components/Header/HeaderHome.js
View file @
b9b63375
...
...
@@ -33,9 +33,32 @@ import {
WALLETWITHDRAW
,
PACKETCQG
,
}
from
'../../routers/ScreenNames'
;
import
PickerAvtart
from
'../../components/Picker/PickerAvatart'
;
const
renderWallet
=
(
status
,
current_money
,
current_cqg_money
,
contract
)
=>
{
const
navigate
=
useNavigation
();
if
(
status
==
4
)
return
(
<
View
style
=
{{
flex
:
1
,
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
<
TouchableOpacity
disabled
=
{
status
==
2
?
true
:
false
}
onPress
=
{()
=>
navigate
.
navigate
(
AccountVerification
)}
>
<
ImageBackground
imageStyle
=
{{
borderRadius
:
10
}}
style
=
{{
width
:
320
,
height
:
60
,
borderRadius
:
10
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
}}
source
=
{
R
.
images
.
iconBtnGreen
}
>
<
AppText
i18nKey
=
{
'ReVerify'
}
style
=
{{
fontSize
:
getFontXD
(
52
),
color
:
'white'
}}
><
/AppText
>
<
/ImageBackground
>
<
/TouchableOpacity
>
<
/View
>
);
if
(
status
==
6
)
return
(
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
}}
>
...
...
@@ -140,6 +163,7 @@ const renderWallet = (status, current_money, current_cqg_money, contract) => {
};
const
renderActions
=
(
onClickDetail
)
=>
{
const
navigate
=
useNavigation
();
return
(
<
View
>
<
View
style
=
{
styles
.
containerMenu
}
>
...
...
@@ -184,13 +208,17 @@ const renderActions = (onClickDetail) => {
const
HeaderHome
=
(
props
)
=>
{
const
navigate
=
useNavigation
();
console
.
log
(
'User--'
,
props
.
user
.
status
);
const
[
detail
,
setDetail
]
=
useState
(
false
);
const
onClickDetail
=
()
=>
{
setDetail
(
!
detail
);
};
const
onClickImage
=
(
path
)
=>
{
console
.
log
(
path
);
};
const
copyToClipboard
=
()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
I18n
.
t
(
'CopyLink'
));
Clipboard
.
setString
(
props
.
user
.
sponsor_url
);
...
...
@@ -208,7 +236,7 @@ const HeaderHome = (props) => {
}}
>
<
View
style
=
{
styles
.
containerTop
}
>
<
View
style
=
{
styles
.
containerInfor
}
>
<
Image
source
=
{
R
.
images
.
avartar
}
style
=
{
styles
.
imgAvatar
}
/
>
<
PickerAvtart
onClickImage
=
{
onClickImage
}
/
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
TouchableOpacity
onPress
=
{()
=>
navigate
.
navigate
(
PROFILE
)}
>
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
}}
>
...
...
@@ -374,6 +402,16 @@ const styles = StyleSheet.create({
height
:
WIDTHXD
(
180
),
borderRadius
:
WIDTHXD
(
90
),
},
containerImg
:
{
width
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
backgroundColor
:
'red'
,
},
iconImg
:
{
position
:
'absolute'
,
bottom
:
0
,
right
:
0
,
},
txtMoney
:
{
fontSize
:
getFontXD
(
62
),
color
:
'#FFB721'
,
...
...
src/components/Picker/PickerAvatart.js
0 → 100644
View file @
b9b63375
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
View
,
Text
,
Image
,
StyleSheet
,
TouchableOpacity
,
TouchableWithoutFeedback
,
Platform
,
Alert
,
}
from
'react-native'
;
import
R
from
'../../assets/R'
;
import
{
HEIGHTXD
,
WIDTHXD
,
getFontXD
}
from
'../../Config/Functions'
;
import
Icon
from
'react-native-vector-icons/AntDesign'
;
import
Modal
from
'react-native-modal'
;
import
Block
from
'../Block'
;
import
ImagePicker
from
'react-native-image-crop-picker'
;
import
AppText
from
'../AppText'
;
import
{
connect
}
from
'react-redux'
;
import
{
saveUserToRedux
}
from
'../../actions/users'
;
import
I18n
from
'../../helper/i18/i18n'
;
import
{
useNavigation
}
from
'@react-navigation/native'
;
import
{
TABNAVIGATOR
}
from
'../../routers/ScreenNames'
;
import
{
changeAvatart
}
from
'../../apis/Functions/users'
;
import
{
showLoading
,
hideLoading
}
from
'../../actions/loadingAction'
;
const
options
=
{
title
:
'Select Avatar'
,
customButtons
:
[{
name
:
'fb'
,
title
:
'Choose Photo from Facebook'
}],
storageOptions
:
{
skipBackup
:
true
,
path
:
'images'
,
},
};
const
PickerImg
=
(
props
)
=>
{
const
naviagtion
=
useNavigation
();
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
imgAvatart
,
setImgAvatart
]
=
useState
(
props
.
user
.
picture_url
);
// useEffect(() => {
// setTimeout(() => {
// console.log('Affter', props.user.picture_url);
// setImgAvatart(props.user.picture_url);
// }, 500);
// }, [props.user]);
const
createFormData
=
(
photo
,
body
)
=>
{
const
data
=
new
FormData
();
data
.
append
(
'avatar'
,
{
name
:
'sign_img.jpg'
,
type
:
'image/jpg'
,
uri
:
Platform
.
OS
===
'android'
?
photo
:
photo
.
replace
(
'file://'
,
''
),
});
Object
.
keys
(
body
).
forEach
((
key
)
=>
{
data
.
append
(
key
,
body
[
key
]);
});
return
data
;
};
const
callApi
=
async
(
image
)
=>
{
props
.
showLoading
();
const
res
=
await
changeAvatart
(
createFormData
(
image
,
{
uid
:
props
.
user
.
uid
,
platform
:
Platform
.
OS
}),
);
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
props
.
saveUserToRedux
(
res
.
data
.
data
);
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
}
else
{
setImgAvatart
(
props
.
user
.
picture_url
);
setTimeout
(()
=>
{
Alert
.
alert
(
I18n
.
t
(
'Notification'
),
res
.
data
.
message
);
},
500
);
}
};
const
onchoosGalery
=
()
=>
{
ImagePicker
.
openPicker
({
mediaType
:
'photo'
,
multiple
:
false
,
cropping
:
true
,
width
:
300
,
height
:
300
,
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
callApi
(
image
.
path
);
setImgAvatart
(
image
.
path
);
});
};
const
onCapture
=
()
=>
{
ImagePicker
.
openCamera
({
mediaType
:
'photo'
,
multiple
:
false
,
width
:
300
,
height
:
300
,
cropping
:
true
,
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
callApi
(
image
.
path
);
setImgAvatart
(
image
.
path
);
});
};
return
(
<
TouchableOpacity
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
View
style
=
{
styles
.
containerImg
}
>
{
imgAvatart
?
(
<
Image
source
=
{{
uri
:
imgAvatart
}}
style
=
{
styles
.
imgAvatar
}
/
>
)
:
(
<
View
style
=
{
styles
.
imgAvatar
}
/
>
)}
<
View
style
=
{
styles
.
iconPicker
}
>
<
Image
style
=
{{
width
:
20
,
height
:
20
}}
source
=
{
R
.
images
.
imagePicker
}
/
>
<
/View
>
<
/View
>
<
Modal
isVisible
=
{
isModalVisible
}
style
=
{{
margin
:
0
,
justifyContent
:
'flex-end'
}}
onSwipeComplete
=
{()
=>
setModalVisible
(
false
)}
swipeDirection
=
{[
'up'
,
'left'
,
'right'
,
'down'
]}
>
<
TouchableWithoutFeedback
onPress
=
{()
=>
setModalVisible
(
false
)}
>
<
View
style
=
{{
flex
:
1
}}
><
/View
>
<
/TouchableWithoutFeedback
>
<
View
style
=
{
styles
.
containerSelect
}
>
<
AppText
i18nKey
=
{
'Select_source_image'
}
style
=
{{
textAlign
:
'center'
,
fontSize
:
getFontXD
(
42
),
fontWeight
:
'bold'
,
color
:
'#1473E6'
,
}}
/
>
<
View
style
=
{
styles
.
line
}
/
>
<
Block
row
space
=
{
'around'
}
center
>
<
TouchableOpacity
style
=
{
styles
.
selectionImg
}
onPress
=
{
onCapture
}
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconCamera
}
/
>
<
AppText
i18nKey
=
{
'Take_photo'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
selectionImg
}
onPress
=
{
onchoosGalery
}
>
<
Image
style
=
{
styles
.
imgIcon
}
source
=
{
R
.
images
.
iconImg
}
/
>
<
AppText
i18nKey
=
{
'Photo_library'
}
style
=
{
styles
.
txtTitleBtn
}
/
>
<
/TouchableOpacity
>
<
/Block
>
<
/View
>
<
/Modal
>
<
/TouchableOpacity
>
);
};
const
styles
=
StyleSheet
.
create
({
container
:
{
width
:
WIDTHXD
(
350
),
height
:
HEIGHTXD
(
280
),
backgroundColor
:
R
.
colors
.
white
,
borderRadius
:
10
,
borderWidth
:
2
,
borderColor
:
'#DBDBDB'
,
borderStyle
:
'dashed'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
txt
:
{
fontSize
:
getFontXD
(
42
),
color
:
R
.
colors
.
color777
,
marginBottom
:
5
,
paddingLeft
:
10
,
},
selectionImg
:
{
padding
:
10
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
containerSelect
:
{
height
:
HEIGHTXD
(
520
),
backgroundColor
:
'white'
,
paddingTop
:
10
,
borderTopLeftRadius
:
20
,
borderTopRightRadius
:
20
,
},
line
:
{
height
:
1
,
backgroundColor
:
'#929292'
,
width
:
'100%'
,
marginTop
:
5
,
},
imgIcon
:
{
width
:
40
,
height
:
40
,
},
txtTitleBtn
:
{
textAlign
:
'center'
,
fontSize
:
getFontXD
(
42
),
color
:
'#1473E6'
,
},
imgAvatar
:
{
width
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
borderRadius
:
WIDTHXD
(
90
),
},
containerImg
:
{
width
:
WIDTHXD
(
180
),
height
:
WIDTHXD
(
180
),
},
iconPicker
:
{
position
:
'absolute'
,
bottom
:
0
,
right
:
0
,
},
});
const
mapStateToProps
=
(
state
)
=>
{
return
{
user
:
state
.
userReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{
saveUserToRedux
,
showLoading
,
hideLoading
,
})(
PickerImg
);
src/components/Picker/PickerImg.js
View file @
b9b63375
...
...
@@ -35,6 +35,7 @@ const PickerImg = (props) => {
ImagePicker
.
openPicker
({
mediaType
:
'photo'
,
multiple
:
true
,
cropping
:
true
,
}).
then
((
images
)
=>
{
setModalVisible
(
false
);
...
...
@@ -48,6 +49,7 @@ const PickerImg = (props) => {
mediaType
:
'photo'
,
width
:
300
,
height
:
400
,
cropping
:
true
,
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
...
...
src/components/Picker/PickerImgUni.js
View file @
b9b63375
...
...
@@ -32,10 +32,10 @@ const options = {
};
const
PickerImgUni
=
(
props
)
=>
{
const
{
title
,
height
,
width
,
onSelectImg
}
=
props
;
const
{
title
,
height
,
width
,
onSelectImg
,
uriImage
}
=
props
;
const
[
isModalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
urlImg
,
setUrlImg
]
=
useState
(
''
);
const
[
urlImg
,
setUrlImg
]
=
useState
(
uriImage
);
// const [imgPicker, setImgPicker] = useState('');
const
checkPermissionAndroid
=
()
=>
{
...
...
@@ -50,6 +50,7 @@ const PickerImgUni = (props) => {
ImagePicker
.
openPicker
({
mediaType
:
'photo'
,
multiple
:
false
,
cropping
:
true
,
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
setUrlImg
(
image
.
path
);
...
...
@@ -63,6 +64,7 @@ const PickerImgUni = (props) => {
mediaType
:
'photo'
,
width
:
300
,
height
:
400
,
cropping
:
true
,
}).
then
((
image
)
=>
{
setModalVisible
(
false
);
setUrlImg
(
image
.
path
);
...
...
src/components/SnackBar.js
View file @
b9b63375
...
...
@@ -38,8 +38,10 @@ const SnackBar = (props) => {
isVisible
=
{
isOpen
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
flex
:
1
}}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
title
}
<
/Text
>
<
Text
numberOfLines
=
{
2
}
style
=
{
styles
.
txt
}
>
<
Text
numberOfLines
=
{
1
}
style
=
{
styles
.
txtTitle
}
>
{
title
}
<
/Text
>
<
Text
numberOfLines
=
{
3
}
style
=
{
styles
.
txt
}
>
{
content
}
<
/Text
>
<
/View
>
...
...
src/helper/i18/locales/en.js
View file @
b9b63375
...
...
@@ -227,4 +227,6 @@ export default {
WorkingTime
:
'Working time:'
,
ContentRequire
:
'Content require:'
,
FeedBackDCV
:
'Feedback for DCV Invest'
,
ReVerify
:
'Re-Verify'
,
RejectVerify
:
'Reject verify'
,
};
src/helper/i18/locales/vn.js
View file @
b9b63375
...
...
@@ -104,7 +104,7 @@ export default {
Here
:
'Tại đây'
,
Open_account_demo
:
'Bạn có thể mở tài khoản thử'
,
Features_develop
:
'Không có dữ liệu!'
,
Email
:
'Email
:
'
,
Email
:
'Email'
,
Password
:
'Mật khẩu'
,
Login
:
'Đăng nhập'
,
Register
:
'Đăng ký'
,
...
...
@@ -112,15 +112,15 @@ export default {
Code_introduce
:
'Mã giới thiệu'
,
Account_already
:
'Bạn đã có tài khoản?'
,
Have_account
:
'Bạn chưa có tài khoản?'
,
Verify_code
:
'Mã xác thực
:
'
,
Verify_code
:
'Mã xác thực'
,
Continue
:
'Tiếp tục'
,
Re_send
:
'Gửi lại'
,
Send
:
'Gửi'
,
Copied
:
'Đã sao chép!'
,
Please_fill_in
:
'Vui lòng điền '
,
RequestFilter
:
'Lọc yêu cầu'
,
FromDate
:
'Từ ngày
:
'
,
ToDate
:
'Đến ngày
:
'
,
FromDate
:
'Từ ngày'
,
ToDate
:
'Đến ngày'
,
Failed
:
'Thất bại'
,
SelectRequestStatus
:
'Chọn trạng thái yêu cầu'
,
TopVideo
:
'Video xem nhiều'
,
...
...
@@ -229,4 +229,6 @@ export default {
WorkingTime
:
'Thời gian làm việc:'
,
ContentRequire
:
'Nội dung yêu cầu:'
,
FeedBackDCV
:
'Đánh giá dịch vụ của DCV Invest'
,
ReVerify
:
'Xác minh lại'
,
RejectVerify
:
'Từ chối xác minh'
,
};
src/routers/TabNavigation.js
View file @
b9b63375
...
...
@@ -112,7 +112,10 @@ const TabNavigator = (props) => {
options
=
{{
tabBarLabel
:
I18n
.
t
(
'Tradding'
),
tabBarIcon
:
({
color
,
size
})
=>
(
<
Image
source
=
{
R
.
images
.
iconTransaction2
}
style
=
{{
width
:
size
,
height
:
size
,
tintColor
:
color
}}
/
>
<
Image
source
=
{
R
.
images
.
iconTransaction2
}
style
=
{{
width
:
size
,
height
:
size
,
tintColor
:
color
}}
/
>
),
}}
/
>
...
...
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