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
search-page
Commits
dce7cd4e
Commit
dce7cd4e
authored
Feb 01, 2021
by
Lee SeoYeon
Browse files
Merge remote-tracking branch 'origin/BAE' into lsy
parents
63cc51a1
b11c4c5d
Changes
8
Hide whitespace changes
Inline
Side-by-side
client/src/Bookmark.js
View file @
dce7cd4e
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
React
,
{
useState
,
useEffect
}
from
'
react
'
import
{
Alert
,
Col
,
Card
,
Container
,
Form
,
Row
,
Button
,
Nav
,
Navbar
}
from
"
react-bootstrap
"
import
{
Col
,
Card
,
Container
,
Row
,
Button
,
Nav
,
Navbar
,
Image
}
from
"
react-bootstrap
"
import
axios
from
"
axios
"
import
axios
from
"
axios
"
import
catchErrors
from
'
./utils/catchErrors.js
'
import
catchErrors
from
'
./utils/catchErrors.js
'
import
{
isAuthenticated
}
from
'
./utils/auth
'
import
{
isAuthenticated
}
from
'
./utils/auth
'
import
*
as
Icon
from
'
react-bootstrap-icons
'
;
import
*
as
Icon
from
'
react-bootstrap-icons
'
;
import
Place
from
'
./Pages/Place.js
'
import
Place
from
'
./Pages/Place.js
'
import
{
Link
}
from
'
react-router-dom
'
import
ohuh
from
'
./ohuh-sm.PNG
'
;
const
INIT_PAGE
=
{
const
INIT_PAGE
=
{
...
@@ -66,6 +68,9 @@ function Bookmark() {
...
@@ -66,6 +68,9 @@ function Bookmark() {
return
(
return
(
<
Container
>
<
Container
>
<
Link
to
=
"
/
"
className
=
"
d-flex justify-content-center
"
>
<
Image
style
=
{{
margin
:
"
1%
"
}}
src
=
{
ohuh
}
/
>
<
/Link
>
<
Navbar
bg
=
"
info
"
variant
=
"
dark
"
>
<
Navbar
bg
=
"
info
"
variant
=
"
dark
"
>
<
Navbar
.
Brand
href
=
"
/
"
>
북마크
<
/Navbar.Brand
>
<
Navbar
.
Brand
href
=
"
/
"
>
북마크
<
/Navbar.Brand
>
<
Nav
className
=
"
mr-auto
"
>
<
Nav
className
=
"
mr-auto
"
>
...
@@ -106,7 +111,7 @@ function Bookmark() {
...
@@ -106,7 +111,7 @@ function Bookmark() {
<
/Row
>
<
/Row
>
<
/Container
>
<
/Container
>
)
)
}
}
...
...
client/src/Components/Login.js
View file @
dce7cd4e
...
@@ -46,7 +46,7 @@ function Login() {
...
@@ -46,7 +46,7 @@ function Login() {
}
}
if
(
success
)
{
if
(
success
)
{
console
.
log
(
'
success
'
,
success
)
alert
(
"
로그인되었습니다.
"
)
return
<
Redirect
to
=
'
/
'
/>
//성공하면 홈화면으로 간다
return
<
Redirect
to
=
'
/
'
/>
//성공하면 홈화면으로 간다
}
}
...
...
client/src/Pages/App.js
View file @
dce7cd4e
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Redirect
}
from
'
react-router-dom
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
ohuh
from
'
../ohuh.PNG
'
;
import
ohuh
from
'
../ohuh.PNG
'
;
import
{
Container
,
Row
,
Form
,
Image
,
InputGroup
,
Button
,
Col
,
Card
,
Nav
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Form
,
Image
,
InputGroup
,
Button
,
Col
,
Card
,
Nav
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
Place
from
'
../Pages/Place.js
'
;
import
{
handleLogout
,
isAuthenticated
}
from
'
../utils/auth.js
'
import
{
handleLogout
,
isAuthenticated
}
from
'
../utils/auth.js
'
import
Place
from
'
../Pages/Place.js
'
;
function
App
()
{
function
App
()
{
const
[
state
,
setState
]
=
useState
(
false
);
const
[
state
,
setState
]
=
useState
(
false
);
const
[
search
,
setSearch
]
=
useState
(
""
);
const
[
search
,
setSearch
]
=
useState
(
""
);
const
[
show
,
setShow
]
=
useState
(
false
);
const
[
recommend
,
setRecommend
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}]);
const
[
recommend
,
setRecommend
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}]);
const
[
latest
,
setLatest
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}]);
const
[
latest
,
setLatest
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}]);
const
user
=
isAuthenticated
()
const
user
=
isAuthenticated
()
...
@@ -19,6 +18,7 @@ function App() {
...
@@ -19,6 +18,7 @@ function App() {
getLatest
()
getLatest
()
},
[]);
},
[]);
if
(
state
!==
false
)
{
if
(
state
!==
false
)
{
return
<
Redirect
to
=
{
`/search?keyword=
${
search
}
`
}
/>
;
return
<
Redirect
to
=
{
`/search?keyword=
${
search
}
`
}
/>
;
}
}
...
@@ -55,9 +55,15 @@ function App() {
...
@@ -55,9 +55,15 @@ function App() {
return
(
return
(
<
Container
className
=
"
vh-100 d-flex justify-content-md-center
\"
>
// <Container className="vh-100 ">
// <Col md={12} >
// <Row className="justify-content-center" >
// <Image src={ohuh} style={{ margin: "5%", marginTop : "3%" }} />
// </Row>
// <Row style={{ marginBottom: "5%" }}>
<
Container
className
=
"
vh-100
"
>
<
Col
md
=
{
12
}
>
<
Col
md
=
{
12
}
>
<Nav className=
"
justify
-
content
-
end
"
bg=
"
#
fff
"
variant=
"
light
"
>
<
Nav
className
=
"
justify-content-end
"
bg
=
"
#fff
"
variant
=
"
light
"
style
=
{{}}
>
{
user
?
<
Nav
.
Link
onClick
=
{()
=>
handleLogout
()}
>
로그아웃
<
/Nav.Link
>
{
user
?
<
Nav
.
Link
onClick
=
{()
=>
handleLogout
()}
>
로그아웃
<
/Nav.Link
>
:
(
:
(
<>
<>
...
@@ -67,8 +73,8 @@ function App() {
...
@@ -67,8 +73,8 @@ function App() {
)}
)}
<
Nav
.
Link
href
=
'
/bookmark
'
>
북마크
<
/Nav.Link
>
<
Nav
.
Link
href
=
'
/bookmark
'
>
북마크
<
/Nav.Link
>
<
/Nav
>
<
/Nav
>
<Row className=
"
justify
-
content
-
center
"
>
<
Row
className
=
"
justify-content-center
"
>
<Image src={ohuh} style={{ margin:
"
5
%
"
, marginTop :
"
3
%
"
}} />
<
Image
src
=
{
ohuh
}
style
=
{{
margin
:
"
3
%
"
,
marginTop
:
"
3%
"
}}
/
>
<
/Row
>
<
/Row
>
<
Row
style
=
{{
marginBottom
:
"
5%
"
}}
>
<
Row
style
=
{{
marginBottom
:
"
5%
"
}}
>
<
Form
className
=
"
vw-100
"
onSubmit
=
{
handleSubmit
}
>
<
Form
className
=
"
vw-100
"
onSubmit
=
{
handleSubmit
}
>
...
@@ -88,33 +94,31 @@ function App() {
...
@@ -88,33 +94,31 @@ function App() {
<
/Row
>
<
/Row
>
<
Row
>
<
Row
>
<
Col
md
=
{
6
}
>
<
Col
md
=
{
6
}
>
<h1 className=
"
d
-
flex
justify
-
content
-
center
"
style={{marginBottom:
"
7
%
"
}}>인기관광지</h1>
<
h1
className
=
"
d-flex justify-content-center
"
style
=
{{
marginBottom
:
"
7%
"
}}
>
인기관광지
<
/h1
>
<
Card
align
=
"
center
"
border
=
"
info
"
style
=
{{
margin
:
"
3%
"
}}
>
<
Card
align
=
"
center
"
border
=
"
info
"
style
=
{{
margin
:
"
3%
"
}}
>
<
Card
.
Title
style
=
{{
margin
:
"
3%
"
,
fontSize
:
'
200%
'
,
fontWeight
:
'
bold
'
}}
>
{
recommend
.
name
}
<
/Card.Title
>
<
Card
.
Title
style
=
{{
margin
:
"
3%
"
,
fontSize
:
'
200%
'
,
fontWeight
:
'
bold
'
}}
>
{
recommend
.
name
}
<
/Card.Title
>
<
Card
.
Img
variant
=
"
top
"
style
=
{{
padding
:
"
5%
"
,
width
:
"
100%
"
,
height
:
"
340px
"
}}
src
=
{
recommend
.
img
}
/
>
<
Card
.
Img
variant
=
"
top
"
style
=
{{
padding
:
"
5%
"
,
width
:
"
100%
"
,
height
:
"
340px
"
}}
src
=
{
recommend
.
img
}
/
>
<
Card
.
Body
>
<
Card
.
Body
>
<
Card
.
Text
style
=
{{
overflow
:
'
auto
'
,
fontSize
:
'
25px
'
,
width
:
'
100%
'
,
height
:
"
80px
"
}}
>
<
Card
.
Text
style
=
{{
overflow
:
'
auto
'
,
fontSize
:
'
25px
'
,
width
:
'
100%
'
,
height
:
"
80px
"
}}
>
{
recommend
.
address
}
<
/Card.Text
>
{
recommend
.
address
}
<
/Card.Text
>
<Button variant=
"
info
"
onClick={() => {
<
Link
to
=
{
`/place?id=
${
1
}
&place=
${
recommend
.
name
}
`
}
>
setShow(true)
<
Button
variant
=
"
info
"
>
{
recommend
.
name
}
자세히
살펴보기
<
/Button
>
}}>{recommend.name} 자세히 살펴보기</Button>
<
/Link
>
<Place place={recommend} show={show} onHide={() => setShow(false)} />
<
/Card.Body
>
<
/Card.Body
>
<
/Card
>
<
/Card
>
<
/Col
>
<
/Col
>
<
Col
md
=
{
6
}
>
<
Col
md
=
{
6
}
>
<h1 className=
"
d
-
flex
justify
-
content
-
center
"
style={{marginBottom:
"
7
%
"
}}>최근 검색관광지</h1>
<
h1
className
=
"
d-flex justify-content-center
"
style
=
{{
marginBottom
:
"
7%
"
}}
>
최근
검색관광지
<
/h1
>
<
Card
align
=
"
center
"
border
=
"
info
"
style
=
{{
margin
:
"
3%
"
}}
>
<
Card
align
=
"
center
"
border
=
"
info
"
style
=
{{
margin
:
"
3%
"
}}
>
<
Card
.
Title
style
=
{{
margin
:
"
3%
"
,
fontSize
:
'
200%
'
,
fontWeight
:
'
bold
'
}}
>
{
latest
.
name
}
<
/Card.Title
>
<
Card
.
Title
style
=
{{
margin
:
"
3%
"
,
fontSize
:
'
200%
'
,
fontWeight
:
'
bold
'
}}
>
{
latest
.
name
}
<
/Card.Title
>
<
Card
.
Img
variant
=
"
top
"
style
=
{{
padding
:
"
5%
"
,
width
:
"
100%
"
,
height
:
"
340px
"
}}
src
=
{
latest
.
img
}
/
>
<
Card
.
Img
variant
=
"
top
"
style
=
{{
padding
:
"
5%
"
,
width
:
"
100%
"
,
height
:
"
340px
"
}}
src
=
{
latest
.
img
}
/
>
<
Card
.
Body
>
<
Card
.
Body
>
<
Card
.
Text
style
=
{{
overflow
:
'
auto
'
,
fontSize
:
'
25px
'
,
width
:
'
100%
'
,
height
:
"
80px
"
}}
>
<
Card
.
Text
style
=
{{
overflow
:
'
auto
'
,
fontSize
:
'
25px
'
,
width
:
'
100%
'
,
height
:
"
80px
"
}}
>
{
latest
.
address
}
<
/Card.Text
>
{
latest
.
address
}
<
/Card.Text
>
<Button variant=
"
info
"
onClick={() => {
<
Link
to
=
{
`/place?id=
${
1
}
&place=
${
latest
.
name
}
`
}
>
setShow(true)
<
Button
variant
=
"
info
"
>
{
latest
.
name
}
자세히
살펴보기
<
/Button
>
}}>{latest.name} 자세히 살펴보기</Button>
<
/Link
>
<Place place={latest} show={show} onHide={() => setShow(false)} />
<
/Card.Body
>
<
/Card.Body
>
<
/Card
>
<
/Card
>
<
/Col
>
<
/Col
>
...
...
client/src/Pages/Place.js
View file @
dce7cd4e
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
Container
,
Row
,
Button
,
Col
,
ListGroup
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Image
,
ListGroup
}
from
'
react-bootstrap
'
;
import
queryString
from
'
query-string
'
import
queryString
from
'
query-string
'
import
{
Link
}
from
'
react-router-dom
'
;
import
ohuh
from
'
../ohuh-sm.PNG
'
;
function
Place
(
props
)
{
function
Place
(
props
)
{
console
.
log
(
props
)
console
.
log
(
props
)
...
@@ -54,6 +56,9 @@ function Place(props) {
...
@@ -54,6 +56,9 @@ function Place(props) {
return
(
return
(
<
Container
{...
props
}
>
<
Container
{...
props
}
>
<
Row
>
<
Row
>
<
Link
to
=
"
/
"
className
=
"
d-flex justify-content-center
"
>
<
Image
style
=
{{
margin
:
"
1%
"
}}
src
=
{
ohuh
}
/
>
<
/Link
>
{
place
}
{
place
}
{
Array
.
isArray
(
reviews
)
?
reviews
.
map
((
review
,
index
)
=>
{
{
Array
.
isArray
(
reviews
)
?
reviews
.
map
((
review
,
index
)
=>
{
return
(
return
(
...
...
client/src/Pages/Search.js
View file @
dce7cd4e
...
@@ -18,7 +18,6 @@ function Search(props) {
...
@@ -18,7 +18,6 @@ function Search(props) {
const
[
search
,
setSearch
]
=
useState
(
queryString
.
parse
(
props
.
location
.
search
).
keyword
);
const
[
search
,
setSearch
]
=
useState
(
queryString
.
parse
(
props
.
location
.
search
).
keyword
);
const
[
bookmark
,
setBookmark
]
=
useState
([
false
,
false
,
false
,
false
])
const
[
bookmark
,
setBookmark
]
=
useState
([
false
,
false
,
false
,
false
])
const
user
=
isAuthenticated
()
const
user
=
isAuthenticated
()
const
[
mobile
,
setMobile
]
=
useState
();
const
[
association
,
setAssociation
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}])
const
[
association
,
setAssociation
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}])
const
[
pagePlace
,
setPagePlace
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
},
{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}])
const
[
pagePlace
,
setPagePlace
]
=
useState
([{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
},
{
name
:
"
"
,
address
:
"
"
,
img
:
"
"
}])
const
[
endPage
,
setEndPage
]
=
useState
(
1
)
const
[
endPage
,
setEndPage
]
=
useState
(
1
)
...
@@ -58,7 +57,6 @@ function Search(props) {
...
@@ -58,7 +57,6 @@ function Search(props) {
setPagePlace
(
paginate
(
association
,
index
,
4
))
setPagePlace
(
paginate
(
association
,
index
,
4
))
}
}
setEndPage
(
Math
.
floor
((
association
.
length
/
4
)))
setEndPage
(
Math
.
floor
((
association
.
length
/
4
)))
console
.
log
(
"
7489309484839
"
,
endPage
)
},
[
association
,
index
])
},
[
association
,
index
])
...
@@ -89,18 +87,6 @@ function Search(props) {
...
@@ -89,18 +87,6 @@ function Search(props) {
console
.
log
(
scrollHeight
,
scrollTop
,
clientHeight
)
console
.
log
(
scrollHeight
,
scrollTop
,
clientHeight
)
}
}
if
(
state
!==
false
)
{
// console.log(queryString.parse(props.location.search))
// = {keyword:search}
// return <Redirect to={{
// pathname: `/search?keyword=${search}`,
// state: { id: search },
// }} />;
// history.pushState(null, null, "?"+queryParams.toString());
// return <Redirect to={`/search?keyword=${search}`} />;
}
const
handlePage
=
(
num
)
=>
{
const
handlePage
=
(
num
)
=>
{
setIndex
(
num
);
setIndex
(
num
);
console
.
log
(
"
pagenation num
"
,
num
)
console
.
log
(
"
pagenation num
"
,
num
)
...
...
client/src/utils/auth.js
View file @
dce7cd4e
...
@@ -5,6 +5,7 @@ export function handleLogin(userId) { //로그인할때 로컬스토리지에
...
@@ -5,6 +5,7 @@ export function handleLogin(userId) { //로그인할때 로컬스토리지에
}
}
export
async
function
handleLogout
()
{
export
async
function
handleLogout
()
{
alert
(
"
로그아웃되었습니다.
"
)
localStorage
.
removeItem
(
'
loginStatus
'
)
//로컬스토리지에서 로그인상태를 지운다
localStorage
.
removeItem
(
'
loginStatus
'
)
//로컬스토리지에서 로그인상태를 지운다
await
axios
.
get
(
'
/api/auth/logout
'
)
await
axios
.
get
(
'
/api/auth/logout
'
)
window
.
location
.
href
=
'
/
'
//경로 지정
window
.
location
.
href
=
'
/
'
//경로 지정
...
...
server/controllers/place.controller.js
View file @
dce7cd4e
...
@@ -2,6 +2,7 @@ import Places from '../models/Place.js'
...
@@ -2,6 +2,7 @@ import Places from '../models/Place.js'
import
cheerio
from
'
cheerio
'
import
cheerio
from
'
cheerio
'
import
fs
from
'
fs
'
import
fs
from
'
fs
'
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
nextTick
}
from
'
process
'
;
const
searchPlace
=
async
(
req
,
res
,
next
,)
=>
{
const
searchPlace
=
async
(
req
,
res
,
next
,)
=>
{
...
...
server/server.js
View file @
dce7cd4e
...
@@ -14,9 +14,10 @@ app.use(express.json())
...
@@ -14,9 +14,10 @@ app.use(express.json())
app
.
use
(
placeRouter
)
app
.
use
(
placeRouter
)
app
.
use
(
reviewRouter
)
app
.
use
(
reviewRouter
)
app
.
use
(
appRouter
)
app
.
use
(
userRouter
)
app
.
use
(
userRouter
)
app
.
use
(
authRouter
)
app
.
use
(
authRouter
)
app
.
use
(
appRouter
)
app
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
app
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
console
.
log
(
"
/ req.body
"
,
req
.
body
)
console
.
log
(
"
/ req.body
"
,
req
.
body
)
...
...
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