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
travel
Commits
483dba83
Commit
483dba83
authored
Jul 06, 2022
by
Lee Soobeom
Browse files
Merge remote-tracking branch 'origin/sm4' into develop0
parents
4d70e719
f9ed2d93
Changes
3
Hide whitespace changes
Inline
Side-by-side
frontend/src/Pages/picpagination.tsx
0 → 100644
View file @
483dba83
import
React
from
"
react
"
;
type
num
=
{
total
:
number
,
page
:
number
,
setPage
:
Function
}
export
default
function
Pagination
({
total
,
page
,
setPage
}
:
num
)
{
const
numPages
=
Math
.
ceil
(
total
/
15
);
return
(
<
div
>
<
button
onClick
=
{
()
=>
setPage
(
page
-
1
)
}
disabled
=
{
page
===
1
}
>
<
</
button
>
{
Array
(
numPages
)
.
fill
(
1
)
.
map
((
_
,
i
)
=>
(
<
button
key
=
{
i
+
1
}
onClick
=
{
()
=>
setPage
(
i
+
1
)
}
>
{
i
+
1
}
</
button
>
))
}
<
button
onClick
=
{
()
=>
setPage
(
page
+
1
)
}
disabled
=
{
page
===
numPages
}
>
>
</
button
>
</
div
>
);
};
frontend/src/pages/body.tsx
View file @
483dba83
import
React
,
{
useEffect
,
MouseEvent
}
from
"
react
"
;
import
React
,
{
useEffect
,
MouseEvent
,
useState
}
from
"
react
"
;
import
{
Outlet
,
useSearchParams
}
from
"
react-router-dom
"
;
import
{
Outlet
,
useSearchParams
}
from
"
react-router-dom
"
;
import
Theme
from
"
./theme
"
;
import
Theme
from
"
./theme
"
;
import
Citylist
from
"
./citylist
"
;
import
Citylist
from
"
./citylist
"
;
import
{
getPicure
}
from
"
./pic
"
;
import
{
getPicure
}
from
"
./pic
"
;
import
Pagination
from
"
./picpagination
"
import
{
LibManifestPlugin
}
from
"
webpack
"
;
const
initSearchParams
=
{
"
theme
"
:
""
,
"
city
"
:
""
}
const
initSearchParams
=
{
"
theme
"
:
""
,
"
city
"
:
""
}
export
default
function
Body
()
{
export
default
function
Body
()
{
let
limit
=
15
;
const
[
searchParams
,
setSearchParams
]
=
useSearchParams
(
initSearchParams
);
const
[
page
,
setPage
]
=
useState
(
1
);
const
offset
=
(
page
-
1
)
*
limit
;
const
[
searchParams
,
setSearchParams
]
=
useSearchParams
(
initSearchParams
)
let
getPics
=
getPicure
();
let
getPics
=
getPicure
();
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -31,11 +37,16 @@ export default function Body() {
...
@@ -31,11 +37,16 @@ export default function Body() {
city
:
event
.
currentTarget
.
id
city
:
event
.
currentTarget
.
id
})
})
}
}
let
themechange
=
searchParams
.
get
(
'
theme
'
);
let
citylistchange
=
searchParams
.
get
(
'
city
'
);
const
Idpics
=
getPics
.
filter
(
p
=>
{
const
Idpics
=
getPics
.
filter
(
p
=>
{
return
(
p
.
themeid
==
searchParams
.
get
(
'
theme
'
)
&&
p
.
cityid
==
searchParams
.
get
(
'
city
'
))
||
(
p
.
themeid
==
searchParams
.
get
(
'
theme
'
)
&&
searchParams
.
get
(
'
city
'
)
==
""
)
return
(
p
.
themeid
==
themechange
&&
p
.
cityid
==
citylistchange
)
||
||
(
searchParams
.
get
(
'
theme
'
)
==
""
&&
p
.
cityid
==
searchParams
.
get
(
'
city
'
))
||
(
searchParams
.
get
(
'
theme
'
)
==
""
&&
searchParams
.
get
(
'
city
'
)
==
""
)
(
p
.
themeid
==
themechange
&&
citylistchange
==
""
)
||
(
themechange
==
""
&&
p
.
cityid
==
citylistchange
)
||
(
themechange
==
""
&&
citylistchange
==
""
)
})
})
...
@@ -44,14 +55,16 @@ export default function Body() {
...
@@ -44,14 +55,16 @@ export default function Body() {
<
Theme
handleClick
=
{
themeHandleClick
}
/>
<
Theme
handleClick
=
{
themeHandleClick
}
/>
<
div
className
=
"flex flex-col md:flex-row py-10 "
>
<
div
className
=
"flex flex-col md:flex-row py-10 "
>
<
Citylist
handleClick
=
{
cityHandleClick
}
/>
<
Citylist
handleClick
=
{
cityHandleClick
}
/>
<
div
className
=
"flex md:mr-10 md:basis-4/5 grid grid-rows-3 grid-cols-5"
>
<
div
className
=
"flex
-row
md:mr-10 md:basis-4/5 grid grid-rows-3 grid-cols-5"
>
{
Idpics
.
map
((
pic
,
index
:
number
)
=>
(
{
Idpics
.
slice
(
offset
,
offset
+
limit
).
map
((
pic
,
index
:
number
)
=>
(
<
div
className
=
"m-1 shrink-0 bg-gray-200 rounded overflow-hidden shadow-md"
key
=
{
index
}
>
<
div
className
=
"m-1 shrink-0 bg-gray-200 rounded overflow-hidden shadow-md"
key
=
{
index
}
>
<
img
src
=
{
pic
.
url
}
className
=
"w-full h-10 md:h-20 object-c
ov
er"
/>
<
img
src
=
{
pic
.
url
}
className
=
"w-full h-10 md:h-20 object-c
ent
er"
/>
<
p
className
=
"text-center text-xs"
>
{
pic
.
name
}
</
p
>
<
p
className
=
"text-center text-xs"
>
{
pic
.
name
}
</
p
>
</
div
>
</
div
>
))
}
))
}
<
Pagination
total
=
{
Idpics
.
length
}
page
=
{
page
}
setPage
=
{
setPage
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
<
Outlet
/>
<
Outlet
/>
</
div
>
</
div
>
...
...
src/app.ts
View file @
483dba83
...
@@ -9,7 +9,6 @@ app.use(express.urlencoded({ extended: true }));
...
@@ -9,7 +9,6 @@ app.use(express.urlencoded({ extended: true }));
app
.
use
(
cookieParser
());
app
.
use
(
cookieParser
());
app
.
use
(
"
/api
"
,
router
);
app
.
use
(
"
/api
"
,
router
);
app
.
use
((
err
:
any
,
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
app
.
use
((
err
:
any
,
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
console
.
log
(
"
익스프레스 에러:
"
,
err
);
console
.
log
(
"
익스프레스 에러:
"
,
err
);
res
.
status
(
err
.
statusCode
||
500
).
send
(
err
.
message
||
"
서버 에러
"
);
res
.
status
(
err
.
statusCode
||
500
).
send
(
err
.
message
||
"
서버 에러
"
);
...
...
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