Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최은석
/
ossw-project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
채지성
2022-06-03 22:44:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3dfa0a0a2bdaba55e22ca26cccfef209fb4e2c67
3dfa0a0a
1 parent
0dbf802c
mainpage
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
40 deletions
client/src/Component/mainpage.css
client/src/Component/mainpage.js
client/src/Component/mainpage.css
View file @
3dfa0a0
.mainpage
{
display
:
grid
;
grid-template-rows
:
1.3
fr
1
fr
;
width
:
80%
;
.mainpage
{
height
:
90%
;
padding
:
5%
;
width
:
80%
;
display
:
grid
;
grid-template-rows
:
1.4
fr
1
fr
;
}
.mainpage
:nth-child
(
1
)
{
display
:
grid
;
grid-template-rows
:
1
fr
10
fr
;
}
.mainpage
:nth-child
(
2
)
{
.mainpage
:nth-child
(
1
)
:not
(
.mainpage
:nth-child
(
1
)
:nth-child
(
1
))
{
display
:
grid
;
grid-template-columns
:
1
fr
1
fr
;
}
grid-template-rows
:
8%
16%
74%
;
.whatAboutMeal
{
display
:
grid
;
grid-template-rows
:
1
fr
8
fr
;
grid-template-columns
:
100%
;
}
.mainpage
:nth-child
(
1
)
:nth-child
(
1
)
{
padding-left
:
10%
;
}
.mainpage
:nth-child
(
1
)
:nth-child
(
3
),
.mainpage
:nth-child
(
1
)
:nth-child
(
4
),
.mainpage
:nth-child
(
1
)
:nth-child
(
5
),
.mainpage
:nth-child
(
1
)
:nth-child
(
6
)
{
text-align
:
center
;
padding-top
:
2%
;
}
.mainpageInner
{
}
\ No newline at end of file
.lunchTable
,
.dinnerTable
{
display
:
flex
;
flex-direction
:
column
;
}
...
...
client/src/Component/mainpage.js
View file @
3dfa0a0
import
'./App.css'
;
import
axios
from
"axios"
;
import
{
useEffect
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
'./mainpage.css'
let
today
=
'~'
+
'월'
+
'*'
+
'일'
;
// 날짜 받아오기
function
MainPage
()
{
const
callApi
=
async
()
=>
{
axios
.
get
(
"/api"
).
then
((
res
)
=>
{
console
.
log
(
res
.
data
.
test
)});
const
[
lunch
,
setlunch
]
=
useState
(
""
);
const
[
dinner
,
setdinner
]
=
useState
(
""
);
let
currentYear
=
new
Date
().
getFullYear
();
let
currentMonth
=
new
Date
().
getMonth
();
let
currentDate
=
new
Date
().
getDate
();
let
today
=
currentYear
+
'/'
+
currentMonth
+
'/'
+
currentDate
;
const
makeTable
=
(
arr_
,
dom_
)
=>
{
arr_
.
forEach
((
elem
)
=>
{
let
span_
=
document
.
createElement
(
'div'
);
span_
.
innerHTML
=
elem
;
dom_
.
appendChild
(
span_
);
console
.
log
(
"하이1"
);
});
};
const
todayMealTable
=
async
()
=>
{
axios
.
get
(
"/api/todayMenu"
).
then
(
(
res
)
=>
{
const
index1
=
res
.
data
[
0
].
indexOf
(
':'
);
const
index2
=
res
.
data
[
1
].
indexOf
(
':'
);
let
lunchArr
=
res
.
data
[
0
].
substring
(
index1
+
1
);
let
dinnerArr
=
res
.
data
[
1
].
substring
(
index2
+
1
);
if
(
index1
!==
-
1
){
lunchArr
=
lunchArr
.
split
(
','
);
}
if
(
index1
!==
-
1
){
dinnerArr
=
dinnerArr
.
split
(
','
);
}
console
.
log
(
lunchArr
,
dinnerArr
);
const
lunchDom
=
document
.
getElementsByClassName
(
'lunchTable'
)[
0
];
const
dinnerDom
=
document
.
getElementsByClassName
(
'dinnerTable'
)[
0
];
makeTable
(
lunchArr
,
lunchDom
);
makeTable
(
dinnerArr
,
dinnerDom
);
setlunch
(
lunchArr
);
setdinner
(
dinnerArr
);
}
)
}
useEffect
(()
=>
{
callApi
();
todayMealTable
();
},
[]);
return
(
<
div
className
=
'mainpage'
>
<
div
className
=
'mainpageInner'
id
=
'MealTable'
>
{
today
}
제
2
기숙사
학식
<
div
className
=
'mainpage'
>
<
div
>
<
div
>
{
today
}
제
2
기숙사
학식
<
/div
>
<
div
><
/div
>
<
div
>
점심
<
/div
>
<
div
>
저녁
<
/div
>
<
div
className
=
'lunchTable'
>
<
/div
>
<
div
className
=
'dinnerTable'
><
/div
>
<
/div
>
<
div
className
=
'mainpageInner'
>
<
div
className
=
'whatAboutMeal'
>
오늘
메뉴
어때
?
<
div
>
<
div
>
<
/div
>
<
/div
>
<
div
className
=
'whatAboutMeal'
>
어제
메뉴
어땠어
?
<
div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
);
}
//첫번째: 오늘 메뉴/ 두번째: 오늘 메뉴에 대한 이야기/ 세번째: 어제 메뉴에 대한 이야기
...
...
Please
register
or
login
to post a comment