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
33f14441
Commit
33f14441
authored
Jan 20, 2021
by
박상호
🎼
Browse files
0120
parent
22e80f26
Changes
7
Show whitespace changes
Inline
Side-by-side
client/src/Pages/Account.js
View file @
33f14441
...
...
@@ -13,6 +13,7 @@ const INIT_ACCOUNT = {
function
Account
()
{
const
[
account
,
setAccount
]
=
useState
(
INIT_ACCOUNT
)
const
[
show
,
setShow
]
=
useState
(
false
);
const
[
proshow
,
setProshow
]
=
useState
(
false
)
const
[
error
,
setError
]
=
useState
(
""
)
const
userId
=
isAuthenticated
()
...
...
@@ -21,7 +22,7 @@ function Account() {
try
{
const
response
=
await
axios
.
get
(
`/api/users/account/
${
user
}
`
)
setAccount
(
response
.
data
)
//
console.log('555555555', response.data);
console
.
log
(
'
555555555
'
,
response
.
data
);
}
catch
(
error
)
{
catchError
(
error
,
setError
)
// console.log('error2222', error)
...
...
@@ -104,8 +105,8 @@ function Account() {
)}
<
/Button
>
<
Modal
show
=
{
show
}
onHide
=
{()
=>
setShow
(
false
)}
>
<
Modal
.
Header
closeButton
>
<
Modal
.
Title
>
이미지를
변경하시겠습니까
?
<
/Modal.Title
>
<
Modal
.
Header
closeButton
style
=
{{
background
:
"
#F7F3F3
"
}}
>
<
Modal
.
Title
>
이미지를
변경하시겠습니까
?
<
/Modal.Title
>
<
/Modal.Header
>
<
Form
onSubmit
=
{
handleSubmit
}
>
<
Modal
.
Body
>
...
...
@@ -127,7 +128,28 @@ function Account() {
<
Row
className
=
"
mt-4 text-center
"
>
<
Col
>
<
h2
>
<
strong
>
{
account
.
name
}
<
/strong> <small>
(
{account.id}
)
{" "}님</
small
>
<
strong
title
=
'
회원정보
'
style
=
{{
cursor
:
"
pointer
"
,
textDecoration
:
'
underline
'
}}
onClick
=
{()
=>
setProshow
(
true
)}
>
{
account
.
name
}
<
/strong
>
<
Modal
size
=
"
sm
"
show
=
{
proshow
}
onHide
=
{()
=>
setProshow
(
false
)}
>
<
Modal
.
Header
closeButton
style
=
{{
background
:
"
#F7F3F3
"
}}
>
<
Modal
.
Title
>
회원정보
<
/Modal.Title
>
<
/Modal.Header
>
<
Modal
.
Body
>
<
Col
className
=
"
p-1
"
>
<
li
><
strong
>
Role
:
<
/strong> {account.role}</
li
>
<
li
><
strong
>
ID
:
<
/strong> {account.id}</
li
>
<
li
><
strong
>
Username
:
<
/strong> {account.name}</
li
>
<
li
><
strong
>
Email
:
<
/strong> {account.email}</
li
>
<
li
><
strong
>
Tel
:
<
/strong> {account.tel}</
li
>
<
/Col
>
<
/Modal.Body
>
<
/Modal
>
<
small
>
{
'
'
}({
account
.
id
}){
"
"
}
님
<
/small
>
<
/h2
>
<
/Col
>
<
/Row
>
...
...
client/src/Pages/Login.js
View file @
33f14441
...
...
@@ -89,8 +89,8 @@ function Login() {
<
/Form.Control.Feedback
>
<
/Form.Row
>
<
/Form.Group
>
<
Button
style
=
{{
background
:
'
#91877F
'
,
borderColor
:
'
#91877F
'
}}
type
=
"
submit
"
block
>
Login
<
/Button
>
<
div
className
=
"
loginLine
"
>
<
Button
style
=
{{
background
:
'
#91877F
'
,
borderColor
:
'
#91877F
'
}}
type
=
"
submit
"
block
>
Login
<
/Button
>
<
div
className
=
"
loginLine
m-1
"
>
<
Link
to
=
"
/signup
"
style
=
{{
color
:
'
#91877F
'
}}
>
회원이
아니십니까
?
<
/Link
>
<
/div
>
<
/Form
>
...
...
client/src/Pages/Product.js
View file @
33f14441
...
...
@@ -159,7 +159,7 @@ function Product({ match, location }) {
<
Row
className
=
"
justify-content-center mx-0 pt-3 px-2
"
style
=
{{
position
:
"
fixed
"
,
bottom
:
"
0
"
,
width
:
"
100%
"
,
backgroundColor
:
"
#fff
"
}}
>
<
Col
sm
=
{
12
}
md
=
{
9
}
>
<
h6
style
=
{{
borderBottom
:
"
1px solid
"
,
paddingBottom
:
"
5px
"
,
marginBottom
:
"
1em
"
}}
>
회원님이
선호할만한
상품
추천
<
a
className
=
"
close float-right
"
onClick
=
{(
e
)
=>
handleClick
(
e
)}
style
=
{{
fontSize
:
"
1rem
"
}}
>
X
<
/a
>
<
a
className
=
"
close float-right
"
onClick
=
{(
e
)
=>
handleClick
(
e
)}
style
=
{{
fontSize
:
"
1rem
"
,
cursor
:
"
pointer
"
}}
>
X
<
/a
>
<
/h6
>
<
Row
className
=
"
justify-content-space mx-0
"
style
=
{{
flexWrap
:
"
nowrap
"
,
width
:
"
100%
"
,
overflowX
:
"
auto
"
}}
>
<
Col
as
=
{
Card
}
style
=
{{
minWidth
:
"
10rem
"
,
marginRight
:
"
1rem
"
}}
>
...
...
client/src/Pages/ProductsList.js
View file @
33f14441
...
...
@@ -74,7 +74,7 @@ function ProductsList({ match }) {
<
Col
sm
=
{
10
}
xs
=
{
12
}
>
<
h1
style
=
{{
fontSize
:
"
3rem
"
}}
className
=
"
text-center
"
>
{
mainCategory
}
<
/h1
>
<
div
className
=
"
text-center
"
>
<
ButtonGroup
className
=
"
d-flex flex-wrap
"
variant
=
"
outline-light secondary
"
>
<
ButtonGroup
className
=
"
m-3
"
variant
=
"
outline-light secondary
"
style
=
{{
display
:
"
inline-block
"
}}
>
{
subcategory
.
map
(
el
=>
(
<
Button
className
=
"
m-1
"
variant
=
"
secondary
"
>
{
el
}
<
/Button>
))
}
<
/ButtonGroup
>
<
/div
>
...
...
client/src/Pages/Signup.js
View file @
33f14441
...
...
@@ -10,7 +10,8 @@ const INIT_USER = {
id
:
''
,
password
:
''
,
password2
:
''
,
tel
:
''
tel
:
''
,
email
:
''
}
function
Signup
()
{
...
...
@@ -61,10 +62,10 @@ function Signup() {
if
(
success
)
{
alert
(
'
회원가입 되었습니다.
'
)
return
<
Redirect
to
=
'
/login
'
/>
return
<
Redirect
to
=
'
/login
'
/>
}
return
(
return
(
<
div
>
<
Container
className
=
"
my-5
"
>
...
...
@@ -94,27 +95,31 @@ return (
<
Form
.
Group
controlId
=
"
formBasicNumber
"
>
<
Form
.
Row
>
<
Col
sm
=
{
4
}
xs
=
{
6
}
as
=
{
Form
.
Label
}
for
=
"
number
"
>
주민등록번호
<
/Col
>
<
Col
as
=
{
Row
}
sm
=
{
8
}
xs
=
{
10
}
>
<
Row
>
<
Form
.
Control
required
type
=
"
text
"
name
=
"
number1
"
maxlength
=
"
6
"
className
=
"
mx-
2
"
style
=
{{
width
:
'
17
0px
'
}}
className
=
"
mx-
3 p-1
"
style
=
{{
width
:
'
8
0px
'
}}
value
=
{
user
.
number1
}
onChange
=
{
handleChange
}
>
<
/Form.Control
>
<
div
className
=
'
font-weight-bold d-flex align-items-center
'
style
=
{{
text
:
'
center
'
}}
>
-
<
/div
>
<
Form
.
Control
required
type
=
"
text
"
name
=
"
number2
"
maxlength
=
"
1
"
className
=
"
mx-3
"
style
=
{{
width
:
'
5
0px
'
}}
maxlength
=
"
1
"
className
=
"
mx-3
p-1
"
style
=
{{
width
:
'
3
0px
'
}}
value
=
{
user
.
number2
}
onChange
=
{
handleChange
}
>
<
/Form.Control
>
******
<
div
className
=
'
font-weight-bold d-flex align-items-center
'
>
*
*
*
*
*
*
<
/div
>
<
Form
.
Control
.
Feedback
type
=
"
invalid
"
>
주민등록번호를
입력하세요
.
<
/Form.Control.Feedback
>
<
/Col
>
<
/Row
>
<
/Form.Row
>
<
/Form.Group
>
<
Form
.
Group
controlId
=
"
formBasicId
"
>
...
...
@@ -164,16 +169,35 @@ return (
<
/Form.Control.Feedback
>
<
/Form.Row
>
<
/Form.Group
>
<
Form
.
Group
controlId
=
"
formBasicEmail
"
>
<
Form
.
Row
>
<
Col
sm
=
{
4
}
xs
=
{
6
}
as
=
{
Form
.
Label
}
for
=
"
email
"
>
이메일
<
/Col
>
<
Col
sm
=
{
8
}
xs
=
{
12
}
as
=
{
Form
.
Control
}
required
type
=
"
email
"
name
=
"
email
"
placeholder
=
"
E-mail
"
style
=
{{
width
:
'
160px
'
}}
value
=
{
user
.
email
}
onChange
=
{
handleChange
}
/
>
<
Form
.
Control
.
Feedback
type
=
"
invalid
"
>
이메일
입력하세요
.
<
/Form.Control.Feedback
>
<
/Form.Row
>
<
/Form.Group
>
<
Form
.
Group
controlId
=
"
formBasicTel
"
>
<
Form
.
Row
>
<
Col
sm
=
{
4
}
xs
=
{
6
}
as
=
{
Form
.
Label
}
for
=
"
tel
"
>
휴대전화
<
/Col
>
<
Col
sm
=
{
8
}
xs
=
{
12
}
as
=
{
Form
.
Control
}
required
type
=
"
text
"
<
Col
sm
=
{
8
}
xs
=
{
12
}
style
=
{{
width
:
'
160px
'
}}
className
=
'
p-0
'
>
<
Col
as
=
{
Form
.
Control
}
required
type
=
"
text
"
name
=
"
tel
"
size
=
"
sm
"
style
=
{{
width
:
'
160px
'
}}
placeholder
=
"
Telephone
"
className
=
'
p-1
'
value
=
{
user
.
tel
}
onChange
=
{
handleChange
}
/
>
onChange
=
{
handleChange
}
>
<
/Col
>
<
div
className
=
'
d-flex justify-content-end mt-1
'
><
small
>
'
-
'
를
함께
입력해주세요
^^<
/small></
div
>
<
/Col
>
<
Form
.
Control
.
Feedback
type
=
"
invalid
"
>
휴대전화를
입력하세요
.
<
/Form.Control.Feedback
>
<
/Form.Row
>
<
/Form.Group
>
...
...
@@ -188,7 +212,7 @@ return (
<
/Row
>
<
/Container
>
<
/div
>
)
)
}
export
default
Signup
\ No newline at end of file
server/controllers/user.controller.js
View file @
33f14441
...
...
@@ -31,8 +31,8 @@ const userById = async (req, res, next, id) => {
const
signup
=
async
(
req
,
res
)
=>
{
const
{
name
,
number1
,
number2
,
id
,
password
,
tel
}
=
req
.
body
console
.
log
(
req
.
body
)
const
{
name
,
number1
,
number2
,
id
,
password
,
tel
,
email
}
=
req
.
body
console
.
log
(
"
whatup
"
,
req
.
body
)
try
{
if
(
!
isLength
(
password
,
{
min
:
8
,
max
:
15
}))
{
return
res
.
status
(
422
).
send
(
'
비밀번호는 8-15자리로 입력해주세요.
'
)
...
...
@@ -51,8 +51,9 @@ const signup = async (req, res) => {
id
,
password
:
hash
,
tel
,
email
}).
save
()
await
new
Cart
({
userId
:
newUser
.
_id
,
role
}).
save
()
await
new
Cart
({
userId
:
newUser
.
_id
}).
save
()
console
.
log
(
newUser
)
res
.
json
(
newUser
)
...
...
server/schemas/User.js
View file @
33f14441
...
...
@@ -34,6 +34,10 @@ const UserSchema = new mongoose.Schema({
default
:
'
user
'
,
enum
:
[
'
user
'
,
'
admin
'
,
'
root
'
]
},
email
:
{
type
:
String
,
required
:
true
,
},
avatarUrl
:
{
type
:
String
}
...
...
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