Commit 9f51e246 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

Merge branch 'sangho' into jiwon

parents 6a18a7a0 33f14441
...@@ -13,6 +13,7 @@ const INIT_ACCOUNT = { ...@@ -13,6 +13,7 @@ const INIT_ACCOUNT = {
function Account() { function Account() {
const [account, setAccount] = useState(INIT_ACCOUNT) const [account, setAccount] = useState(INIT_ACCOUNT)
const [show, setShow] = useState(false); const [show, setShow] = useState(false);
const [proshow, setProshow] = useState(false)
const [error, setError] = useState("") const [error, setError] = useState("")
const userId = isAuthenticated() const userId = isAuthenticated()
...@@ -21,7 +22,7 @@ function Account() { ...@@ -21,7 +22,7 @@ function Account() {
try { try {
const response = await axios.get(`/api/users/account/${user}`) const response = await axios.get(`/api/users/account/${user}`)
setAccount(response.data) setAccount(response.data)
// console.log('555555555', response.data); console.log('555555555', response.data);
} catch (error) { } catch (error) {
catchError(error, setError) catchError(error, setError)
// console.log('error2222', error) // console.log('error2222', error)
...@@ -104,8 +105,8 @@ function Account() { ...@@ -104,8 +105,8 @@ function Account() {
)} )}
</Button> </Button>
<Modal show={show} onHide={() => setShow(false)}> <Modal show={show} onHide={() => setShow(false)}>
<Modal.Header closeButton> <Modal.Header closeButton style={{background:"#F7F3F3"}}>
<Modal.Title>이미지를 변경하시겠습니까?</Modal.Title> <Modal.Title >이미지를 변경하시겠습니까?</Modal.Title>
</Modal.Header> </Modal.Header>
<Form onSubmit={handleSubmit}> <Form onSubmit={handleSubmit}>
<Modal.Body> <Modal.Body>
...@@ -127,7 +128,28 @@ function Account() { ...@@ -127,7 +128,28 @@ function Account() {
<Row className="mt-4 text-center"> <Row className="mt-4 text-center">
<Col> <Col>
<h2> <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> </h2>
</Col> </Col>
</Row> </Row>
......
...@@ -89,8 +89,8 @@ function Login() { ...@@ -89,8 +89,8 @@ function Login() {
</Form.Control.Feedback> </Form.Control.Feedback>
</Form.Row> </Form.Row>
</Form.Group> </Form.Group>
<Button style={{ background: '#91877F', borderColor: '#91877F' }} type="submit" block>Login</Button> <Button style={{ background: '#91877F', borderColor: '#91877F' }} type="submit" block >Login</Button>
<div className="loginLine"> <div className="loginLine m-1">
<Link to="/signup" style={{ color: '#91877F' }}>회원이 아니십니까?</Link> <Link to="/signup" style={{ color: '#91877F' }}>회원이 아니십니까?</Link>
</div> </div>
</Form> </Form>
......
...@@ -170,7 +170,7 @@ function Product({ match, location }) { ...@@ -170,7 +170,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" }}> <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}> <Col sm={12} md={9}>
<h6 style={{ borderBottom: "1px solid", paddingBottom: "5px", marginBottom: "1em" }}>회원님이 선호할만한 상품 추천 <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> </h6>
<Row className="justify-content-space mx-0" style={{ flexWrap: "nowrap", width: "100%", overflowX: "auto" }}> <Row className="justify-content-space mx-0" style={{ flexWrap: "nowrap", width: "100%", overflowX: "auto" }}>
<Col as={Card} style={{ minWidth: "10rem", marginRight: "1rem" }}> <Col as={Card} style={{ minWidth: "10rem", marginRight: "1rem" }}>
......
...@@ -74,7 +74,7 @@ function ProductsList({ match }) { ...@@ -74,7 +74,7 @@ function ProductsList({ match }) {
<Col sm={10} xs={12} > <Col sm={10} xs={12} >
<h1 style={{ fontSize: "3rem" }} className="text-center">{mainCategory}</h1> <h1 style={{ fontSize: "3rem" }} className="text-center">{mainCategory}</h1>
<div className="text-center"> <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>))} {subcategory.map(el => (<Button className="m-1" variant="secondary">{el}</Button>))}
</ButtonGroup> </ButtonGroup>
</div> </div>
......
...@@ -10,7 +10,8 @@ const INIT_USER = { ...@@ -10,7 +10,8 @@ const INIT_USER = {
id: '', id: '',
password: '', password: '',
password2: '', password2: '',
tel: '' tel: '',
email: ''
} }
function Signup() { function Signup() {
...@@ -61,10 +62,10 @@ function Signup() { ...@@ -61,10 +62,10 @@ function Signup() {
if (success) { if (success) {
alert('회원가입 되었습니다.') alert('회원가입 되었습니다.')
return <Redirect to='/login'/> return <Redirect to='/login' />
} }
return ( return (
<div> <div>
<Container className="my-5"> <Container className="my-5">
...@@ -94,27 +95,31 @@ return ( ...@@ -94,27 +95,31 @@ return (
<Form.Group controlId="formBasicNumber"> <Form.Group controlId="formBasicNumber">
<Form.Row> <Form.Row>
<Col sm={4} xs={6} as={Form.Label} for="number">주민등록번호</Col> <Col sm={4} xs={6} as={Form.Label} for="number">주민등록번호</Col>
<Col as={Row} sm={8} xs={10} > <Row>
<Form.Control <Form.Control
required type="text" required type="text"
name="number1" name="number1"
maxlength="6" maxlength="6"
className="mx-2" style={{ width: '17 0px' }} className="mx-3 p-1" style={{ width: '80px' }}
value={user.number1} value={user.number1}
onChange={handleChange}> onChange={handleChange}>
</Form.Control> </Form.Control>
<div className='font-weight-bold d-flex align-items-center' style={{ text: 'center' }}>
- -
</div>
<Form.Control <Form.Control
required type="text" required type="text"
name="number2" name="number2"
maxlength="1" className="mx-3" maxlength="1" className="mx-3 p-1"
style={{ width: '50px' }} style={{ width: '30px' }}
value={user.number2} value={user.number2}
onChange={handleChange}> onChange={handleChange}>
</Form.Control> </Form.Control>
****** <div className='font-weight-bold d-flex align-items-center'>
* * * * * *
</div>
<Form.Control.Feedback type="invalid">주민등록번호를 입력하세요.</Form.Control.Feedback> <Form.Control.Feedback type="invalid">주민등록번호를 입력하세요.</Form.Control.Feedback>
</Col> </Row>
</Form.Row> </Form.Row>
</Form.Group> </Form.Group>
<Form.Group controlId="formBasicId"> <Form.Group controlId="formBasicId">
...@@ -164,16 +169,35 @@ return ( ...@@ -164,16 +169,35 @@ return (
</Form.Control.Feedback> </Form.Control.Feedback>
</Form.Row> </Form.Row>
</Form.Group> </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.Group controlId="formBasicTel">
<Form.Row> <Form.Row>
<Col sm={4} xs={6} as={Form.Label} for="tel">휴대전화</Col> <Col sm={4} xs={6} as={Form.Label} for="tel">휴대전화</Col>
<Col sm={8} xs={12} as={Form.Control} <Col sm={8} xs={12} style={{ width: '160px' }} className='p-0'>
required <Col
type="text" as={Form.Control}
required type="text"
name="tel" name="tel"
size="sm" style={{ width: '160px' }} placeholder="Telephone"
className='p-1'
value={user.tel} 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.Control.Feedback type="invalid"> 휴대전화를 입력하세요. </Form.Control.Feedback>
</Form.Row> </Form.Row>
</Form.Group> </Form.Group>
...@@ -188,7 +212,7 @@ return ( ...@@ -188,7 +212,7 @@ return (
</Row> </Row>
</Container> </Container>
</div> </div>
) )
} }
export default Signup export default Signup
\ No newline at end of file
...@@ -31,8 +31,8 @@ const userById = async (req, res, next, id) => { ...@@ -31,8 +31,8 @@ const userById = async (req, res, next, id) => {
const signup = async (req, res) => { const signup = async (req, res) => {
const { name, number1, number2, id, password, tel } = req.body const { name, number1, number2, id, password, tel, email } = req.body
console.log(req.body) console.log("whatup",req.body)
try { try {
if (!isLength(password, { min: 8, max: 15 })) { if (!isLength(password, { min: 8, max: 15 })) {
return res.status(422).send('비밀번호는 8-15자리로 입력해주세요.') return res.status(422).send('비밀번호는 8-15자리로 입력해주세요.')
...@@ -51,6 +51,7 @@ const signup = async (req, res) => { ...@@ -51,6 +51,7 @@ const signup = async (req, res) => {
id, id,
password: hash, password: hash,
tel, tel,
email
}).save() }).save()
await new Cart({ userId: newUser._id }).save() await new Cart({ userId: newUser._id }).save()
console.log(newUser) console.log(newUser)
......
...@@ -34,6 +34,10 @@ const UserSchema = new mongoose.Schema({ ...@@ -34,6 +34,10 @@ const UserSchema = new mongoose.Schema({
default: 'user', default: 'user',
enum: ['user', 'admin', 'root'] enum: ['user', 'admin', 'root']
}, },
email : {
type : String,
required: true,
},
avatarUrl: { avatarUrl: {
type: String type: String
} }
......
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