Commit 997d0fe8 by Giang Tran

update code

parent a583e366
...@@ -267,13 +267,18 @@ export const shortFullname = (text) => { ...@@ -267,13 +267,18 @@ export const shortFullname = (text) => {
return name; return name;
}; };
export const convertTimeApi = (date) => {
const time = moment(date).format('YYYY-MM-DD');
return time;
};
export const convertDate = (date) => { export const convertDate = (date) => {
const time = moment(date).format('DD/MM/YYYY'); const time = moment(date).format('DD/MM/YYYY');
return time; return time;
}; };
export const convertTime = (date) => { export const convertTime = (date) => {
const temp = new Date(moment(date)); const temp = new Date(moment(date, 'DD/MM/YYYY'));
const time = moment(temp).format('YYYY-MM-DD'); const time = moment(temp).format('YYYY-MM-DD');
return time; return time;
}; };
......
...@@ -31,12 +31,12 @@ const AccountVerificationView = (props) => { ...@@ -31,12 +31,12 @@ const AccountVerificationView = (props) => {
}}> }}>
<Tab.Screen <Tab.Screen
name="GeneralInfor" name="GeneralInfor"
component={props.user.status == 2 ? GeneralInfor : GeneralView} component={props.user.status == 3 ? GeneralInfor : GeneralView}
options={{tabBarLabel: 'Thông tin chung'}} options={{tabBarLabel: 'Thông tin chung'}}
/> />
<Tab.Screen <Tab.Screen
name="Profile" name="Profile"
component={props.user.status == 2 ? Profile : ProfileView} component={props.user.status == 3 ? Profile : ProfileView}
options={{tabBarLabel: 'Hồ sơ'}} options={{tabBarLabel: 'Hồ sơ'}}
/> />
</Tab.Navigator> </Tab.Navigator>
......
...@@ -95,7 +95,6 @@ const Profile = (props) => { ...@@ -95,7 +95,6 @@ const Profile = (props) => {
]; ];
const index = checkFormatArray([type, urlFont, urlBack, urlSign]); const index = checkFormatArray([type, urlFont, urlBack, urlSign]);
if (index === true) { if (index === true) {
console.log('Data date', props.route.params);
const data = createFormData(urlFont, urlBack, urlSign, { const data = createFormData(urlFont, urlBack, urlSign, {
card_type: type.value, card_type: type.value,
uid: props.user.uid, uid: props.user.uid,
......
...@@ -39,7 +39,7 @@ const WalletDeposit = (props) => { ...@@ -39,7 +39,7 @@ const WalletDeposit = (props) => {
const [type, setType] = useState(); const [type, setType] = useState();
return ( return (
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderBack title={'Nạp tiền đầu tư'} /> <HeaderBack title={'Rút tiền'} />
<View style={styles.container}> <View style={styles.container}>
<View style={styles.wrapTop}> <View style={styles.wrapTop}>
<View style={styles.itemTop}> <View style={styles.itemTop}>
......
...@@ -53,16 +53,19 @@ const GeneralInfor = (props) => { ...@@ -53,16 +53,19 @@ const GeneralInfor = (props) => {
<View style={styles.container}> <View style={styles.container}>
<TextField <TextField
value={props.user.fullname} value={props.user.fullname}
editable={false}
title={'Họ và tên'} title={'Họ và tên'}
onChangeText={(val) => console.log(val)} onChangeText={(val) => console.log(val)}
/> />
<TextField <TextField
title={'Điện thoại'} title={'Điện thoại'}
editable={false}
value={props.user.phone} value={props.user.phone}
onChangeText={(val) => console.log(val)} onChangeText={(val) => console.log(val)}
/> />
<TextField <TextField
editable={false}
title={'Email'} title={'Email'}
value={props.user.email} value={props.user.email}
onChangeText={(val) => console.log(val)} onChangeText={(val) => console.log(val)}
...@@ -93,23 +96,25 @@ const GeneralInfor = (props) => { ...@@ -93,23 +96,25 @@ const GeneralInfor = (props) => {
</View> </View>
<PickerDate <PickerDate
value={converStringToDate(props.user.birthday)} valueString={converStringToDate(props.user.birthday)}
title={'Ngày sinh'} title={'Ngày sinh'}
disabled={true}
/> />
<TextMulti <TextMulti
onChangeText={(val) => consoele.log(val)} onChangeText={(val) => consoele.log(val)}
value={props.user.address} value={props.user.address}
editable={false}
title={'Địa chỉ'} title={'Địa chỉ'}
/> />
<View style={{height: 40}} /> <View style={{height: 40}} />
<View style={{justifyContent: 'center', alignItems: 'center'}}> <View style={{justifyContent: 'center', alignItems: 'center'}}>
<TouchableOpacity {/* <TouchableOpacity
onPress={() => console.log('Hello')} onPress={() => console.log('Hello')}
style={styles.btn}> style={styles.btn}>
<Text style={styles.txtBtn}>Cập nhật</Text> <Text style={styles.txtBtn}>Cập nhật</Text>
</TouchableOpacity> </TouchableOpacity> */}
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
......
import React, {Component, useState, useEffect} from 'react';
import {View, Text, Platform, FlatList} from 'react-native';
import {getListCalendar} from '../../../apis/Functions/NewFeed';
import {convertTimeApi} from '../../../Config/Functions';
import Item from './item';
const NewFeed = (props) => {
const [data, setData] = useState([]);
useEffect(() => {
getData();
}, []);
const getData = async () => {
var date = new Date(),
y = date.getFullYear(),
m = date.getMonth();
var firstDay = new Date(y, m, 1);
var lastDay = new Date(y, m + 1, 0);
const res = await getListCalendar({
platform: Platform.OS,
start_date: convertTimeApi(firstDay),
end_date: convertTimeApi(lastDay),
keyword: '',
});
if (res.data.code == 200 && res.data.data) {
setData(res.data.data);
} else {
Alert.alert('Thông báo', 'Không lấy được dữ liệu!');
}
};
return (
<View
style={{
flex: 1,
backgroundColor: 'white',
paddingLeft: 10,
paddingRight: 20,
paddingTop: 10,
}}>
<FlatList
data={data}
showsVerticalScrollIndicator={false}
keyExtractor={(item) => item.id}
renderItem={({item, index}) => <Item item={item} index={index} />}
/>
</View>
);
};
export default NewFeed;
...@@ -3,8 +3,9 @@ import {View, Text, StyleSheet, TouchableOpacity} from 'react-native'; ...@@ -3,8 +3,9 @@ import {View, Text, StyleSheet, TouchableOpacity} from 'react-native';
import R from '../../../assets/R'; import R from '../../../assets/R';
import Block from '../../../components/Block'; import Block from '../../../components/Block';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD} from '../../../Config/Functions';
import {convertDate} from '../../../Config/Functions';
const Item = (props) => { const Item = (props) => {
const {title, date, time} = props.item; const {title, date, time, start_date} = props.item;
return ( return (
<TouchableOpacity <TouchableOpacity
onPress={() => console.log('hello')} onPress={() => console.log('hello')}
...@@ -14,8 +15,8 @@ const Item = (props) => { ...@@ -14,8 +15,8 @@ const Item = (props) => {
</View> </View>
<View style={[styles.right, props.index == 0 ? {borderTopWidth: 0} : {}]}> <View style={[styles.right, props.index == 0 ? {borderTopWidth: 0} : {}]}>
<View style={styles.row}> <View style={styles.row}>
<Text style={styles.txtTime}>{time}</Text> <Text style={styles.txtTime}> {convertDate(start_date)}</Text>
<Text style={styles.txtDate}>{date}</Text> <Text style={styles.txtDate}>{start_date.substring(10, 16)}</Text>
</View> </View>
<Text style={styles.txtTitle}> <Text style={styles.txtTitle}>
{title}+{props.index} {title}+{props.index}
......
...@@ -5,6 +5,7 @@ import Tab1 from './Tab1/Tab1'; ...@@ -5,6 +5,7 @@ import Tab1 from './Tab1/Tab1';
import Tab2 from './Tab2/Tab2'; import Tab2 from './Tab2/Tab2';
import Media from './Media/Media'; import Media from './Media/Media';
import Trading from './Tradding/Tradding'; import Trading from './Tradding/Tradding';
import Calendar from './Calendar/Calendar';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs'; import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
const Tab = createMaterialTopTabNavigator(); const Tab = createMaterialTopTabNavigator();
...@@ -15,18 +16,21 @@ const NewFeed = (props) => { ...@@ -15,18 +16,21 @@ const NewFeed = (props) => {
<View style={{flex: 1}}> <View style={{flex: 1}}>
<HeaderDrawer title={'Tin tức'} isWhite={true} /> <HeaderDrawer title={'Tin tức'} isWhite={true} />
<View style={{flex: 1, backgroundColor: 'white'}}> <View style={{flex: 1, backgroundColor: 'white'}}>
{/* <Tab1 /> */}
<Tab.Navigator <Tab.Navigator
initialRouteName="GeneralInfor" initialRouteName="GeneralInfor"
swipeEnabled={true}
tabBarOptions={{ tabBarOptions={{
scrollEnabled: true,
inactiveTintColor: '#929292', inactiveTintColor: '#929292',
activeTintColor: '#1473E6', activeTintColor: '#1473E6',
labelStyle: {fontSize: getFontXD(36), fontWeight: '700'}, labelStyle: {fontSize: getFontXD(36), fontWeight: '700'},
style: {backgroundColor: 'white'}, style: {backgroundColor: 'white'},
}}> }}>
<Tab.Screen <Tab.Screen
name="CALENDAR"
component={Calendar}
options={{tabBarLabel: 'Lịch thị trường'}}
/>
<Tab.Screen
name="Tab1" name="Tab1"
component={Tab1} component={Tab1}
options={{tabBarLabel: 'Tin tức'}} options={{tabBarLabel: 'Tin tức'}}
......
import React, {Component} from 'react'; import React, {Component} from 'react';
import {View, Text, FlatList} from 'react-native'; import {View, Text, FlatList} from 'react-native';
import {WebView} from 'react-native-webview'; import {WebView} from 'react-native-webview';
import Item from './item';
const NewFeed = (props) => { const NewFeed = (props) => {
return ( return (
......
...@@ -21,3 +21,8 @@ export const getDetailMedia = async (id) => ...@@ -21,3 +21,8 @@ export const getDetailMedia = async (id) =>
GetData(url.urlMediaDetail + '/' + id) GetData(url.urlMediaDetail + '/' + id)
.then((res) => res) .then((res) => res)
.catch((err) => err); .catch((err) => err);
export const getListCalendar = async (body) =>
GetData(url.urlGetListCalendar, body)
.then((res) => res)
.catch((err) => err);
...@@ -13,4 +13,5 @@ export default { ...@@ -13,4 +13,5 @@ export default {
urlGetCategoryNew: root + 'api/v1/news/categories', urlGetCategoryNew: root + 'api/v1/news/categories',
urlGetListMedia: root + 'api/v1/news/videos', urlGetListMedia: root + 'api/v1/news/videos',
urlMediaDetail: root + 'api/v1/videos/detail', urlMediaDetail: root + 'api/v1/videos/detail',
urlGetListCalendar: root + 'api/v1/news/calendar',
}; };
...@@ -27,6 +27,7 @@ import { ...@@ -27,6 +27,7 @@ import {
HISTORY, HISTORY,
PROFILE, PROFILE,
AccountVerification, AccountVerification,
WALLETWITHDRAW,
} from '../../routers/ScreenNames'; } from '../../routers/ScreenNames';
const renderWallet = (status) => { const renderWallet = (status) => {
...@@ -161,7 +162,7 @@ const HeaderHome = (props) => { ...@@ -161,7 +162,7 @@ const HeaderHome = (props) => {
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
onPress={() => navigate.navigate(WITHDRAW)} onPress={() => navigate.navigate(WALLETWITHDRAW)}
style={styles.wraper}> style={styles.wraper}>
<Image style={styles.imgIcon} source={R.images.iconWithdrawal} /> <Image style={styles.imgIcon} source={R.images.iconWithdrawal} />
<Text style={styles.txt}>Rút tin</Text> <Text style={styles.txt}>Rút tin</Text>
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
TRANSFER, TRANSFER,
CHOOSEMETHOD, CHOOSEMETHOD,
WALLET, WALLET,
WALLETWITHDRAW,
} from '../routers/ScreenNames'; } from '../routers/ScreenNames';
const PlussModal = (props) => { const PlussModal = (props) => {
...@@ -63,10 +64,9 @@ const PlussModal = (props) => { ...@@ -63,10 +64,9 @@ const PlussModal = (props) => {
<Image style={styles.imgIcon} source={R.images.iconRecharge} /> <Image style={styles.imgIcon} source={R.images.iconRecharge} />
<Text style={styles.txt}>Np tin</Text> <Text style={styles.txt}>Np tin</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
navigate.navigate(WITHDRAW); navigate.navigate(WALLETWITHDRAW);
toggleModal(); toggleModal();
}} }}
style={styles.wraper1}> style={styles.wraper1}>
......
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