Commit 647d9d36 authored by 박상호's avatar 박상호 🎼
Browse files

please do merge mine :(

parent 20025a25
...@@ -166,20 +166,20 @@ function Product({ match, location }) { ...@@ -166,20 +166,20 @@ function Product({ match, location }) {
<h3 style={{ borderBottom: "1px solid #91877F", paddingBottom: "5px", marginBottom: "1em" }} className="p-3"> <h3 style={{ borderBottom: "1px solid #91877F", paddingBottom: "5px", marginBottom: "1em" }} className="p-3">
설명 설명
</h3> </h3>
<Col className='m-3 text-center d-flex justify-content-center'> <Col className='justify-content-center '>
<div style={{ wordBreak: 'break-all', wordWrap: 'break-word', fontFamily: "맑은 고딕" }} className="p-3"> <h2 className='p-2 text-center border' style={{background : '#CDC5C2'}}>{product.name} </h2>
<h1 className='m-3'>{product.name} </h1>
<> <>
<Image src={`/images/${product.main_img}`} style={{ objectFit: "contain", width: '100%'}} /> <Image src={`/images/${product.main_img}`} style={{ objectFit: "contain", maxWidth: "100%"}} />
</> </>
<Card className='m-3 d-flex justify-content-center'> <Card className='m-3 d-flex justify-content-center'>
<Card.Body> <Card.Body className='text-center'>
{product.description} {product.description}
</Card.Body> </Card.Body>
</Card> </Card>
<h3 className='mt-5'>[ Detail Images ]</h3> <>
<Image src={`/images/${product.detail_imgs}`} style={{ objectFit: "contain"}} className='m-3' /> <h4 className='my-4 text-center'>[ Detail Images ]</h4>
</div> <Image src={`/images/${product.detail_imgs}`} style={{ objectFit: "contain", maxWidth: "100%"}}/>
</>
</Col> </Col>
</Col> </Col>
</Row> </Row>
......
...@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; ...@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
import ListCard from '../Components/ListCard'; import ListCard from '../Components/ListCard';
import axios from 'axios'; import axios from 'axios';
import catchError from '../utils/catchErrors'; import catchError from '../utils/catchErrors';
import { Container, Row, Col, Form, FormControl, Button, Dropdown, ButtonGroup } from 'react-bootstrap'; import { Container, Row, Col, Form, FormControl, Button, Dropdown, ButtonGroup, Image } from 'react-bootstrap';
function ProductsList({ match }) { function ProductsList({ match }) {
const [mainCategory, setMainCategory] = useState(match.params.main.toUpperCase()) const [mainCategory, setMainCategory] = useState(match.params.main.toUpperCase())
...@@ -60,9 +60,15 @@ function ProductsList({ match }) { ...@@ -60,9 +60,15 @@ function ProductsList({ match }) {
console.log("subname response data=", response.data) console.log("subname response data=", response.data)
setProductlist(response.data) setProductlist(response.data)
} catch (error) { } catch (error) {
console.log("error22") console.log("오류입니다.")
} }
} }
// async function readygoods(event) {
// const
// window.location.href='/'
// }
return ( return (
<div> <div>
...@@ -113,20 +119,9 @@ function ProductsList({ match }) { ...@@ -113,20 +119,9 @@ function ProductsList({ match }) {
</Form> </Form>
</Row> </Row>
<Row md={8} sm={12} className="justify-content-center m-2"> <Row md={8} sm={12} className="justify-content-center m-2">
{productlist.map(pro => ( {productlist.length > 0 ?
// <ListCard as={Link} id={pro._id} name={pro.pro_name} price={pro.price} main_img={pro.main_imgUrl} to={{ productlist.map(pro => (
// pathname: `/product/${pro._id}`,
// state: {
// id: pro._id,
// name: pro.pro_name,
// price: pro.price,
// colors: pro.colors,
// sizes: pro.sizes,
// description: pro.description,
// main_img: pro.main_imgUrl,
// detail_imgs: pro.detail_imgUrls
// }
// }} />
<Link to={{ <Link to={{
pathname: `/product/${pro._id}`, pathname: `/product/${pro._id}`,
state: { state: {
...@@ -139,10 +134,18 @@ function ProductsList({ match }) { ...@@ -139,10 +134,18 @@ function ProductsList({ match }) {
main_img: pro.main_imgUrl, main_img: pro.main_imgUrl,
detail_imgs: pro.detail_imgUrls detail_imgs: pro.detail_imgUrls
} }
// onClick={readygoods}
}}> }}>
<ListCard id={pro._id} name={pro.pro_name} price={pro.price} main_img={pro.main_imgUrl} /> <ListCard id={pro._id} name={pro.pro_name} price={pro.price} main_img={pro.main_imgUrl}
/>
</Link> </Link>
))} ))
: (
<Image src="/sryimready.jpg"
style={{ objectFit: "cover", width: "45 rem", height: "45 rem" }}></Image>
)
}
</Row> </Row>
</Container> </Container>
</div> </div>
......
...@@ -51,20 +51,4 @@ const getsubId = async (req, res, next, ele) => { ...@@ -51,20 +51,4 @@ const getsubId = async (req, res, next, ele) => {
next() next()
} }
// const userById = async (req, res, next, id) => {
// try {
// const user = await User.findById(id)
// if (!user) {
// res.status(404).send('사용자를 찾을 수 없습니다')
// }
// req.account = user
// next()
// } catch (error) {
// console.log(error);
// res.status(500).send('사용자 아이디 검색 실패')
// }
// }
export default { getCategory, getsubId, getSubCategory, getToHome } export default { getCategory, getsubId, getSubCategory, getToHome }
\ No newline at end of file
...@@ -58,14 +58,6 @@ const getlist = (req, res) => { ...@@ -58,14 +58,6 @@ const getlist = (req, res) => {
} }
} }
const subname = async (req, res) => {
try {
console.log("last subname::: LET ME SEE")
res.json(req.findsubname)
} catch (error) {
res.status(500).send('상품을 불러오지 못했습니다.')
}
}
const categoryId = async (req, res, next, category) => { const categoryId = async (req, res, next, category) => {
try { try {
...@@ -81,25 +73,20 @@ const categoryId = async (req, res, next, category) => { ...@@ -81,25 +73,20 @@ const categoryId = async (req, res, next, category) => {
} }
} }
const subname = async (req, res) => {
try {
console.log("last subname::: LET ME SEE")
res.json(req.findsubname)
} catch (error) {
res.status(500).send('상품을 불러오지 못했습니다.')
}
}
const subcategoryId = async (req, res, next, subname) => { const subcategoryId = async (req, res, next, subname) => {
try { try {
console.log("Please===>>>", subname) console.log("Please===>>>", subname)
const findSubname = await Product.find({ sub_category: subname }) const findSubname = await Product.find({ sub_category: subname })
console.log("findSubname111=", findSubname) console.log("findSubname111=", findSubname)
// const onlySub = findSubname.sub_category
// console.log(";;", onlySub)
// console.log(".", Object.values(onlySub))
if (!findSubname) {
const findSubname = {
_id: 'nothing',
pro_name: '상품준비중',
price: 0,
main_imgUrl:''
}
console.log("findSubname2222=", findSubname)
res.send(findSubname)
}
res.send(findSubname) res.send(findSubname)
} catch (error) { } catch (error) {
res.send('상품을 불러오지 못했습니다.') res.send('상품을 불러오지 못했습니다.')
......
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