Commit 997d0fe8 by Giang Tran

update code

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