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
94b48eb5
Commit
94b48eb5
authored
Apr 22, 2021
by
Giang Tran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api update user
parent
ec4e9c22
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
83 deletions
+110
-83
launch.json
.vscode/launch.json
+0
-7
GeneralInfor.js
src/Screens/Menu/Profile/Tab/GeneralInfor.js
+102
-75
users.js
src/apis/Functions/users.js
+5
-0
url.js
src/apis/url.js
+2
-0
FirebaseNotification.js
src/helper/FirebaseNotification.js
+1
-1
No files found.
.vscode/launch.json
View file @
94b48eb5
...
...
@@ -5,13 +5,6 @@
"version"
:
"0.2.0"
,
"configurations"
:
[
{
"name"
:
"Debug iOS"
,
"request"
:
"launch"
,
"type"
:
"reactnative"
,
"cwd"
:
"${workspaceFolder}"
,
"platform"
:
"ios"
},
{
"name"
:
"Attach to Chrome"
,
"port"
:
9222
,
"request"
:
"attach"
,
...
...
src/Screens/Menu/Profile/Tab/GeneralInfor.js
View file @
94b48eb5
...
...
@@ -2,12 +2,9 @@ import React, {useState} from 'react';
import
{
View
,
Text
,
TextInput
,
TouchableOpacity
,
StyleSheet
,
Touchable
,
TouchableOpacityBase
,
Dimensions
,
Alert
,
KeyboardAvoidingView
,
ScrollView
,
Platform
,
...
...
@@ -15,37 +12,58 @@ import {
Keyboard
,
}
from
'react-native'
;
import
R
from
'../../../../assets/R'
;
import
RadioForm
,
{
RadioButton
,
RadioButtonInput
,
RadioButtonLabel
,
}
from
'react-native-simple-radio-button'
;
import
PickerDate
from
'../../../../components/Picker/PickerDate'
;
import
TextMulti
from
'../../../../components/Input/TextMulti'
;
import
{
connect
}
from
'react-redux'
;
import
{
showLoading
,
hideLoading
}
from
'../../../../actions/loadingAction'
;
import
{
converStringToDate
}
from
'../../../../Config/Functions'
;
var
radio_props
=
[
{
label
:
'Nam'
,
value
:
0
},
{
label
:
'Nữ'
,
value
:
1
},
];
const
{
width
}
=
Dimensions
.
get
(
'window'
);
import
{
saveUserToRedux
}
from
'../../../../actions/users'
;
import
TextField
from
'../../../../components/Input/TextField'
;
import
PickerItem
from
'../../../../components/Picker/PickerItem'
;
import
{
getFontXD
,
HEIGHTXD
,
WIDTHXD
,
renderStatus
,
checkFormatArray
,
}
from
'../../../../Config/Functions'
;
import
Icon
from
'react-native-vector-icons/Ionicon
s'
;
import
{
updateInforUser
}
from
'../../../../apis/Functions/user
s'
;
const
GeneralInfor
=
(
props
)
=>
{
const
[
Select
,
setSelect
]
=
useState
(
'ABC'
);
const
[
bank
,
setBank
]
=
useState
();
const
[
account
,
setAccount
]
=
useState
();
const
[
phone
,
setPhone
]
=
useState
(
props
.
user
.
phone
);
const
[
address
,
setAddress
]
=
useState
(
props
.
user
.
address
);
const
onClick
=
async
()
=>
{
const
titles
=
[
'điện thoại'
,
'địa chỉ'
];
const
index
=
checkFormatArray
([
phone
,
address
]);
if
(
index
===
true
)
{
props
.
showLoading
();
const
res
=
await
updateInforUser
({
uid
:
props
.
user
.
uid
,
platform
:
Platform
.
OS
,
phone
,
address
,
});
props
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
setTimeout
(()
=>
{
props
.
saveUserToRedux
(
res
.
data
.
data
);
Alert
.
alert
(
'Thông báo!'
,
res
.
data
.
message
);
props
.
navigation
.
popToTop
();
},
500
);
}
else
{
setTimeout
(()
=>
{
Alert
.
alert
(
'Thông báo!'
,
res
.
data
.
message
);
},
500
);
}
}
else
{
Alert
.
alert
(
'Thông báo!'
,
'Vui lòng điền '
+
titles
[
index
]);
}
};
const
renderMale
=
()
=>
{
if
(
props
.
user
.
gender
==
1
)
return
'Nữ'
;
return
'Nam'
;
};
return
(
<
KeyboardAvoidingView
behavior
=
{
Platform
.
Os
===
'ios'
?
'padding'
:
'height'
}
...
...
@@ -54,68 +72,65 @@ const GeneralInfor = (props) => {
<
TouchableWithoutFeedback
onPress
=
{
Keyboard
.
dismiss
}
>
<
ScrollView
style
=
{{
flex
:
1
}}
showsVerticalScrollIndicator
=
{
false
}
>
<
View
style
=
{
styles
.
container
}
>
<
TextField
value
=
{
props
.
user
.
fullname
}
editable
=
{
false
}
title
=
{
'Họ và tên'
}
onChangeText
=
{(
val
)
=>
console
.
log
(
val
)}
/
>
<
TextField
title
=
{
'Điện thoại'
}
editable
=
{
false
}
value
=
{
props
.
user
.
phone
}
onChangeText
=
{(
val
)
=>
console
.
log
(
val
)}
/
>
<
TextField
editable
=
{
false
}
title
=
{
'Email'
}
value
=
{
props
.
user
.
email
}
onChangeText
=
{(
val
)
=>
console
.
log
(
val
)}
/
>
{
/*
<TextInput
style={styles.customTxt}
onChangeText={(val) => console.log(val)}
placeholder="0000"
/> */
}
<
Text
style
=
{
styles
.
txtTitle
}
>
Gi
ớ
i
t
í
nh
<
/Text
>
<
RadioForm
radio_props
=
{
radio_props
}
labelStyle
=
{{
fontSize
:
getFontXD
(
42
)}}
formHorizontal
=
{
true
}
style
=
{
styles
.
row
}
initial
=
{
0
}
onPress
=
{(
value
)
=>
{
setAccount
({
value
:
value
});
}}
/
>
<
View
style
=
{
styles
.
status
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Tr
ạ
ng
th
á
i
<
/Text
>
{
renderStatus
(
props
.
user
.
status
)}
<
View
style
=
{
styles
.
wrapItem
}
>
<
View
style
=
{
styles
.
wrapLeft
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
H
ọ
v
à
t
ê
n
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
props
.
user
.
fullname
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
wrapItem
}
>
<
View
style
=
{
styles
.
wrapLeft
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Email
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
props
.
user
.
email
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
wrapItem
}
>
<
View
style
=
{
styles
.
wrapLeft
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Ng
à
y
sinh
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
props
.
user
.
birthday
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
wrapItem
}
>
<
View
style
=
{
styles
.
wrapLeft
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Gi
ớ
i
t
í
nh
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
renderMale
()}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
wrapItem
}
>
<
View
style
=
{
styles
.
wrapLeft
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
Tr
ạ
ng
th
á
i
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
wrapRight
}
>
<
Text
style
=
{
styles
.
txtTitle
}
>
{
' '
}
{
renderStatus
(
props
.
user
.
status
)}
<
/Text
>
<
/View
>
<
/View
>
<
PickerDate
valueString
=
{
converStringToDate
(
props
.
user
.
birthday
)
}
title
=
{
'Ngày sinh'
}
disabled
=
{
true
}
<
TextField
title
=
{
'Điện thoại'
}
value
=
{
phone
}
onChangeText
=
{(
val
)
=>
setPhone
(
val
)
}
/
>
<
TextMulti
onChangeText
=
{(
val
)
=>
consoele
.
log
(
val
)}
value
=
{
props
.
user
.
address
}
editable
=
{
false
}
onChangeText
=
{(
val
)
=>
setAddress
(
val
)}
value
=
{
address
}
title
=
{
'Địa chỉ'
}
/
>
<
View
style
=
{{
height
:
40
}}
/
>
<
View
style
=
{{
justifyContent
:
'center'
,
alignItems
:
'center'
}}
>
<
TouchableOpacity
onPress
=
{()
=>
console
.
log
(
'Hello'
)}
style
=
{
styles
.
btn
}
>
<
TouchableOpacity
onPress
=
{
onClick
}
style
=
{
styles
.
btn
}
>
<
Text
style
=
{
styles
.
txtBtn
}
>
C
ậ
p
nh
ậ
t
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
...
...
@@ -132,6 +147,10 @@ const styles = StyleSheet.create({
paddingHorizontal
:
10
,
paddingVertical
:
10
,
},
wrapItem
:
{
flexDirection
:
'row'
,
marginVertical
:
5
,
},
customTxt
:
{
height
:
HEIGHTXD
(
110
),
color
:
'black'
,
...
...
@@ -153,6 +172,12 @@ const styles = StyleSheet.create({
marginTop
:
50
,
marginBottom
:
20
,
},
wrapLeft
:
{
flex
:
1
,
},
wrapRight
:
{
flex
:
2
,
},
status
:
{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
...
...
@@ -205,6 +230,8 @@ const mapStateToProps = (state) => {
user
:
state
.
userReducer
,
};
};
export
default
connect
(
mapStateToProps
,
{
showLoading
,
hideLoading
})(
GeneralInfor
,
);
export
default
connect
(
mapStateToProps
,
{
showLoading
,
saveUserToRedux
,
hideLoading
,
})(
GeneralInfor
);
src/apis/Functions/users.js
View file @
94b48eb5
...
...
@@ -46,3 +46,8 @@ export const getListNotification = async (body) =>
GetData
(
url
.
urlGetListNotification
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
export
const
updateInforUser
=
async
(
body
)
=>
PostData
(
url
.
urlUpdateInforUser
,
body
)
.
then
((
res
)
=>
res
)
.
catch
((
err
)
=>
err
);
src/apis/url.js
View file @
94b48eb5
...
...
@@ -33,4 +33,6 @@ export default {
urlGetListPacketCQG
:
root
+
'api/v1/customers/get-list-fee-package'
,
urlOpenCQG
:
root
+
'api/v1/customers/register-open-cqg'
,
urlUpdateInforUser
:
root
+
'api/v1/customers/update-general-info'
,
};
src/helper/FirebaseNotification.js
View file @
94b48eb5
...
...
@@ -31,7 +31,7 @@ const FirebaseNotification = (props) => {
});
});
(
async
()
=>
await
messaging
().
registerDeviceForRemoteMessages
())();
//
(async () => await messaging().registerDeviceForRemoteMessages())();
messaging
().
onNotificationOpenedApp
((
remoteMessage
)
=>
{
console
.
log
(
'Notification caused app to open from background state:'
,
...
...
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