Commit 50649bf4 by Giang Tran

update code

parent 5422de2c
import React from 'react';
import {View, Text, StyleSheet, TouchableOpacity, Image} from 'react-native';
import {
getFontXD,
HEIGHTXD,
WIDTHXD,
toPriceVnd,
} from '../../../Config/Functions';
import R from '../../../assets/R';
import Block from '../../../components/Block';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DEPOSIT} from '../../../routers/ScreenNames';
import {useNavigation} from '@react-navigation/native';
const Item = (props) => {
const {item, userId} = props;
const navigate = useNavigation();
return (
<TouchableOpacity
onPress={() => navigate.navigate(DEPOSIT, {method: item, userId})}
style={styles.containerItem}>
<Image source={{uri: item.logo_url}} style={styles.imgIcon} />
<Text>{item.agent}</Text>
</TouchableOpacity>
);
};
export default React.memo(Item);
const styles = StyleSheet.create({
containerItem: {
width: WIDTHXD(460),
height: HEIGHTXD(450),
backgroundColor: 'white',
marginTop: 20,
borderRadius: 10,
justifyContent: 'center',
alignItems: 'center',
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.25,
shadowRadius: 2.84,
elevation: 3,
},
imgIcon: {
width: WIDTHXD(400),
height: HEIGHTXD(300),
marginBottom: 10,
resizeMode: 'contain',
},
});
...@@ -6,25 +6,6 @@ import {getListWidthDraw} from '../../../apis/Functions/Widthdraw'; ...@@ -6,25 +6,6 @@ import {getListWidthDraw} from '../../../apis/Functions/Widthdraw';
import {Alert} from 'react-native'; import {Alert} from 'react-native';
const Withdraw = (props) => { const Withdraw = (props) => {
const [listMethod, setListMethod] = useState([]);
useEffect(() => {
getData();
}, []);
const getData = async () => {
const res = await getListWidthDraw({
page_index: 1,
page_size: 20,
platform: Platform.OS,
});
if (res.data.code == 200) {
setListMethod(res.data.data);
} else {
Alert.alert('Lấy danh sách phương thức rút tiền thất bại!');
}
};
return <WithdrawView />; return <WithdrawView />;
}; };
......
import React from 'react'; import React, {useEffect, useState} from 'react';
import {View, Text, StyleSheet} from 'react-native'; import {View, Text, StyleSheet, FlatList, Platform, Alert} from 'react-native';
import R from '../../../assets/R';
import HeaderBack from '../../../components/Header/HeaderBack'; import HeaderBack from '../../../components/Header/HeaderBack';
import TextField from '../../../components/Input/TextField'; import Item from './Item';
import TextMulti from '../../../components/Input/TextMulti'; import {getListWidthDraw} from '../../../apis/Functions/Widthdraw';
import Button from '../../../components/Button'; import {connect} from 'react-redux';
import {HEIGHTXD} from '../../../Config/Functions';
const WithdrawView = (props) => { const WithdrawView = (props) => {
const [data, setData] = useState([]);
useEffect(() => {
getData();
}, []);
const getData = async () => {
const res = await getListWidthDraw({
platform: Platform.OS,
});
if (res.data.code == 200 && res.data.data) {
setData(res.data.data);
} else {
alert('Không lấy được danh sách phương thức!');
}
};
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'Rút tiền'} /> <HeaderBack title={'Chọn phương thức thanh toán'} />
<View style={{flex: 1, paddingHorizontal: 10, paddingTop: 10}}> <View style={{flex: 1}}>
<TextField title={'Số tiền'} /> <FlatList
<TextField title={'Phương thức nạp'} /> keyExtractor={(item) => item.id}
<TextMulti numberLines={3} title={'Ghi chú'} /> showsVerticalScrollIndicator={false}
</View> numColumns={2}
<View style={styles.containerBtn}> columnWrapperStyle={{
<Button title={'Rút tiền'} /> marginHorizontal: 20,
justifyContent: 'space-between',
}}
data={data}
renderItem={({item}) => <Item userId={props.user.uid} item={item} />}
/>
</View> </View>
</View> </View>
); );
}; };
const styles = StyleSheet.create({ const mapStateToProps = (state) => {
containerBtn: { return {
marginBottom: 15, user: state.userReducer,
}, };
}); };
export default connect(mapStateToProps, {})(WithdrawView);
export default WithdrawView;
import React, {useState} from 'react';
import {View, Text, StyleSheet} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
import {WebView} from 'react-native-webview';
import {root} from '../../apis/url';
const DepositView = (props) => {
console.log('Link', root + '/api/v1/news/posts?id=' + props.route.params.id);
return (
<View style={{flex: 1}}>
<HeaderBack isWhite={true} title={'Chi tiết'} />
<WebView
source={{
uri:
root + 'api/v1/posts/detail/web-view?id=' + props.route.params.id,
}}
/>
</View>
);
};
const styles = StyleSheet.create({
containerBtn: {
marginBottom: 15,
},
});
export default DepositView;
...@@ -13,7 +13,8 @@ const NewFeed = (props) => { ...@@ -13,7 +13,8 @@ const NewFeed = (props) => {
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderDrawer title={'Thông tin'} isWhite={true} /> <HeaderDrawer title={'Thông tin'} isWhite={true} />
<View style={{flex: 1, backgroundColor: 'white'}}> <View style={{flex: 1, backgroundColor: 'white'}}>
<Tab.Navigator <Tab1 />
{/* <Tab.Navigator
initialRouteName="GeneralInfor" initialRouteName="GeneralInfor"
tabBarOptions={{ tabBarOptions={{
inactiveTintColor: '#929292', inactiveTintColor: '#929292',
...@@ -31,7 +32,7 @@ const NewFeed = (props) => { ...@@ -31,7 +32,7 @@ const NewFeed = (props) => {
component={Tab2} component={Tab2}
options={{tabBarLabel: 'Tin tức'}} options={{tabBarLabel: 'Tin tức'}}
/> />
</Tab.Navigator> </Tab.Navigator> */}
</View> </View>
</View> </View>
); );
......
import React, {useState} from 'react'; import React, {useState, useEffect} from 'react';
import { import {
View, View,
Text, Text,
...@@ -6,10 +6,13 @@ import { ...@@ -6,10 +6,13 @@ import {
ScrollView, ScrollView,
TouchableOpacity, TouchableOpacity,
FlatList, FlatList,
Platform,
Alert,
} from 'react-native'; } from 'react-native';
import R from '../../../assets/R'; import R from '../../../assets/R';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD} from '../../../Config/Functions';
import Item from './item'; import Item from './item';
import {getListNew} from '../../../apis/Functions/NewFeed';
const fillers = [ const fillers = [
{ {
...@@ -30,60 +33,32 @@ const fillers = [ ...@@ -30,60 +33,32 @@ const fillers = [
}, },
]; ];
const data = [
{
id: '1',
increase: true,
title:
'USD/RUB Giao dich trong ngày:khi 74,020 là điểm hỗ trợ,trông chờ 74,860.',
content: 'khi 74,020 là điểm hỗ trợ,trông chờ 74,860',
ratio: 'USR/RUB',
time: '45 min ago',
},
{
id: '2',
increase: false,
title:
'USD/AUD Giao dich trong ngày:Xu hướng gỉam lấn áp khi 84,80 là điểm kháng cự.',
content: 'khi 74,020 là điểm hỗ trợ,trông chờ 74,860',
ratio: 'USD/AUD',
time: '32 min ago',
},
{
id: '3',
increase: true,
title:
'USD/RUB Giao dich trong ngày:khi 74,020 là điểm hỗ trợ,trông chờ 74,860.',
content: 'khi 74,020 là điểm hỗ trợ,trông chờ 74,860',
ratio: 'USR/RUB',
time: '2 h ago',
},
{
id: '4',
increase: false,
title:
'USD/RUB Giao dich trong ngày:khi 74,020 là điểm hỗ trợ,trông chờ 74,860.',
content: 'khi 74,020 là điểm hỗ trợ,trông chờ 74,860',
ratio: 'USR/RUB',
time: '45 min ago',
},
{
id: '5',
increase: true,
title:
'USD/RUB Giao dich trong ngày:khi 74,020 là điểm hỗ trợ,trông chờ 74,860.',
content: 'khi 74,020 là điểm hỗ trợ,trông chờ 74,860',
ratio: 'USR/RUB',
time: '45 min ago',
},
];
const NewFeed = (props) => { const NewFeed = (props) => {
const [selected, setSelected] = useState(1); const [selected, setSelected] = useState(1);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1); const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false); const [isRefresh, setisRefresh] = useState(false);
useEffect(() => {
getData();
}, []);
const getData = async () => {
const res = await getListNew({
keyword: '',
category_id: '',
platform: Platform.OS,
page_size: 10,
page_index: page,
});
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
} else {
Alert.alert('Thông báo!', res.data.message);
}
};
const onRefresh = () => { const onRefresh = () => {
console.log('On Refersh'); console.log('On Refersh');
}; };
......
...@@ -5,42 +5,28 @@ import Block from '../../../components/Block'; ...@@ -5,42 +5,28 @@ import Block from '../../../components/Block';
import Icon from 'react-native-vector-icons/AntDesign'; import Icon from 'react-native-vector-icons/AntDesign';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD} from '../../../Config/Functions';
import R from '../../../assets/R'; import R from '../../../assets/R';
import {useNavigation} from '@react-navigation/native';
import {DETAILNEW} from '../../../routers/ScreenNames';
const Item = (props) => { const Item = (props) => {
const {title, increase, content, ratio, time} = props.item; const navigate = useNavigation();
const {title, image, published_at, id} = props.item;
return ( return (
<TouchableOpacity <TouchableOpacity
onPress={() => console.log('hello')} onPress={() => navigate.navigate(DETAILNEW, {id})}
style={styles.container}> style={styles.container}>
<Text style={styles.txtTitle}>{title}</Text> <Text numberOfLines={2} style={styles.txtTitle}>
<Text>{content}</Text> {title}
<View style={styles.row}> </Text>
<Block row center> <Text style={styles.txtDate}>{published_at}</Text>
<View <Image source={{uri: image}} resizeMode={'cover'} style={styles.img} />
style={[styles.wrap, increase ? {backgroundColor: '#03A021'} : {}]}>
<Icon name={'arrowup'} color={'white'} />
<Text style={{color: 'white'}}>Giao dich trong ngay</Text>
</View>
<View
style={[styles.wrap2, increase ? {borderColor: '#03A021'} : {}]}>
<Text>{ratio}</Text>
</View>
</Block>
<Text style={{color: '#929292'}}>{time}</Text>
</View>
<Image
source={R.images.tradding}
resizeMode={'contain'}
style={styles.img}
/>
</TouchableOpacity> </TouchableOpacity>
); );
}; };
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
marginVertical: 10, marginVertical: 15,
}, },
row: { row: {
flexDirection: 'row', flexDirection: 'row',
...@@ -48,29 +34,22 @@ const styles = StyleSheet.create({ ...@@ -48,29 +34,22 @@ const styles = StyleSheet.create({
justifyContent: 'space-between', justifyContent: 'space-between',
marginVertical: 10, marginVertical: 10,
}, },
wrap: {
backgroundColor: '#D62936',
alignItems: 'center',
flexDirection: 'row',
marginRight: 10,
padding: 5,
borderRadius: 10,
},
wrap2: {
padding: 3,
borderWidth: 1,
borderColor: '#D62936',
alignItems: 'center',
borderRadius: 2,
},
txtTitle: { txtTitle: {
fontSize: getFontXD(46), fontSize: getFontXD(46),
color: 'black', color: 'black',
fontWeight: 'bold', fontWeight: 'bold',
}, },
txtDate: {
fontSize: getFontXD(46),
fontStyle: 'italic',
color: '#A2A2A2',
},
img: { img: {
width: '100%', width: '100%',
height: 280, height: 260,
borderRadius: 5,
marginTop: 5,
}, },
}); });
......
import {PostLogin, GetData, PostData} from '../helpers';
import url from '../url';
export const getListNew = async (body) =>
GetData(url.urlGetListNew, body)
.then((res) => res)
.catch((err) => err);
const root = 'http://api.dcvinvest.com/'; export const root = 'http://api.dcvinvest.com/';
export default { export default {
urllogin: root + 'api/auth/customer-login', urllogin: root + 'api/auth/customer-login',
urlRegistor: root + 'api/auth/customer-register', urlRegistor: root + 'api/auth/customer-register',
...@@ -7,5 +7,7 @@ export default { ...@@ -7,5 +7,7 @@ export default {
urlVerifyOTP: root + 'api/auth/customer-verify-otp', urlVerifyOTP: root + 'api/auth/customer-verify-otp',
urlForgotPassword: root + 'api/auth/customer-forgot-password', urlForgotPassword: root + 'api/auth/customer-forgot-password',
urlGetListWithDraw: root + 'api/v1/payments/get-list-withdraw-method', urlGetListWithDraw: root + 'api/v1/payments/get-list-withdraw-method',
urlVerifyAccount: root + 'api/v1/customers/verify-account', urlVerifyAccount: root + 'api/v1/customers/verify-account',
urlGetListNew: root + '/api/v1/news/posts',
}; };
...@@ -7,8 +7,8 @@ const images = { ...@@ -7,8 +7,8 @@ const images = {
iconDeposit: require('./images/deposit.png'), iconDeposit: require('./images/deposit.png'),
iconAddUser: require('./images/addUser.png'), iconAddUser: require('./images/addUser.png'),
headerHome: require('./images/imgHome.png'), headerHome: require('./images/imgHome.png'),
iconTransfer: require('./images/transfer.png'), iconTransfer: require('./images/iconTransfer1.png'),
iconHistory: require('./images/history.png'), iconHistory: require('./images/iconHistory1.png'),
moneyinvest: require('./images/moneyinvest.png'), moneyinvest: require('./images/moneyinvest.png'),
moneysupport: require('./images/moneysupport.png'), moneysupport: require('./images/moneysupport.png'),
moneyteam: require('./images/moneyteam.png'), moneyteam: require('./images/moneyteam.png'),
......
...@@ -35,7 +35,7 @@ const HeaderHome = (props) => { ...@@ -35,7 +35,7 @@ const HeaderHome = (props) => {
const copyToClipboard = () => { const copyToClipboard = () => {
Alert.alert('Đã sao chép!'); Alert.alert('Đã sao chép!');
Clipboard.setString(props.user.sponsor_id); Clipboard.setString(props.user.sponsor_url);
}; };
return ( return (
...@@ -53,7 +53,7 @@ const HeaderHome = (props) => { ...@@ -53,7 +53,7 @@ const HeaderHome = (props) => {
</TouchableOpacity> </TouchableOpacity>
<View style={styles.row1}> <View style={styles.row1}>
<Text style={styles.txtlink}>{props.user.sponsor_id}</Text> <Text style={styles.txtlink}>{props.user.user_id}</Text>
<TouchableOpacity onPress={copyToClipboard}> <TouchableOpacity onPress={copyToClipboard}>
<Image <Image
source={R.images.iconCopy} source={R.images.iconCopy}
......
...@@ -46,4 +46,5 @@ export const NEWPASSWORD = 'NEWPASSWORD'; ...@@ -46,4 +46,5 @@ export const NEWPASSWORD = 'NEWPASSWORD';
export const CONFIRMEMAIL = 'CONFIRMEMAIL'; export const CONFIRMEMAIL = 'CONFIRMEMAIL';
export const NEWFEED = 'NEWFEED'; export const NEWFEED = 'NEWFEED';
export const DETAILNEW = 'DETAILNEW';
export const NOTIFICATION = 'NOTIFICATION'; export const NOTIFICATION = 'NOTIFICATION';
...@@ -30,6 +30,7 @@ import ChooseMethod from '../Screens/Action/Deposit/ChooseMethod'; ...@@ -30,6 +30,7 @@ import ChooseMethod from '../Screens/Action/Deposit/ChooseMethod';
import NewPassWord from '../Screens/Authen/NewPassWord'; import NewPassWord from '../Screens/Authen/NewPassWord';
import ConfirmEmail from '../Screens/Authen/ConfirmEmail'; import ConfirmEmail from '../Screens/Authen/ConfirmEmail';
import Notification from '../Screens/Notification/Notification'; import Notification from '../Screens/Notification/Notification';
import DetailNew from '../Screens/NewFeed/DetailNew';
import * as ScreenName from './ScreenNames'; import * as ScreenName from './ScreenNames';
...@@ -42,10 +43,11 @@ function MyStack(props) { ...@@ -42,10 +43,11 @@ function MyStack(props) {
headerStatusBarHeight: 0, headerStatusBarHeight: 0,
}} }}
headerMode={'none'} headerMode={'none'}
initialRouteName={ScreenName.TABNAVIGATOR}> initialRouteName={ScreenName.AUTHEN}>
<Stack.Screen name={ScreenName.LOGINSCREEN} component={Login} /> <Stack.Screen name={ScreenName.LOGINSCREEN} component={Login} />
<Stack.Screen name={ScreenName.NOTIFICATION} component={Notification} /> <Stack.Screen name={ScreenName.NOTIFICATION} component={Notification} />
<Stack.Screen name={ScreenName.TABNAVIGATOR} component={TabNavigator} /> <Stack.Screen name={ScreenName.TABNAVIGATOR} component={TabNavigator} />
<Stack.Screen name={ScreenName.DETAILNEW} component={DetailNew} />
<Stack.Screen <Stack.Screen
name={ScreenName.AccountVerification} name={ScreenName.AccountVerification}
component={AccountVerificaiton} component={AccountVerificaiton}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment