Skip to content

Commit

Permalink
Merge pull request #105 from p33a33/DummyOut
Browse files Browse the repository at this point in the history
[Client] delete dummy datas
  • Loading branch information
kyugshim authored Nov 1, 2020
2 parents 1a2822a + b0c1f4b commit 3ecd49a
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 136 deletions.
13 changes: 7 additions & 6 deletions src/components/OrderListEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Children } from 'react'
import { View } from 'react-native'
import { Text, Button, Input, Image, ListItem } from 'react-native-elements'
import Icon from 'react-native-vector-icons/FontAwesome'
import { SERVER } from '../pages/config'
import OrderInfo from '../pages/Feed/Mypage/OrderInfo/OrderInfo'


Expand All @@ -10,18 +11,18 @@ export default class OrderListEntry extends React.Component {
super(props)
}
render() {
let { orderInfo, navigation } = this.props
let { title, price, image } = orderInfo.product
let { order, navigation } = this.props
let { title, price, image } = order.products[0]
return (

<ListItem bottomDivider style={{ width: "100%" }} containerStyle={{ margin: 0, alignContent: "center" }} onPress={() => navigation.navigate('ProductDetail', { info: orderInfo.product })}>
<ListItem.Content style={{ flexDirection: "row" }}>
<Image source={{ uri: image[0] }} style={{ width: 90, height: 90 }} />
<Image source={{ uri: `${SERVER}${image}` }} style={{ width: 90, height: 90 }} />
<View style={{ marginLeft: 100, alignSelf: "center" }}>
<ListItem.Title style={{ letterSpacing: 1.5 }}>{title}</ListItem.Title>
<ListItem.Title style={{ letterSpacing: 1.5 }}>{title.toUpperCase()}</ListItem.Title>
<ListItem.Subtitle style={{ letterSpacing: 2, textAlign: "right" }}>{price}</ListItem.Subtitle>
<ListItem.Subtitle style={{ letterSpacing: 2, textAlign: "right" }}>{orderInfo.quantity}</ListItem.Subtitle>
<ListItem.Subtitle style={{ letterSpacing: 2, textAlign: "right" }}>{Number(orderInfo.quantity) * price}</ListItem.Subtitle>
<ListItem.Subtitle style={{ letterSpacing: 2, textAlign: "right" }}>{order.order_quantity}</ListItem.Subtitle>
<ListItem.Subtitle style={{ letterSpacing: 2, textAlign: "right" }}>{order.amount}</ListItem.Subtitle>
</View>
</ListItem.Content>
</ListItem>
Expand Down
10 changes: 6 additions & 4 deletions src/components/ProductListEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ScrollView } from 'react-native-gesture-handler'
import Icon from 'react-native-vector-icons/FontAwesome'
import Carousel, { Pagination } from 'react-native-snap-carousel';
import LinearGradient from 'react-native-linear-gradient'
import { SERVER } from '../pages/config'


export default class ProductListEntry extends React.Component {
Expand All @@ -19,15 +20,15 @@ export default class ProductListEntry extends React.Component {
_renderItem = ({ item, index }) => {
return (
<View style={{ margin: 10, padding: 10, alignItems: "center", }} >
<Image source={{ uri: item }} style={{ width: 230, height: 230, borderRadius: 20, }} />
<Image source={{ uri: `${SERVER}${item}` }} style={{ width: 230, height: 230, borderRadius: 20, }} />
</View>
);
}
get pagination() {
const { activeSlide } = this.state;
return (
<Pagination
dotsLength={this.props.productInfo.image.length}
dotsLength={this.props.images.length}
activeDotIndex={activeSlide}
containerStyle={{ marginTop: -40, marginBottom: -10 }}
dotStyle={{
Expand Down Expand Up @@ -56,11 +57,12 @@ export default class ProductListEntry extends React.Component {
return (
<ListItem bottomDivider style={{ width: "100%", }}
containerStyle={{ margin: 5, borderRadius: 30, backgroundColor: 'whitesmoke', elevation: 5, height: 390 }}
onPress={() => navigation.navigate('ProductDetail', { info: productInfo, handleVisible: this.props.handleVisible })}>
onPress={() => navigation.navigate('ProductDetail', { info: productInfo, handleVisible: this.props.handleVisible, images: this.props.images })}
>
<ListItem.Content style={{ alignItems: "center" }}>
<Carousel ref={(c) => { this._carousel = c; }}
inactiveSlideScale={0.9}
data={this.props.productInfo.image}
data={this.props.images}
renderItem={this._renderItem}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
Expand Down
6 changes: 4 additions & 2 deletions src/components/SellerInfoHome.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Axios from 'axios';
import React from 'react'
import { View, StyleSheet } from 'react-native'
import { Text, Button } from 'react-native-elements'
import { BoxShadow } from 'react-native-shadow';
import Icon from 'react-native-vector-icons/FontAwesome';
import { SERVER } from '../pages/config';



Expand All @@ -11,9 +13,9 @@ export default class SellerInfoHome extends React.Component {
super(props)
this.state = {
sellerInfo: [
{ Rate: "8.6" },
{ Rate: (Math.random() * 10).toFixed(1) },
{ Products: "193" },
{ Followers: "12.1k" }
{ Followers: `${(Math.random() * 10).toFixed(1)}k` }
]
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/SellerItemEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import { View, StyleSheet } from 'react-native'
import { Text, Image } from 'react-native-elements'
import LinearGradient from 'react-native-linear-gradient';
import { SERVER } from '../pages/config';



Expand All @@ -15,7 +16,7 @@ export default class SellerItemEntry extends React.Component {
let { navigation } = this.props
let { navigate } = navigation
let { itm } = this.props
let imgSrc = itm.image[0]
let imgSrc = itm.image
return (
<View key={itm.title}
style={{
Expand All @@ -28,7 +29,7 @@ export default class SellerItemEntry extends React.Component {
}} >
<Image
style={{ height: 140, width: 140, marginTop: 5, borderRadius: 20 }}
source={{ uri: imgSrc }}
source={{ uri: `${SERVER}${imgSrc}` }}
onPress={() => {
navigate('ProductDetail', { info: itm });
}}
Expand Down
104 changes: 29 additions & 75 deletions src/pages/Feed/Mypage/OrderInfo/OrderInfo.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,46 @@
import Axios from 'axios'
import React from 'react'
import { View } from 'react-native'
import { Text, Button, Input, ListItem, Card } from 'react-native-elements'
import { ScrollView } from 'react-native-gesture-handler'
import LinearGradient from 'react-native-linear-gradient'
import OrderListEntry from '../../../../components/OrderListEntry'
import { SERVER } from '../../../config'

export default class OrderInfo extends React.Component {
constructor(props) {
super(props)

this.dummyOrder = [{
id: "81272",
product: { name: "봉구비어", id: "1005", email: "[email protected]", image: ["https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_01_0948433_001_001_848.jpg", 'https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_01_0948433_001_003_848.jpg', "https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_02_0948433_001_001_848.jpg"], title: "Product 5", body: "선물하고싶은 상품", price: 5000 },
quantity: 3,
address: "서울특별시 강남구 봉은사로 1",
phoneNum: "010-0000-0000",
status: "yet"
},
{
id: "81273",
product: { name: "맥도날드", id: "1001", email: "[email protected]", image: ["https://image.thehyundai.com/static/8/6/8/18/A1/hnm40A1188689_0901685003_202002_LB_0661_Q8_L_1120x868_srgb_848.jpg", "https://image.thehyundai.com/static/8/6/8/18/A1/hnm40A1188689_02_0901685_003_001_848.jpg"], title: "Product 1", body: "대단한 상품", price: 860000 },
quantity: 1,
address: "서울특별시 강남구 봉은사로 1",
phoneNum: "010-0000-0000",
status: "yet"
},
{
id: "81274",
product: { name: "다이소", id: "1002", email: "[email protected]", image: ['https://cdn2.chrono24.com/images/uhren/16000731-5d7hntuyfucwgmqbuxikbm3u-Zoom.jpg', "https://cdn2.chrono24.com/images/uhren/16000731-w99felxi7r8kz35j2rgbiomy-Zoom.jpg", "https://cdn2.chrono24.com/images/uhren/16000731-nwj6pphl2uxobwbrqm15doii-Zoom.jpg"], title: "Product 2", body: "멋진 상품", price: 5100000 },
quantity: 2,
address: "서울특별시 강남구 봉은사로 1",
phoneNum: "010-0000-0000",
status: "done"
},
{
id: "81275",
product: { name: "홈플러스", id: "1003", email: "[email protected]", image: ["https://assetsprx.matchesfashion.com/img/product/1381554_1_zoom.jpg", 'https://assetsprx.matchesfashion.com/img/product/1381554_5_zoom.jpg', "https://assetsprx.matchesfashion.com/img/product/1381554_6_zoom.jpg"], title: "Product 4", body: "갖고싶은 상품", price: 150000 },
quantity: 5,
address: "서울특별시 강남구 봉은사로 1",
phoneNum: "010-0000-0000",
status: "done"
},
{
id: "81275",
product: { name: "경발원", id: "1004", email: "[email protected]", image: ["https://assetsprx.matchesfashion.com/img/product/1360764_1_zoom.jpg", 'https://assetsprx.matchesfashion.com/img/product/outfit_1360764_1_zoom.jpg', "https://assetsprx.matchesfashion.com/img/product/1360764_3_zoom.jpg"], title: "Product 3", body: "좋은 상품", price: 60000 },
quantity: 15,
address: "서울특별시 강남구 봉은사로 1",
phoneNum: "010-0000-0000",
status: "done"
},
]
this.state = {
orders: null
}
}

componentDidMount = () => {
Axios.get(`${SERVER}/myorder`).then(data => { this.setState({ orders: data.data }); console.log(data.data) })
}

render() {
return (
<ScrollView style={{ padding: 20 }}>
<Text h4 style={{ textAlign: "left", marginBottom: 20 }}>처리중인 주문</Text>
{this.dummyOrder.map(order => {
if (order.status === "yet") {
return <Card containerStyle={{ padding: 10 }}>
<Card.Title>
<OrderListEntry orderInfo={order} navigation={this.props.navigation} />
</Card.Title>
<Card.Divider />
<Text>Order# : {order.id}</Text>
<Text>Address : {order.address}</Text>
<Text>Contact : {order.phoneNum}</Text>
<Text>Status : {order.status} </Text>
</Card>
}
})
}
<Text h4 style={{ textAlign: "left", marginTop: 20, marginBottom: 20 }}>완료된 주문</Text>
{this.dummyOrder.map(order => {
if (order.status === "done") {
return <Card containerStyle={{ minWidth: "90%" }}>
<Card.Title>
<OrderListEntry orderInfo={order} navigation={this.props.navigation} />
</Card.Title>
<Card.Divider />
<Text>Order# : {order.id}</Text>
<Text>Address : {order.address}</Text>
<Text>Contact : {order.phoneNum}</Text>
<Text>Status : {order.status} </Text>
</Card>
}
})
}
</ScrollView>
<LinearGradient useAngle={true} angle={91.5} colors={['#E2E2E2', '#C9D6FF']} style={{ flex: 1, }}>
<View style={{ padding: 20, height: "100%" }}>
<Text h4 style={{ textAlign: "left", marginBottom: 20 }}>Orders</Text>
<ScrollView style={{ padding: 10 }}>
{this.state.orders && this.state.orders.map((order, key) => {
return <Card containerStyle={{ padding: 10, borderRadius: 15 }} key={key}>
<Card.Title>
<OrderListEntry order={order} navigation={this.props.navigation} />
</Card.Title>
<Card.Divider />
<Text>Order Number : {order.id}</Text>
<Text>Address : {order.address + order.addressDtail}</Text>
<Text>Status : {order.payment_status} </Text>
</Card>
})
}
</ScrollView>
</View>
</LinearGradient>
)
}
}
Expand Down
42 changes: 18 additions & 24 deletions src/pages/Feed/ProductList/ProductList.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
import Axios from 'axios'
import React from 'react'
import { View, Image, StyleSheet } from 'react-native'
import { Text, Button, Input, Header } from 'react-native-elements'
import { ScrollView } from 'react-native-gesture-handler'
import LinearGradient from 'react-native-linear-gradient'
import { CustomHeader } from '../../../components/CustomHeader'
import ProductListEntry from '../../../components/ProductListEntry'
import { SERVER } from '../../config'

export default class ProductList extends React.Component {
constructor(props) {
super(props)
this.state = {
products: null
}
}

list = [
{
name: "ANYA HINDMARCH", id: "1", email: "[email protected]", image: ["https://assetsprx.matchesfashion.com/img/product/1337372_1_zoom.jpg", 'https://assetsprx.matchesfashion.com/img/product/outfit_1337372_1_zoom.jpg', "https://assetsprx.matchesfashion.com/img/product/1337372_4_zoom.jpg"], title: "츄잉 검 캔들",
body: "<Div>그린 글라스 용기에 브랜드 시그니처인 아이 아플리케를 장식하고 왁스를 손으로 부어 영국에서 제작했습니다. 디자이너의 학창 시절을 떠올리며 영감을 얻은 민트와 핑크 페퍼, 타임, 카시스 펄프 등이 어우러진 향이 특징입니다. 따사로운 햇볕이 느껴지는 여유로운 오후에 향을 피워 어릴 적 소중한 순간을 추억해보세요.</Div>", price: "5,000"
},
{ name: "& Other Stories", id: "2", email: "[email protected]", image: ["https://image.thehyundai.com/static/8/6/8/18/A1/hnm40A1188689_0901685003_202002_LB_0661_Q8_L_1120x868_srgb_848.jpg", "https://image.thehyundai.com/static/8/6/8/18/A1/hnm40A1188689_02_0901685_003_001_848.jpg"], title: "크롭 버튼 업 니트 스웨터", body: "크롭 실루엣의 롱 슬리브 스웨터예요. 케이블 니트 룩과 메인 패브릭 소재로 감싼 단추가 특징이랍니다.", price: "860,000" },
{
name: "Cartier", id: "3", email: "[email protected]", image: ['https://cdn2.chrono24.com/images/uhren/16000731-5d7hntuyfucwgmqbuxikbm3u-Zoom.jpg', "https://cdn2.chrono24.com/images/uhren/16000731-w99felxi7r8kz35j2rgbiomy-Zoom.jpg", "https://cdn2.chrono24.com/images/uhren/16000731-nwj6pphl2uxobwbrqm15doii-Zoom.jpg"], title: "크래쉬 워치",
body: "1967년 '스윙잉 런던(Swinging London)'의 한복판에서 탄생한 크래쉬 워치는 당대의 역동적이고 자유로운 분위기를 반영하고 있으며, 새로운 형태를 창조하는 워치메이커 까르띠에와 순응주의를 거부하는 반항적이면서도 유쾌한 팝 정신이 만나 탄생한 모델입니다.", price: "5,100,000"
},
{
name: "Bottega Veneta", id: "4", email: "[email protected]", image: ["https://assetsprx.matchesfashion.com/img/product/1381554_1_zoom.jpg", 'https://assetsprx.matchesfashion.com/img/product/1381554_5_zoom.jpg', "https://assetsprx.matchesfashion.com/img/product/1381554_6_zoom.jpg"], title: "스트레치 스퀘어 토 가죽 뮬",
body: "스퀘어 토 실루엣으로 보테가 베네타(Bottega Veneta)를 이끄는 다니엘 리(Daniel Lee) 고유의 디자인 미학을 담아낸 크림 색상 스트레치 뮬을 만나보세요. 부드러운 가죽으로 넓은 앞면 스트랩을 구성하고 가느다란 스틸레토 힐을 세팅한 이탈리아 제작 상품이며 안정적인 착화감을 위해 밑창에 고무 그립을 더했습니다. 테일러드 룩에 우아한 포인트 아이템으로 매치해보세요.", price: "150,000"
},
{
name: "Bottega Veneta", id: "5", email: "[email protected]", image: ["https://assetsprx.matchesfashion.com/img/product/1360764_1_zoom.jpg", "https://assetsprx.matchesfashion.com/img/product/1360764_3_zoom.jpg", 'https://assetsprx.matchesfashion.com/img/product/outfit_1360764_1_zoom.jpg'], title: "더 숄더 파우치 라지 가죽 백",
body: "볼륨감 있는 모던한 실루엣이 돋보이는 보테가 베네타(Bottega Veneta)의 탠 브라운 더 숄더 파우치 백을 살펴보세요. 이탈리아에서 부드러운 가죽으로 제작했으며, 넉넉한 내부 공간의 중앙 부분에서 시작되는 주름 장식과 로고 디테일이 브랜드 고유의 디자인을 완성합니다 뉴트럴 톤으로 스타일링한 룩에 들어 군더더기 없이 담백한 감성을 표현해보세요.", price: "60,000"
},
{
name: "& Other Stories", id: "6", email: "[email protected]", image: ["https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_01_0948433_001_001_848.jpg", 'https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_01_0948433_001_003_848.jpg', "https://image.thehyundai.com/static/3/1/7/20/A1/hnm40A1207139_02_0948433_001_001_848.jpg"], title: "릴렉스드 퍼지 버블 니트 스웨터",
body: "롱 슬리브의 니트 스웨터예요. 릴렉스드 버블 실루엣, 그리고 솜털 같은 텍스처가 특징이에요.", price: "5,000"
},
]
componentDidMount = () => {
Axios.get(`${SERVER}/allitem`).then(data => {
console.log(data.data)
this.setState({ products: data.data })
})
}

render() {
return (
Expand All @@ -47,7 +35,13 @@ export default class ProductList extends React.Component {
}}>SHOP</Text>
<Text style={{ fontSize: 16, letterSpacing: 1, fontFamily: 'sans-serif-thin', }}>TRENDING</Text>
</View>
{this.list.map((product, index, array) => <ProductListEntry key={index} list={array} productInfo={product} navigation={this.props.navigation} handleVisible={this.props.route.params.handleVisible} />)}
{this.state.products && this.state.products.map((product, index, array) => {
let images = [];
if (product.image) { images.push(product.image) }
if (product.image2) { images.push(product.image2) }
if (product.image3) { images.push(product.image3) }
return <ProductListEntry key={index} list={array} productInfo={product} navigation={this.props.navigation} handleVisible={this.props.route.params.handleVisible} images={images} />
})}
</ScrollView>
</LinearGradient>
</>
Expand Down
Loading

0 comments on commit 3ecd49a

Please sign in to comment.