Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
shopping-mall
Commits
42ab4e72
Commit
42ab4e72
authored
Jan 08, 2021
by
이재연
Browse files
Merge remote-tracking branch 'origin/ourMaster' into jaeyeon
parents
418d3466
e5447f77
Changes
9
Show whitespace changes
Inline
Side-by-side
client/src/Pages/Home.js
View file @
42ab4e72
...
@@ -11,7 +11,7 @@ function Home() {
...
@@ -11,7 +11,7 @@ function Home() {
<
SubNav
/>
<
SubNav
/>
<
Container
className
=
"
my-5
"
>
<
Container
className
=
"
my-5
"
>
<
div
className
=
"
my-4
"
>
<
div
className
=
"
my-4
"
>
<
h2
style
=
{{
marginRight
:
"
5rem
"
,
marginLeft
:
"
5
rem
"
,
marginBottom
:
"
2rem
"
}}
><
u
>
Best
<
/u></
h2
>
<
h2
style
=
{{
marginRight
:
"
5rem
"
,
marginLeft
:
"
3
rem
"
,
marginBottom
:
"
2rem
"
}}
><
u
>
Best
<
/u></
h2
>
<
Row
className
=
"
justify-content-center mx-0
"
>
<
Row
className
=
"
justify-content-center mx-0
"
>
<
Card
className
=
"
mx-1 my-2
"
style
=
{{
width
:
'
18rem
'
}}
>
<
Card
className
=
"
mx-1 my-2
"
style
=
{{
width
:
'
18rem
'
}}
>
<
Card
.
Img
className
=
"
img-fluid
"
variant
=
"
top
"
src
=
"
img/asd.jpg
"
/>
<
Card
.
Img
className
=
"
img-fluid
"
variant
=
"
top
"
src
=
"
img/asd.jpg
"
/>
...
@@ -58,7 +58,7 @@ function Home() {
...
@@ -58,7 +58,7 @@ function Home() {
<
/Row
>
<
/Row
>
<
/div
>
<
/div
>
<
div
className
=
"
my-4
"
>
<
div
className
=
"
my-4
"
>
<
h2
style
=
{{
marginRight
:
"
5rem
"
,
marginLeft
:
"
5
rem
"
,
marginBottom
:
"
2rem
"
,
marginTop
:
"
2rem
"
}}
><
u
>
New
Arrival
<
/u></
h2
>
<
h2
style
=
{{
marginRight
:
"
5rem
"
,
marginLeft
:
"
3
rem
"
,
marginBottom
:
"
2rem
"
,
marginTop
:
"
2rem
"
}}
><
u
>
New
Arrival
<
/u></
h2
>
<
Row
className
=
"
justify-content-center mx-0
"
>
<
Row
className
=
"
justify-content-center mx-0
"
>
<
Card
className
=
"
mx-1 my-2
"
style
=
{{
width
:
'
18rem
'
}}
>
<
Card
className
=
"
mx-1 my-2
"
style
=
{{
width
:
'
18rem
'
}}
>
<
Card
.
Img
className
=
"
img-fluid
"
variant
=
"
top
"
src
=
"
img/asd.jpg
"
/>
<
Card
.
Img
className
=
"
img-fluid
"
variant
=
"
top
"
src
=
"
img/asd.jpg
"
/>
...
...
client/src/Pages/Product
s
Regist.js
→
client/src/Pages/ProductRegist.js
View file @
42ab4e72
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'
react
'
;
import
Nav
1
from
'
../Components/MainNav
'
;
import
Main
Nav
from
'
../Components/MainNav
'
;
import
Nav
2
from
'
../Components/SubNav
'
;
import
Sub
Nav
from
'
../Components/SubNav
'
;
import
{
Row
,
Col
,
Button
,
Form
,
Container
}
from
'
react-bootstrap
'
;
import
{
Row
,
Col
,
Button
,
Form
,
Container
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
import
axios
from
'
axios
'
function
ProductsRegist
()
{
function
ProductsRegist
()
{
const
[
product
,
setProduct
]
=
useState
()
const
[
product
,
setProduct
]
=
useState
()
function
handleChange
(
event
)
{
function
handleChange
(
event
)
{
const
{
name
,
value
}
=
event
.
target
const
{
name
,
value
}
=
event
.
target
console
.
log
(
"
file=
"
,
event
.
target
.
files
)
console
.
log
(
"
name=
"
,
name
,
"
value=
"
,
value
)
setProduct
({
...
product
,
[
name
]:
value
})
setProduct
({
...
product
,
[
name
]:
value
})
}
}
function
handleSubmit
(
e
)
{
function
handleSubmit
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
axios
.
post
(
'
/api/products/regist
'
,
{
const
formData
=
new
FormData
();
product
for
(
let
key
of
Object
.
keys
(
product
))
{
}).
then
(
function
(
res
)
{
formData
.
append
(
key
,
product
[
key
])
}
console
.
log
(
"
formData=
"
,
formData
)
axios
.
post
(
'
/api/product/regist
'
,{
data
:
formData
}).
then
(
function
(
res
)
{
console
.
log
(
"
client의 res=
"
,
res
)
console
.
log
(
"
client의 res=
"
,
res
)
})
})
}
}
...
@@ -26,8 +30,8 @@ function ProductsRegist() {
...
@@ -26,8 +30,8 @@ function ProductsRegist() {
return
(
return
(
<
div
>
<
div
>
{
console
.
log
(
product
)}
{
console
.
log
(
product
)}
<
Nav
1
/>
<
Main
Nav
/>
<
Nav
2
/>
<
Sub
Nav
/>
<
Container
>
<
Container
>
<
Row
className
=
"
justify-content-md-center
"
>
<
Row
className
=
"
justify-content-md-center
"
>
<
Col
md
=
{
6
}
className
=
"
border m-5 p-3
"
style
=
{{
background
:
'
#F7F3F3
'
}}
>
<
Col
md
=
{
6
}
className
=
"
border m-5 p-3
"
style
=
{{
background
:
'
#F7F3F3
'
}}
>
...
...
client/src/Pages/ProductsList.js
View file @
42ab4e72
...
@@ -3,10 +3,11 @@ import MainNav from '../Components/MainNav';
...
@@ -3,10 +3,11 @@ import MainNav from '../Components/MainNav';
import
SubNav
from
'
../Components/SubNav
'
;
import
SubNav
from
'
../Components/SubNav
'
;
import
Pagination
from
'
../Components/Pagination
'
;
import
Pagination
from
'
../Components/Pagination
'
;
import
search
from
'
../search.svg
'
;
import
search
from
'
../search.svg
'
;
import
{
Container
,
Row
,
Form
,
FormControl
,
Button
,
Card
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Col
,
Form
,
FormControl
,
Button
,
Card
,
Dropdown
}
from
'
react-bootstrap
'
;
function
ProductsList
()
{
function
ProductsList
()
{
const
[
sub
,
setSub
]
=
useState
([
'
PADDED JACKET
'
,
'
JACKET
'
,
'
JUMPER
'
,
'
COAT
'
,
'
FLEECE
'
,
'
CARDIGAN / VEST
'
])
const
[
sub
,
setSub
]
=
useState
([
'
PADDED JACKET
'
,
'
JACKET
'
,
'
JUMPER
'
,
'
COAT
'
,
'
FLEECE
'
,
'
CARDIGAN / VEST
'
])
function
handleSubmit
(
e
)
{
function
handleSubmit
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
}
}
...
@@ -20,7 +21,7 @@ function ProductsList() {
...
@@ -20,7 +21,7 @@ function ProductsList() {
border-color: #CDC5C2;
border-color: #CDC5C2;
}
}
.btn:hover, .btn:active, .btn:focus {
.btn:hover, .btn:active, .btn:focus
, .show>.btn-primary.dropdown-toggle
{
background-color: #91877F;
background-color: #91877F;
border-color: #91877F;
border-color: #91877F;
}
}
...
@@ -29,20 +30,31 @@ function ProductsList() {
...
@@ -29,20 +30,31 @@ function ProductsList() {
<
MainNav
/>
<
MainNav
/>
<
SubNav
/>
<
SubNav
/>
<
Container
>
<
Container
>
<
Row
className
=
"
mx-0 my-4
"
style
=
{{
flexDirection
:
"
column
"
,
alignItems
:
"
center
"
}}
>
<
Row
className
=
"
justify-content-center mx-0 my-4
"
>
<
h1
style
=
{{
fontSize
:
"
3rem
"
}}
>
OUTER
<
/h1
>
<
Col
sm
=
{
10
}
>
<
Row
>
<
h1
style
=
{{
fontSize
:
"
3rem
"
}}
>
OUTER
<
/h1
>
{
sub
.
map
((
ele
)
=>
(
<
div
>
{
sub
.
map
((
ele
)
=>
(
<
Button
>
ele
<
/Button
>
<
Button
className
=
"
m-1
"
>
{
ele
}
<
/Button
>
))}
))}
<
/div
>
<
/
Row
>
<
/
Col
>
<
/Row
>
<
/Row
>
<
Row
as
=
{
Form
}
onSubmit
=
{
handleSubmit
}
className
=
"
justify-content-end mx-0 my-5
"
>
<
Row
className
=
"
justify-content-between mx-0 my-5
"
>
<
Dropdown
>
<
Dropdown
.
Toggle
>
정렬
<
/Dropdown.Toggle
>
<
Dropdown
.
Menu
>
<
Dropdown
.
Item
>
인기상품
<
/Dropdown.Item
>
<
Dropdown
.
Item
>
신상품
<
/Dropdown.Item
>
<
Dropdown
.
Item
>
낮은가격
<
/Dropdown.Item
>
<
Dropdown
.
Item
>
높은가격
<
/Dropdown.Item
>
<
/Dropdown.Menu
>
<
/Dropdown
>
<
Form
as
=
{
Row
}
onSubmit
=
{
handleSubmit
}
className
=
"
justify-content-end mx-0
"
>
<
FormControl
type
=
"
text
"
placeholder
=
"
Search
"
style
=
{{
width
:
"
13rem
"
}}
/
>
<
FormControl
type
=
"
text
"
placeholder
=
"
Search
"
style
=
{{
width
:
"
13rem
"
}}
/
>
<
Button
type
=
"
submit
"
className
=
"
search px-2
"
>
<
Button
type
=
"
submit
"
className
=
"
search px-2
"
>
<
img
src
=
{
search
}
width
=
"
20
"
height
=
"
20
"
/>
<
img
src
=
{
search
}
width
=
"
20
"
height
=
"
20
"
/>
<
/Button
>
<
/Button
>
<
Button
sm
=
{
2
}
xs
=
{
6
}
type
=
"
button
"
href
=
"
/regist
"
className
=
"
ml-1
"
>
상품
등록
<
/Button
>
<
Button
sm
=
{
2
}
xs
=
{
6
}
type
=
"
button
"
href
=
"
/regist
"
className
=
"
ml-1
"
>
상품
등록
<
/Button
>
<
/Form
>
<
/Row
>
<
/Row
>
<
Row
className
=
"
justify-content-start m-5
"
>
<
Row
className
=
"
justify-content-start m-5
"
>
<
Card
className
=
"
mt-5
"
style
=
{{
width
:
"
18rem
"
,
margin
:
"
auto
"
}}
>
<
Card
className
=
"
mt-5
"
style
=
{{
width
:
"
18rem
"
,
margin
:
"
auto
"
}}
>
...
...
client/src/index.js
View file @
42ab4e72
...
@@ -7,7 +7,7 @@ import Signup from './Pages/Signup';
...
@@ -7,7 +7,7 @@ import Signup from './Pages/Signup';
import
Product
from
"
./Pages/Product
"
;
import
Product
from
"
./Pages/Product
"
;
import
ProductsList
from
"
./Pages/ProductsList
"
;
import
ProductsList
from
"
./Pages/ProductsList
"
;
import
Admin
from
'
./Pages/Admin
'
;
import
Admin
from
'
./Pages/Admin
'
;
import
Product
s
Regist
from
'
./Pages/Product
s
Regist
'
;
import
ProductRegist
from
'
./Pages/ProductRegist
'
;
import
ShoppingCart
from
'
./Pages/ShoppingCart
'
;
import
ShoppingCart
from
'
./Pages/ShoppingCart
'
;
import
Payment
from
'
./Pages/Payment
'
;
import
Payment
from
'
./Pages/Payment
'
;
import
reportWebVitals
from
'
./reportWebVitals
'
;
import
reportWebVitals
from
'
./reportWebVitals
'
;
...
@@ -24,7 +24,7 @@ ReactDOM.render(
...
@@ -24,7 +24,7 @@ ReactDOM.render(
<
Route
path
=
"
/product
"
component
=
{
Product
}
/
>
<
Route
path
=
"
/product
"
component
=
{
Product
}
/
>
<
Route
path
=
"
/productslist
"
component
=
{
ProductsList
}
/
>
<
Route
path
=
"
/productslist
"
component
=
{
ProductsList
}
/
>
<
Route
path
=
"
/admin
"
component
=
{
Admin
}
/
>
<
Route
path
=
"
/admin
"
component
=
{
Admin
}
/
>
<
Route
path
=
"
/regist
"
component
=
{
Product
s
Regist
}
/
>
<
Route
path
=
"
/regist
"
component
=
{
ProductRegist
}
/
>
<
Route
path
=
"
/shoppingcart
"
component
=
{
ShoppingCart
}
/
>
<
Route
path
=
"
/shoppingcart
"
component
=
{
ShoppingCart
}
/
>
<
Route
path
=
"
/payment
"
component
=
{
Payment
}
/
>
<
Route
path
=
"
/payment
"
component
=
{
Payment
}
/
>
<
Route
path
=
"
/account
"
component
=
{
Account
}
/
>
<
Route
path
=
"
/account
"
component
=
{
Account
}
/
>
...
...
server/app.js
View file @
42ab4e72
...
@@ -24,7 +24,7 @@ app.use(express.static(path.join(process.cwd(), 'dist')))
...
@@ -24,7 +24,7 @@ app.use(express.static(path.join(process.cwd(), 'dist')))
app
.
use
(
'
/
'
,
kakaopayRoutes
)
app
.
use
(
'
/
'
,
kakaopayRoutes
)
app
.
use
(
'
/api/users
'
,
userRouter
)
app
.
use
(
'
/api/users
'
,
userRouter
)
app
.
use
(
'
/api/auth
'
,
authRouter
)
app
.
use
(
'
/api/auth
'
,
authRouter
)
app
.
use
(
'
/api/product
s
'
,
productRouter
)
app
.
use
(
'
/api/product
'
,
productRouter
)
app
.
listen
(
config
.
port
,
()
=>
{
app
.
listen
(
config
.
port
,
()
=>
{
console
.
info
(
'
Server started on port %s.
'
,
config
.
port
)
console
.
info
(
'
Server started on port %s.
'
,
config
.
port
)
...
...
server/controllers/product.controller.js
View file @
42ab4e72
...
@@ -2,7 +2,9 @@ import Product from "../schemas/Product.js";
...
@@ -2,7 +2,9 @@ import Product from "../schemas/Product.js";
const
regist
=
async
(
req
,
res
)
=>
{
const
regist
=
async
(
req
,
res
)
=>
{
console
.
log
(
'
req.body=
'
,
req
.
body
)
console
.
log
(
'
req.body=
'
,
req
.
body
)
const
{
pro_name
,
price
,
stock
,
main_category
,
sub_category
,
description
,
main_image
,
detail_image
}
=
req
.
body
.
product
console
.
log
(
'
req.data=
'
,
req
.
data
)
console
.
log
(
'
req.body.data=
'
,
req
.
body
.
data
)
const
{
pro_name
,
price
,
stock
,
main_category
,
sub_category
,
description
,
main_image
,
detail_image
}
=
req
.
body
try
{
try
{
const
newProduct
=
await
new
Product
({
const
newProduct
=
await
new
Product
({
pro_name
,
price
,
stock
,
main_category
,
sub_category
,
description
,
main_image
,
detail_image
pro_name
,
price
,
stock
,
main_category
,
sub_category
,
description
,
main_image
,
detail_image
...
...
server/controllers/user.controller.js
View file @
42ab4e72
server/routes/product.routes.js
View file @
42ab4e72
import
express
from
"
express
"
;
import
express
from
"
express
"
;
import
path
from
'
path
'
;
import
multer
from
'
multer
'
;
import
productCtrl
from
'
../controllers/product.controller.js
'
;
import
productCtrl
from
'
../controllers/product.controller.js
'
;
// process.cwd() + '/client/public/image'
const
router
=
express
.
Router
()
const
router
=
express
.
Router
()
const
upload
=
multer
({
storage
:
multer
.
diskStorage
({
destination
(
req
,
file
,
cb
)
{
cb
(
null
,
'
uploads/
'
);
},
// 저장 경로 변경
filename
(
req
,
file
,
cb
)
{
cb
(
null
,
new
Date
().
valueOf
()
+
path
.
extname
(
file
.
originalname
));
},
// 파일명 변경
}),
});
router
.
route
(
'
/regist
'
)
router
.
route
(
'
/regist
'
)
.
post
(
productCtrl
.
regist
)
.
post
(
productCtrl
.
regist
)
// upload.array('main_image'),
export
default
router
export
default
router
\ No newline at end of file
server/schemas/Product.js
View file @
42ab4e72
...
@@ -8,15 +8,15 @@ const ProductSchema = new mongoose.Schema({
...
@@ -8,15 +8,15 @@ const ProductSchema = new mongoose.Schema({
required
:
true
,
required
:
true
,
},
},
price
:
{
price
:
{
type
:
String
,
type
:
Number
,
required
:
true
,
required
:
true
,
},
},
stock
:
{
stock
:
{
type
:
String
,
type
:
Number
,
required
:
true
required
:
true
},
},
purchase
:
{
purchase
:
{
type
:
String
,
type
:
Number
,
required
:
true
,
required
:
true
,
default
:
0
default
:
0
},
},
...
@@ -25,7 +25,7 @@ const ProductSchema = new mongoose.Schema({
...
@@ -25,7 +25,7 @@ const ProductSchema = new mongoose.Schema({
required
:
true
,
required
:
true
,
},
},
sub_category
:
{
sub_category
:
{
type
:
String
,
type
:
Array
,
required
:
true
,
required
:
true
,
},
},
description
:
{
description
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment